[PATCH] D126546: decomposeSimpleLinearExpr should bail out on negative operands.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 09:23:08 PDT 2022


nikic added reviewers: nikic, spatel.
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;
----------------
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".


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126546/new/

https://reviews.llvm.org/D126546



More information about the llvm-commits mailing list