[Mlir-commits] [mlir] [mlir][LLVMIR] Add operand bundle support for llvm.intr.assume (PR #112143)

Tobias Gysi llvmlistbot at llvm.org
Mon Oct 14 01:26:22 PDT 2024


================
@@ -426,7 +426,31 @@ def LLVM_USHLSat : LLVM_BinarySameArgsIntrOpI<"ushl.sat">;
 //
 
 def LLVM_AssumeOp
-  : LLVM_ZeroResultIntrOp<"assume", []>, Arguments<(ins I1:$cond)>;
+    : LLVM_ZeroResultIntrOp<"assume", /*overloadedOperands=*/[], /*traits=*/[],
+                            /*requiresAccessGroup=*/0,
+                            /*requiresAliasAnalysis=*/0,
+                            /*immArgPositions=*/[], /*immArgAttrNames=*/[],
+                            /*opBundleSizesAttrName=*/"op_bundle_sizes",
+                            /*opBundleTagsAttrName=*/"op_bundle_tags"> {
+  let arguments = (ins I1:$cond,
+                       VariadicOfVariadic<LLVM_Type,
+                                         "op_bundle_sizes">:$op_bundle_operands,
+                       DenseI32ArrayAttr:$op_bundle_sizes,
+                       OptionalAttr<ArrayAttr>:$op_bundle_tags);
----------------
gysit wrote:

For alias attributes, we define the extra arguments in the base class and then append them here to the other arguments of the intrinsic. An example that can make sense to look at is LLVM_MemsetOp which defines the arguments as follows:
```
  dag args = (ins Arg<LLVM_AnyPointer,"",[MemWrite]>:$dst,
                  I8:$val, AnySignlessInteger:$len, I1Attr:$isVolatile);
  // Append the alias attributes defined by LLVM_IntrOpBase.
  let arguments = !con(args, aliasAttrs);
```
The `aliasAttrs` are defined by the base class. I think implementing something similar for the operand bundles could be nice especially if we later on add more intrinsics that have them?

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


More information about the Mlir-commits mailing list