[PATCH] D43759: [SCEV] Smarter logic in computeConstantDifference

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 02:46:57 PST 2018


mkazantsev added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:9455
 
   Optional<APInt> LDiff = computeConstantDifference(LHS, FoundLHS);
   Optional<APInt> RDiff = computeConstantDifference(RHS, FoundRHS);
----------------
sanjoy wrote:
> mkazantsev wrote:
> > Also incorrect, because types of LHS and FoundLHS doesn't have to match.
> Do you have a test case for this?  `ScalarEvolution::isImpliedCond` should be zero/sign extending LHS/FoundLHS to make both of them have the same type before calling `ScalarEvolution::isImpliedCondOperands`.  If there are other callsites that don't respect this invariant they should zero/sign extend as well.
Never mind, it seems that I saw this failing due to a bug in another patch I'm working on. False alarm, most likely.


https://reviews.llvm.org/D43759





More information about the llvm-commits mailing list