[PATCH] D126546: [InstCombine] decomposeSimpleLinearExpr should bail out on negative operands.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 30 03:52:07 PDT 2022
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:40
OverflowingBinaryOperator *OBI = dyn_cast<OverflowingBinaryOperator>(Val);
if (OBI && !OBI->hasNoUnsignedWrap() && !OBI->hasNoSignedWrap()) {
Scale = 1;
----------------
w2yehia wrote:
> nikic wrote:
> > Isn't the actual bug here? The `&& !OBI->hasNoSignedWrap()` shouldn't be there. The number of elements is an unsigned value, so we should be checking for no unsigned wrap, not "either no unsigned or no signed wrap".
> i'm not that familiar with the implications of (not) having `nsw`, so you are likely correct.
> Does the presence of `nsw` indicate the operands of the multiplication are signed?
nsw indicates that there is no signed overflow, while we need no unsigned overflow here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126546/new/
https://reviews.llvm.org/D126546
More information about the llvm-commits
mailing list