[llvm] [InstCombine] Canonicalize active lane mask params (PR #158065)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 06:40:47 PDT 2025


================
@@ -3925,6 +3925,20 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
     }
     break;
   }
+  case Intrinsic::get_active_lane_mask: {
+    const APInt *Op0, *Op1;
+    if (match(II->getOperand(0), m_Zero()) ||
+        !match(II->getOperand(0), m_APInt(Op0)) ||
+        !match(II->getOperand(1), m_APInt(Op1)))
+      break;
+
+    Type *OpTy = II->getOperand(0)->getType();
----------------
paulwalker-arm wrote:

Does `m_StrictlyPositive` work here?  I'm thinking:
```
if (match(II->getOperand(0), m_StrictlyPositive(Op0)) &&
    match(II->getOperand(1), m_APInt(Op1)))
  return replaceInstUsesWith(....
```

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


More information about the llvm-commits mailing list