Selaa lähdekoodia

Allow delete self loop in JumpThreading. (#3409)

Xiang Li 4 vuotta sitten
vanhempi
commit
7b3c0bba92
1 muutettua tiedostoa jossa 5 lisäystä ja 1 poistoa
  1. 5 1
      lib/Transforms/Scalar/JumpThreading.cpp

+ 5 - 1
lib/Transforms/Scalar/JumpThreading.cpp

@@ -189,7 +189,11 @@ bool JumpThreading::runOnFunction(Function &F) {
 
       // If the block is trivially dead, zap it.  This eliminates the successor
       // edges which simplifies the CFG.
-      if (pred_empty(BB) &&
+      if ((pred_empty(BB)
+          // HLSL change begin - delete self loop.
+          || BB->getSinglePredecessor() == BB
+          // HLSL change end.
+          ) &&
           BB != &BB->getParent()->getEntryBlock()) {
         DEBUG(dbgs() << "  JT: Deleting dead block '" << BB->getName()
               << "' with terminator: " << *BB->getTerminator() << '\n');