[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 Jan 31 11:43:23 PST 2017


efriedma added a comment.

Sanjoy, would you mind looking over this?  I'd like a second set of eyes on this.



================
Comment at: lib/Analysis/ScalarEvolution.cpp:5323
+          // When n > m, use sext(mul(trunc(x), 2^(n-m)))) as the SCEV
+          // expression.We already checked that LShAmt < BitWidth, so
+          // the multiplier, 1 << (LShAmt - AShrAmt), fits into TruncTy as
----------------
Whitespace.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:5327
+          APInt Mul = APInt::getOneBitSet(TruncToWidth, LShAmt - AShrAmt);
+          const SCEV *MulSCEV = getSCEV(ConstantInt::get(TruncTy, Mul));
+          return getSignExtendExpr(
----------------
"getSCEV(ConstantInt::get(TruncTy, Mul))" can be shortened to "getConstant(Mul)".


Repository:
  rL LLVM

https://reviews.llvm.org/D28308





More information about the llvm-commits mailing list