[PATCH] D156845: [ConstantRange] Calculate precise range for shl by -1
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 20:42:33 PDT 2023
Allen marked 2 inline comments as done.
Allen added inline comments.
================
Comment at: llvm/lib/IR/ConstantRange.cpp:1501
+ Max = -Max;
+ return ConstantRange::getNonEmpty(std::move(Max), std::move(Min) + 1);
+ }
----------------
goldstein.w.n wrote:
> Allen wrote:
> > goldstein.w.n wrote:
> > > Why are you inverting min/max here?
> > because this is a negative value. For example
> > -1 << x.min > -1 << x.max, so its range [-1 << x.max, -1 << x.min +1]
> I'm probably missing something (haven't really worked on ConstantRanges much), but since you are re-negating min/max isn't that already doing it?
Yes, it is already done, but need swap it max/min values for **negitive value**
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156845/new/
https://reviews.llvm.org/D156845
More information about the llvm-commits
mailing list