[llvm] [VPlan] Recognize disjoint 'or' in getSCEVExprForVPValue (PR #218405)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 01:32: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);
----------------
Mel-Chen wrote:
We don't need this flag, and we shouldn't add nsw/nuw without proving UB. Thanks for pointing out this.
fa3c8d0b6f433b0693456798e3c9ef5a94716d06
https://github.com/llvm/llvm-project/pull/218405
More information about the llvm-commits
mailing list