[llvm] [VPlan] Recognize disjoint 'or' in getSCEVExprForVPValue (PR #218405)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 08:00:40 PDT 2026
================
@@ -164,6 +164,11 @@ const SCEV *vputils::getSCEVExprForVPValue(const VPValue *V,
return CreateSCEV({LHSVal, RHSVal}, [&](ArrayRef<SCEVUse> Ops) {
return SE.getAddExpr(Ops[0], Ops[1], SCEV::FlagAnyWrap, 0);
});
+ if (match(V, m_BinaryOr(m_VPValue(LHSVal), m_VPValue(RHSVal))))
+ if (cast<VPRecipeWithIRFlags>(V->getDefiningRecipe())->isDisjoint())
+ return CreateSCEV({LHSVal, RHSVal}, [&](ArrayRef<SCEVUse> Ops) {
+ return SE.getAddExpr(Ops[0], Ops[1], SCEV::FlagNSW | SCEV::FlagNUW, 0);
----------------
fhahn wrote:
Is adding the wrap flags needed? I do not think it is valid to add them, unless we prove the the `or disjoint` begin poison is unconditionally UB
https://github.com/llvm/llvm-project/pull/218405
More information about the llvm-commits
mailing list