[IndVars] Pass the right loop to isLoopInvariantPredicate
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 18 Mar 2016 20:37:07 +0000 (20:37 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 18 Mar 2016 20:37:07 +0000 (20:37 +0000)
commit60fb899f28c7cde25341ea87f32f3be9f440983a
tree4765707c1ca62cb8b4ab4a009d72f33d6fdba8a0
parent6a41dae468b828f949d1cf3752fc211dbd773661
[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
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
llvm/test/Transforms/IndVarSimplify/pr26973.ll [new file with mode: 0644]