aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-06-22 00:15:15 +0000
committerDan Gohman <gohman@apple.com>2009-06-22 00:15:15 +0000
commitea9995655ad0bf6ae1dd636d17ab0706780f0aaf (patch)
treef978dc5ec687c0dcb64fbc45f2542968f15fa0b9 /lib/Transforms
parent069d6f59771d6f0dff76d6ddec8940045459bc8c (diff)
downloadexternal_llvm-ea9995655ad0bf6ae1dd636d17ab0706780f0aaf.zip
external_llvm-ea9995655ad0bf6ae1dd636d17ab0706780f0aaf.tar.gz
external_llvm-ea9995655ad0bf6ae1dd636d17ab0706780f0aaf.tar.bz2
Fix this code to correctly handle loops with multiple exits. Until
now, this hasn't mattered, because ScalarEvolution hasn't been able to compute trip counts for loops with multiple exits. But it will soon. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 429de93..326fb38 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -299,11 +299,11 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L,
// If this instruction is dead now, delete it.
RecursivelyDeleteTriviallyDeadInstructions(Inst);
- // See if this is a single-entry LCSSA PHI node. If so, we can (and
- // have to) remove
- // the PHI entirely. This is safe, because the NewVal won't be variant
+ // If we're inserting code into the exit block rather than the
+ // preheader, we can (and have to) remove the PHI entirely.
+ // This is safe, because the NewVal won't be variant
// in the loop, so we don't need an LCSSA phi node anymore.
- if (NumPreds == 1) {
+ if (ExitBlocks.size() == 1) {
PN->replaceAllUsesWith(ExitVal);
RecursivelyDeleteTriviallyDeadInstructions(PN);
break;