diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-03-18 20:37:07 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-03-18 20:37:07 +0000 |
commit | 60fb899f28c7cde25341ea87f32f3be9f440983a (patch) | |
tree | 4765707c1ca62cb8b4ab4a009d72f33d6fdba8a0 /llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | |
parent | 6a41dae468b828f949d1cf3752fc211dbd773661 (diff) | |
download | llvm-60fb899f28c7cde25341ea87f32f3be9f440983a.zip llvm-60fb899f28c7cde25341ea87f32f3be9f440983a.tar.gz llvm-60fb899f28c7cde25341ea87f32f3be9f440983a.tar.bz2 |
[IndVars] Pass the right loop to isLoopInvariantPredicate
The loop on IVOperand's incoming values assumes IVOperand to be an
induction variable on the loop over which `S Pred X` is invariant;
otherwise loop invariant incoming values to IVOperand are not guaranteed
to dominate the comparision.
This fixes PR26973.
llvm-svn: 263827
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyIndVar.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyIndVar.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp index ddd8775..fe5d8e4 100644 --- a/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyIndVar.cpp @@ -183,9 +183,8 @@ void SimplifyIndvar::eliminateIVComparison(ICmpInst *ICmp, Value *IVOperand) { DeadInsts.emplace_back(ICmp); DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n'); } else if (isa<PHINode>(IVOperand) && - SE->isLoopInvariantPredicate(Pred, S, X, ICmpLoop, - InvariantPredicate, InvariantLHS, - InvariantRHS)) { + SE->isLoopInvariantPredicate(Pred, S, X, L, InvariantPredicate, + InvariantLHS, InvariantRHS)) { // Rewrite the comparison to a loop invariant comparison if it can be done // cheaply, where cheaply means "we don't need to emit any new |