Fix crash in AggressiveAntiDepBreaker with empty CriticalPathSet
authorHal Finkel <hfinkel@anl.gov>
Thu, 12 Sep 2013 04:22:31 +0000 (04:22 +0000)
committerHal Finkel <hfinkel@anl.gov>
Thu, 12 Sep 2013 04:22:31 +0000 (04:22 +0000)
If no register classes are added to CriticalPathRCs, then the CriticalPathSet
bitmask will be empty. In that case, ExcludeRegs must remain NULL or else this
line will cause a segfault:

  } else if ((ExcludeRegs != NULL) && ExcludeRegs->test(AntiDepReg)) {

I have no in-tree test case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190584 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AggressiveAntiDepBreaker.cpp

index e0797079c5eb1b51bbbba9034c94da4619cdb2a7..2ee7767115875b1fce6d9d9872340c8f6b8c783d 100644 (file)
@@ -782,7 +782,7 @@ unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
     if (MI == CriticalPathMI) {
       CriticalPathSU = CriticalPathStep(CriticalPathSU);
       CriticalPathMI = (CriticalPathSU) ? CriticalPathSU->getInstr() : 0;
-    } else {
+    } else if (CriticalPathSet.any()) {
       ExcludeRegs = &CriticalPathSet;
     }