[llvm-commits] [llvm] r165187 - in /llvm/trunk: lib/Transforms/Scalar/IndVarSimplify.cpp test/Transforms/IndVarSimplify/crash.ll
Andrew Trick
atrick at apple.com
Thu Oct 4 18:01:19 PDT 2012
On Oct 4, 2012, at 12:19 AM, Eric Christopher <echristo at gmail.com> wrote:
>>
>> // Do LFTR if the exit condition's IV is *not* a simple counter.
>> - Value *IncV = Phi->getIncomingValueForBlock(L->getLoopLatch());
>> + int Idx = Phi->getBasicBlockIndex(L->getLoopLatch());
>> + if (Idx < 0)
>> + return true;
>> + Value *IncV = Phi->getIncomingValue(Idx);
>> return Phi != getLoopPhiForCounter(IncV, L, DT);
>> }
>>
>>
>
> Please update the comment to correspond to the change in behavior.
Kuba,
I was ok with your patch (thanks!), but if you plan to cleanup/comment, then consider whether it would be more self-documenting to do this instead:
+PHINode *Phi = dyn_cast<PHINode>(LHS);
+ if (!Phi || Phi->getParent() != L->getHeader())
+ Phi = getLoopPhiForCounter(LHS, L, DT);
-Andy
More information about the llvm-commits
mailing list