diff options
author | Andrew Trick <atrick@apple.com> | 2011-07-20 02:08:58 +0000 |
---|---|---|
committer | Andrew Trick <atrick@apple.com> | 2011-07-20 02:08:58 +0000 |
commit | f22d95749a876975329f6de3a233031171af26a6 (patch) | |
tree | 5fd4f2f85dbe21f7d853482af0558aff424edee2 /lib/Transforms/Scalar/IndVarSimplify.cpp | |
parent | e236dc655346bb0ff570c3f1513b4337aed836c4 (diff) |
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/IndVarSimplify.cpp')
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index b75db7d2ba..55094b9d80 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: " |