[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ADCE.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Nov 16 15:40:01 PST 2003


Changes in directory llvm/lib/Transforms/Scalar:

ADCE.cpp updated: 1.65 -> 1.66

---
Log message:

Fix PR116


---
Diffs of the changes:  (+12 -0)

Index: llvm/lib/Transforms/Scalar/ADCE.cpp
diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.65 llvm/lib/Transforms/Scalar/ADCE.cpp:1.66
--- llvm/lib/Transforms/Scalar/ADCE.cpp:1.65	Tue Nov 11 16:41:33 2003
+++ llvm/lib/Transforms/Scalar/ADCE.cpp	Sun Nov 16 15:39:27 2003
@@ -209,6 +209,18 @@
     return MadeChanges;
   }
 
+  // Scan the function marking blocks without post-dominance information as
+  // live.  Blocks without post-dominance information occur when there is an
+  // infinite loop in the program.  Because the infinite loop could contain a
+  // function which unwinds, exits or has side-effects, we don't want to delete
+  // the infinite loop or those blocks leading up to it.
+  for (Function::iterator I = Func->begin(), E = Func->end(); I != E; ++I)
+    if (DT[I] == 0)
+      for (pred_iterator PI = pred_begin(I), E = pred_end(I); PI != E; ++PI)
+        markInstructionLive((*PI)->getTerminator());
+
+
+
   DEBUG(std::cerr << "Processing work list\n");
 
   // AliveBlocks - Set of basic blocks that we know have instructions that are





More information about the llvm-commits mailing list