[Mlir-commits] [mlir] [MLIR] Make the pass_thru argument of llvm masked.load intrinsic Optional instead of Variadic (PR #156917)

Mehdi Amini llvmlistbot at llvm.org
Thu Sep 4 09:05:22 PDT 2025


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/156917

This is meant as NFC as multiple values there was never supported anyway. Extra values would be dropped when translating to LLVM IR.

>From bf6b1c0d4d1edf0ce88016ecfb51cc73c479aecc Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Thu, 4 Sep 2025 09:03:12 -0700
Subject: [PATCH] [MLIR] Make the pass_thru argument of llvm masked.load
 intrinsic Optional instead of Variadic

This is meant as NFC as multiple values there was never supported anyway.
Extra values would be dropped when translating to LLVM IR.
---
 mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
index fa2e10c9cdee5..dd00d67974d28 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
@@ -1000,17 +1000,17 @@ def LLVM_GetActiveLaneMaskOp
 /// Create a call to Masked Load intrinsic.
 def LLVM_MaskedLoadOp : LLVM_OneResultIntrOp<"masked.load"> {
   let arguments = (ins LLVM_AnyPointer:$data, LLVM_VectorOf<I1>:$mask,
-                   Variadic<LLVM_AnyVector>:$pass_thru, I32Attr:$alignment,
+                   Optional<LLVM_AnyVector>:$pass_thru, I32Attr:$alignment,
                    UnitAttr:$nontemporal);
   let results = (outs LLVM_AnyVector:$res);
   let assemblyFormat =
     "operands attr-dict `:` functional-type(operands, results)";
 
   string llvmBuilder = [{
-    auto *inst = $pass_thru.empty() ? builder.CreateMaskedLoad(
-        $_resultType, $data, llvm::Align($alignment), $mask) :
+    auto *inst = $pass_thru ? builder.CreateMaskedLoad(
+        $_resultType, $data, llvm::Align($alignment), $mask, $pass_thru) :
       builder.CreateMaskedLoad(
-        $_resultType, $data, llvm::Align($alignment), $mask, $pass_thru[0]);
+        $_resultType, $data, llvm::Align($alignment), $mask);
     $res = inst;
   }] #setNonTemporalMetadataCode;
   string mlirBuilder = [{



More information about the Mlir-commits mailing list