[PATCH] D152278: [SCEV] Compute SCEV for ashr(add(shl(x, n), c), m) instr triplet
Vedant Paranjape via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 8 22:48:17 PDT 2023
vedant-amd marked 3 inline comments as done.
vedant-amd added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:7893
+ // type, so create a new Constant with type same as TruncTy
+ int64_t AddOperand = AddOperandCI->getSExtValue();
+ const SCEV *AddConstant = getConstant(TruncTy, AddOperand >> AShrAmt);
----------------
efriedma wrote:
> vedant-amd wrote:
> > efriedma wrote:
> > > Is there some reason to expect that "c" fits into an int64_t?
> > Right, I need to add a check like this I guess ?
> >
> > ```
> > if (CI->getValue().uge(BitWidth))
> >
> > ```
> That doesn't look like the right check.
>
> If it were necessary, you could use isIntN or something like that. But you should just be able to just do the math in APInt: `AddOperandCI->getValue().ashr(AShrAmt)` or something like that.
I have made the following change, please take a look once.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152278/new/
https://reviews.llvm.org/D152278
More information about the llvm-commits
mailing list