[llvm] [InstSimplify] Simplify extractvalue (umul_with_overflow(x, 1)). (PR #157307)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 6 13:35:59 PDT 2025
================
@@ -5242,6 +5242,19 @@ static Value *simplifyExtractValueInst(Value *Agg, ArrayRef<unsigned> Idxs,
}
}
+ // Simplify umul_with_overflow where one operand is 1.
+ Value *V;
+ if (Idxs.size() == 1 &&
+ (match(Agg,
+ m_Intrinsic<Intrinsic::umul_with_overflow>(m_Value(V), m_One())) ||
+ match(Agg, m_Intrinsic<Intrinsic::umul_with_overflow>(m_One(),
+ m_Value(V))))) {
+ if (Idxs[0] == 0)
+ return V;
+ assert(Idxs[0] == 1 && "invalid index");
+ return getFalse(IntegerType::get(V->getContext(), 1));
----------------
nikic wrote:
Can you please add a vector test? This should use the type of the extract instead of hardcoding scalar i1.
https://github.com/llvm/llvm-project/pull/157307
More information about the llvm-commits
mailing list