[flang-commits] [flang] [mlir] [mlir][LLVM] Add operand bundle support (PR #108933)
Sirui Mu via flang-commits
flang-commits at lists.llvm.org
Thu Oct 3 21:41:37 PDT 2024
Lancern wrote:
@antiagainst Hi Zhang, thanks for your feedback!
`llvm.call` and `llvm.invoke` already have some convenient builders. For `llvm.call`:
https://github.com/llvm/llvm-project/blob/1e5e153485b817422c311f9326e80781a83ea7bc/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td#L685-L700
For `llvm.invoke`:
https://github.com/llvm/llvm-project/blob/1e5e153485b817422c311f9326e80781a83ea7bc/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td#L567-L576
All of the above custom builders set the relevant attributes to their default values and you don't have to specify the operand bundle related attributes by hand if you use these builders.
I noticed that your code uses this builder overload:
```cpp
static void build(mlir::OpBuilder &, mlir::OperationState &odsState, mlir::TypeRange resultTypes, mlir::ValueRange operands, llvm::ArrayRef<mlir::NamedAttribute> attributes = {});
```
Implementation of this builder overload is generated automatically by MLIR and it lets you build the operation with every detail by hand. If you're using this overload you have to specify the operand bundle related attributes manually. I'm afraid we couldn't do much about this since this builder is generated by MLIR.
However `llvm.call_intrinsics` indeed does not have a custom builder that avoids the burden of specifying operand bundle attributes. We definitely could improve this!
https://github.com/llvm/llvm-project/pull/108933
More information about the flang-commits
mailing list