[PATCH] D28393: [SCEV] Make howFarToZero produce a smaller max backedge-taken count

silviu.baranga@arm.com via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 06:59:50 PST 2017


sbaranga added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:7217
+    const SCEV *DistancePlusOne = getAddExpr(Distance, getOne(Distance->getType()));
+    if (isLoopEntryGuardedByCond(L, ICmpInst::ICMP_NE, DistancePlusOne, Zero)) {
+      ConstantRange CR = getUnsignedRange(DistancePlusOne);
----------------
This looks correct to me, but I think it could use a comment.

Do we only need to match against Distance + 1 because this is what we typically get from rotating the loop? Otherwise I think this could be generalized to Distance + constant, but we would need to do some work to find the value of the constant.


Repository:
  rL LLVM

https://reviews.llvm.org/D28393





More information about the llvm-commits mailing list