[PATCH] D143766: [InstCombine][WIP] Fix InstCombinerImpl::foldICmpMulConstant for nsw and nuw mul with unsigned compare.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 13:59:07 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp:2071
     // MININT / -1 --> overflow.
     if (C.isMinSignedValue() && MulC->isAllOnes())
       return nullptr;
----------------
goldstein.w.n wrote:
> is this needed? Seems redundant given the nsw flag.
I think this check is protecting the APIntOps::RoundingSDiv call. You can't pass those values to it. I'm not sure the nsw flag matters.

I suspect a signed comparison with INT_MIN on the RHS side would have already been converted to eq/ne compare or true/false before we got here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D143766



More information about the llvm-commits mailing list