[llvm] [VPlan] Simplify (sdiv/srem lhs, (select header, rhs, 1)) -> (sdiv/srem lhs, rhs) (PR #174547)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 15 10:43:44 PST 2026
================
@@ -1434,6 +1434,49 @@ static void simplifyRecipe(VPSingleDefRecipe *Def, VPTypeAnalysis &TypeInfo) {
return;
}
+ // Drop header mask if LHS/RHS range is safe.
+ // (sdiv lhs, (select header, rhs, 1)) -> (sdiv lhs, rhs)
+ // (srem lhs, (select header, rhs, 1)) -> (srem lhs, rhs)
+ VPValue *LHS, *WSel, *RHS, *Mask;
+ if (match(Def, m_CombineOr(m_VPWidenRecipe<Instruction::SDiv>(
+ m_VPValue(LHS), m_VPValue(WSel)),
+ m_VPWidenRecipe<Instruction::SRem>(
+ m_VPValue(LHS), m_VPValue(WSel)))) &&
----------------
fhahn wrote:
I think this was done by a recent PR and should now work
https://github.com/llvm/llvm-project/pull/174547
More information about the llvm-commits
mailing list