[PATCH] D62990: [SCEV]When safe, compute MinStart as unsigned_min(Start - Stride) + Stride in computeMaxBECountForLT

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 14:20:50 PDT 2019


efriedma added subscribers: reames, nikic.
efriedma added a comment.

I think this is sound now.

Could you add some test coverage for the cases we don't and/or can't transform?  Maybe also a test where "end" is known-positive, but not constant.



================
Comment at: lib/Analysis/ScalarEvolution.cpp:10491
+  // exit:
+  //   ret void
+  //
----------------
Probably easier to understand the C form of the loop, at first glance: `for (unsigned i = start; i < 17; i += 8) { [...] }`


================
Comment at: lib/Analysis/ScalarEvolution.cpp:10504
+    MinStart = getUnsignedRangeMin(S) +
+               dyn_cast<SCEVConstant>(Stride)->getAPInt();
+
----------------
`cast<>`


================
Comment at: test/Analysis/ScalarEvolution/2008-11-18-Stride2.ll:8
 ; This is a tricky testcase for unsigned wrap detection which ScalarEvolution
 ; doesn't yet know how to do.
 
----------------
Fix this comment?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62990/new/

https://reviews.llvm.org/D62990





More information about the llvm-commits mailing list