aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-16 21:39:27 +0000
committerChris Lattner <sabre@nondot.org>2003-11-16 21:39:27 +0000
commitfaa45ce300f45ad81576b1a7cefeb0f76d701579 (patch)
tree5f90a1d70d2c9e51e7aad7ad1fed6e4a0d5a1b3e /lib
parentd39dbcc743eeb3f428cc6afa96effca63e645b99 (diff)
downloadexternal_llvm-faa45ce300f45ad81576b1a7cefeb0f76d701579.zip
external_llvm-faa45ce300f45ad81576b1a7cefeb0f76d701579.tar.gz
external_llvm-faa45ce300f45ad81576b1a7cefeb0f76d701579.tar.bz2
Fix PR116
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index e45b273..941cc2d 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -209,6 +209,18 @@ bool ADCE::doADCE() {
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