[llvm] [ConstantFolding] Fold scalable get_active_lane_masks (PR #156659)

Matthew Devereau via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 07:25:03 PDT 2025


================
@@ -4238,6 +4238,13 @@ static Constant *ConstantFoldScalableVectorCall(
 
     return ConstantInt::getFalse(SVTy);
   }
+  case Intrinsic::get_active_lane_mask: {
+    auto Op0 = cast<ConstantInt>(Operands[0])->getValue();
+    auto Op1 = cast<ConstantInt>(Operands[1])->getValue();
+    if ((Op0.uge(Op1) && (!Op1.isZero())))
----------------
MDevereau wrote:

@paulwalker-arm Thanks. What I gather from that is it's now OK to assume active_lane_mask(0, 0) is an all false predicate just as active_lane_mask(3, 3) is and that no further changes are needed in this PR.

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


More information about the llvm-commits mailing list