[llvm] [InstCombine] Use context in select-to-umin nonzero check (PR #225381)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 05:32:31 PDT 2026
================
@@ -732,7 +732,7 @@ static Value *foldSelectICmpMinMax(const ICmpInst *Cmp, Value *TVal,
// canonicalized to "add %x, -1" discarding the nuw flag.
if (Pred == CmpInst::ICMP_ULT &&
match(FVal, m_Add(m_Specific(CmpRHS), m_AllOnes())) &&
- isKnownNonZero(CmpRHS, SQ)) {
+ isKnownNonZero(CmpRHS, SQ.getWithInstruction(Cmp))) {
----------------
nikic wrote:
Better to do this in the caller, which can use the select instruction.
https://github.com/llvm/llvm-project/pull/225381
More information about the llvm-commits
mailing list