[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
Wed Jan 18 14:14:43 PST 2017


efriedma added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:5294
+          // When n < m, we cannot use sext(udiv(trunc(x), 2^(m-n))) since
+          // udiv doesn't preserve sign.
+          if (LShAmt < AShrAmt)
----------------
To clarify my earlier comment about this: we can in fact transform `ashr i32 %x, C` to `sext(trunc(udiv(x, (1 << C))))`.


Repository:
  rL LLVM

https://reviews.llvm.org/D28308





More information about the llvm-commits mailing list