[PATCH] D28308: [SCEV] Model ashr(shl(x, n), m) as mul(x, 2^(n-m)) when n > m

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 12:14:33 PST 2017


efriedma added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:5366
+      }
+      if (Value *LV = dyn_cast<Value>(BO->LHS)) {
+        // Transform AShr i32 %x, C to sext(trunc(udiv(x, (1 << C)))).
----------------
`dyn_cast<Value>()` will always succeed; what are you trying to check here?


================
Comment at: test/Analysis/ScalarEvolution/scev-expander-reuse-unroll.ll:6
 ; CHECK: select
+; CHECK: select {{.*}} i32 %shr
 ; CHECK-NOT: select
----------------
This is defeating the point of the test.  I would guess SCEVExpander isn't realizing that sext(trunc(udiv))) is equivalent to an ashr?


Repository:
  rL LLVM

https://reviews.llvm.org/D28308





More information about the llvm-commits mailing list