aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-07-20 02:08:58 +0000
committerAndrew Trick <atrick@apple.com>2011-07-20 02:08:58 +0000
commitf22d95749a876975329f6de3a233031171af26a6 (patch)
tree5fd4f2f85dbe21f7d853482af0558aff424edee2 /lib/Transforms/Scalar
parente236dc655346bb0ff570c3f1513b4337aed836c4 (diff)
downloadexternal_llvm-f22d95749a876975329f6de3a233031171af26a6.zip
external_llvm-f22d95749a876975329f6de3a233031171af26a6.tar.gz
external_llvm-f22d95749a876975329f6de3a233031171af26a6.tar.bz2
indvars -disable-iv-rewrite fix: derived GEP IVs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135558 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index b75db7d..55094b9 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -1419,6 +1419,11 @@ void IndVarSimplify::SimplifyCongruentIVs(Loop *L) {
if (Inserted)
continue;
PHINode *OrigPhi = Pos->second;
+
+ // If one phi derives from the other via GEPs, types may differ.
+ if (OrigPhi->getType() != Phi->getType())
+ continue;
+
// Replacing the congruent phi is sufficient because acyclic redundancy
// elimination, CSE/GVN, should handle the rest. However, once SCEV proves
// that a phi is congruent, it's almost certain to be the head of an IV
@@ -1430,6 +1435,7 @@ void IndVarSimplify::SimplifyCongruentIVs(Loop *L) {
Instruction *IsomorphicInc =
cast<Instruction>(Phi->getIncomingValueForBlock(LatchBlock));
if (OrigInc != IsomorphicInc &&
+ OrigInc->getType() == IsomorphicInc->getType() &&
SE->getSCEV(OrigInc) == SE->getSCEV(IsomorphicInc) &&
HoistStep(OrigInc, IsomorphicInc, DT)) {
DEBUG(dbgs() << "INDVARS: Eliminated congruent iv.inc: "