[PATCH] D30840: [SCEV] Fix trip multiple calculation

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 22:49:51 PDT 2017


sanjoy requested changes to this revision.
sanjoy added a comment.
This revision now requires changes to proceed.

Pretty close to lgtm, only very minor comments.



================
Comment at: lib/Analysis/ScalarEvolution.cpp:5429
 
-unsigned ScalarEvolution::getSmallConstantMaxTripCount(Loop *L) {
+unsigned ScalarEvolution::getSmallConstantMaxTripCount(const Loop *L) {
   const auto *MaxExitCount =
----------------
Can you please extract out this `const` ifying change and just land it?


================
Comment at: lib/Analysis/ScalarEvolution.cpp:5473
+    // divisible by the greatest power of 2 divisor returned.
+    return (unsigned)(1 << std::min((uint32_t)31, GetMinTrailingZeros(TCExpr)));
 
----------------
Should you be left shifting `1u`?  Please check, but I think left shifting a positive number into a negative number (in signed type) is undefined behavior.


Repository:
  rL LLVM

https://reviews.llvm.org/D30840





More information about the llvm-commits mailing list