summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
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
commit841dd5355523445d7bc1ef0bf9ef46e43acd3f3e (patch)
treeb7381bfb3d14e22758c93d1a9888b7d3634dff8e /llvm/lib/Transforms/Scalar
parent1765b4cfbd543bcdfed065227e5172dc81e27bcd (diff)
downloadbcm5719-llvm-841dd5355523445d7bc1ef0bf9ef46e43acd3f3e.tar.gz
bcm5719-llvm-841dd5355523445d7bc1ef0bf9ef46e43acd3f3e.zip
Fix PR116
llvm-svn: 10032
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/ADCE.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index e45b2731908..941cc2dc09c 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud