[PATCH] D126546: [InstCombine] decomposeSimpleLinearExpr should bail out on negative operands.
wael yehia via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 27 10:18:31 PDT 2022
w2yehia 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;
----------------
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?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126546/new/
https://reviews.llvm.org/D126546
More information about the llvm-commits
mailing list