[llvm] [VPlan] Model first memory runtime checks as VPlan recipes. (PR #221483)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 02:53:05 PDT 2026


================
@@ -936,6 +936,20 @@ VPValue *VPSCEVExpander::expand(const SCEV *S) {
   }
   case scMulExpr: {
     auto *MulE = cast<SCEVMulExpr>(S);
+
+    // mul(PowerOf2C, udiv(X, PowerOf2C)) == (X >> C) << C -> X & (-1 << C),
+    // matching SCEVExpander::visitMulExpr.
+    const SCEVConstant *C1, *C2;
+    const SCEV *Val;
+    if (match(S, m_scev_Mul(m_SCEVConstant(C1),
+                            m_scev_UDiv(m_SCEV(Val), m_SCEVConstant(C2)))) &&
----------------
artagnon wrote:

```suggestion
    const SCEVConstant *C;
    const SCEV *Val;
    if (match(S, m_scev_Mul(m_SCEVConstant(C),
                            m_scev_UDiv(m_SCEV(Val), m_scev_Deferred(C)))) &&
```

match_deferred is already in PatternMatchHelpers, so introducing m_scev_Deferred should be trivial?

https://github.com/llvm/llvm-project/pull/221483


More information about the llvm-commits mailing list