[Mlir-commits] [mlir] [MLIR][LLVM] Enable strict property assembly format (PR #217277)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Aug 19 03:46:29 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-llvm
Author: Mehdi Amini (joker-eph)
<details>
<summary>Changes</summary>
Enable strict property assembly format mode for the LLVM dialect. Bind LLVM operation properties directly in declarative assembly formats so strict parsing does not rely on fallback handling.
Update LLVM dialect, target, and conversion tests to use the direct property spelling.
Assisted-by: Codex
---
Patch is 271.73 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/217277.diff
77 Files Affected:
- (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.td (+1)
- (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td (+39-15)
- (modified) mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td (+47-6)
- (modified) mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir (+12-12)
- (modified) mlir/test/Conversion/ComplexToLLVM/complex-range-option.mlir (+52-52)
- (modified) mlir/test/Conversion/ComplexToLLVM/convert-to-llvm.mlir (+23-23)
- (modified) mlir/test/Conversion/FuncToLLVM/func-to-llvm.mlir (+2-2)
- (modified) mlir/test/Conversion/GPUCommon/lower-memory-space-attrs.mlir (+1-1)
- (modified) mlir/test/Conversion/GPUCommon/transfer_write.mlir (+1-1)
- (modified) mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir (+1-1)
- (modified) mlir/test/Conversion/GPUToROCDL/gpu-to-rocdl-barrier.mlir (+4-4)
- (modified) mlir/test/Conversion/MathToLLVM/math-to-llvm.mlir (+21-21)
- (modified) mlir/test/Conversion/MemRefToLLVM/memref-to-llvm.mlir (+4-4)
- (modified) mlir/test/Conversion/OpenMPToLLVM/convert-to-llvmir.mlir (+6-6)
- (modified) mlir/test/Conversion/SPIRVToLLVM/control-flow-ops-to-llvm.mlir (+5-5)
- (modified) mlir/test/Conversion/SPIRVToLLVM/memory-ops-to-llvm.mlir (+4-4)
- (modified) mlir/test/Conversion/VectorToLLVM/use-vector-alignment.mlir (+24-24)
- (modified) mlir/test/Conversion/VectorToLLVM/vector-to-llvm-interface.mlir (+33-40)
- (modified) mlir/test/Conversion/VectorToLLVM/vector-to-llvm.mlir (+4-4)
- (modified) mlir/test/Conversion/VectorToLLVM/vector-xfer-to-llvm.mlir (+10-10)
- (modified) mlir/test/Dialect/LLVMIR/bytecode.mlir (+1-1)
- (modified) mlir/test/Dialect/LLVMIR/canonicalize.mlir (+2-2)
- (modified) mlir/test/Dialect/LLVMIR/dereferenceable-invalid.mlir (+1-1)
- (modified) mlir/test/Dialect/LLVMIR/ifunc.mlir (+4-4)
- (modified) mlir/test/Dialect/LLVMIR/inlining-alias-scopes.mlir (+17-17)
- (modified) mlir/test/Dialect/LLVMIR/inlining-loop-annotation.mlir (+2-2)
- (modified) mlir/test/Dialect/LLVMIR/inlining.mlir (+8-8)
- (modified) mlir/test/Dialect/LLVMIR/invalid.mlir (+19-22)
- (modified) mlir/test/Dialect/LLVMIR/loop-metadata.mlir (+2-2)
- (modified) mlir/test/Dialect/LLVMIR/mem2reg-dbginfo.mlir (+8-8)
- (modified) mlir/test/Dialect/LLVMIR/mem2reg-intrinsics.mlir (+15-15)
- (modified) mlir/test/Dialect/LLVMIR/mem2reg.mlir (+108-108)
- (modified) mlir/test/Dialect/LLVMIR/opaque-ptr.mlir (+4-4)
- (modified) mlir/test/Dialect/LLVMIR/roundtrip.mlir (+68-68)
- (modified) mlir/test/Dialect/LLVMIR/tbaa-roundtrip.mlir (+12-12)
- (modified) mlir/test/Dialect/OpenMP/stack-to-shared.mlir (+2-2)
- (modified) mlir/test/Dialect/Vector/vector-contract-to-matrix-intrinsics-transforms.mlir (+1-1)
- (modified) mlir/test/Dialect/Vector/vector-transpose-to-matrix-intrinsics-transform.mlir (+1-1)
- (modified) mlir/test/Integration/Dialect/Vector/CPU/flat-transpose-col.mlir (+4-4)
- (modified) mlir/test/Integration/Dialect/Vector/CPU/flat-transpose-row.mlir (+4-4)
- (modified) mlir/test/Integration/Dialect/Vector/CPU/matrix-multiply-col.mlir (+1-2)
- (modified) mlir/test/Integration/Dialect/Vector/CPU/matrix-multiply-row.mlir (+1-2)
- (modified) mlir/test/Target/LLVMIR/Import/blockaddress.ll (+2-2)
- (modified) mlir/test/Target/LLVMIR/Import/control-flow.ll (+8-8)
- (modified) mlir/test/Target/LLVMIR/Import/exception.ll (+11-11)
- (modified) mlir/test/Target/LLVMIR/Import/fastmath.ll (+14-14)
- (modified) mlir/test/Target/LLVMIR/Import/ifunc.ll (+2-2)
- (modified) mlir/test/Target/LLVMIR/Import/instructions.ll (+13-13)
- (modified) mlir/test/Target/LLVMIR/Import/intrinsic.ll (+16-16)
- (modified) mlir/test/Target/LLVMIR/Import/metadata-loop.ll (+14-14)
- (modified) mlir/test/Target/LLVMIR/Import/metadata-profiling.ll (+2-2)
- (modified) mlir/test/Target/LLVMIR/Import/metadata-tbaa.ll (+4-13)
- (modified) mlir/test/Target/LLVMIR/Import/target-ext-type.ll (+1-1)
- (modified) mlir/test/Target/LLVMIR/allocatable_gpu_reduction.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/allocatable_gpu_reduction_teams.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/anonymous-tbaa.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/attribute-alias-scopes.mlir (+8-8)
- (modified) mlir/test/Target/LLVMIR/attribute-dereferenceable.mlir (+6-6)
- (modified) mlir/test/Target/LLVMIR/attribute-tbaa.mlir (+6-6)
- (modified) mlir/test/Target/LLVMIR/ifunc.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/llvmir-intrinsics.mlir (+12-12)
- (modified) mlir/test/Target/LLVMIR/llvmir-invalid.mlir (+10-10)
- (modified) mlir/test/Target/LLVMIR/llvmir.mlir (+20-20)
- (modified) mlir/test/Target/LLVMIR/loop-metadata.mlir (+27-27)
- (modified) mlir/test/Target/LLVMIR/omptarget-debug-record-pos.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/omptarget-multi-reduction.mlir (+6-6)
- (modified) mlir/test/Target/LLVMIR/omptarget-nowait.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/opaque-ptr.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/openmp-llvm.mlir (+4-4)
- (modified) mlir/test/Target/LLVMIR/openmp-nontemporal.mlir (+5-5)
- (modified) mlir/test/Target/LLVMIR/openmp-reduction-sections.mlir (+3-3)
- (modified) mlir/test/Target/LLVMIR/openmp-simd-private.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/openmp-simd-reduction-simple.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/openmp-target-private.mlir (+2-2)
- (modified) mlir/test/Target/LLVMIR/openmp-wsloop-private.mlir (+1-1)
- (modified) mlir/test/Target/LLVMIR/target-ext-type.mlir (+1-1)
- (modified) mlir/test/Transforms/test-block-legalization.mlir (+2-2)
``````````diff
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.td
index 01a3c8e9a1bde..595231ebb0a70 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.td
@@ -20,6 +20,7 @@ def LLVM_Dialect : Dialect {
let hasRegionArgAttrVerify = 1;
let hasRegionResultAttrVerify = 1;
let hasOperationAttrVerify = 1;
+ let useStrictPropertiesInAssemblyFormat = 1;
let discardableAttrs = (ins
/// Attribute encoding size and type of GPU workgroup attributions.
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
index 69f44e64b2de9..b7b023b407a36 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
@@ -33,6 +33,8 @@ class LLVM_UnaryIntrOpF<string func, list<Trait> traits = []> :
dag fmfArg = (
ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let arguments = !con(commonArgs, fmfArg);
+ let assemblyFormat = "`(` operands `)` (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` functional-type(operands, results)";
}
class LLVM_BinarySameArgsIntrOpBase<string func, Type element,
@@ -57,6 +59,8 @@ class LLVM_BinarySameArgsIntrOpF<string func, list<Trait> traits = []> :
dag fmfArg = (
ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let arguments = !con(commonArgs, fmfArg);
+ let assemblyFormat = "`(` operands `)` (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` functional-type(operands, results)";
}
class LLVM_TernarySameArgsIntrOpBase<string func, Type element,
@@ -82,6 +86,8 @@ class LLVM_TernarySameArgsIntrOpF<string func, list<Trait> traits = []> :
dag fmfArg = (
ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let arguments = !con(commonArgs, fmfArg);
+ let assemblyFormat = "`(` operands `)` (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` functional-type(operands, results)";
}
class LLVM_CountZerosIntrOp<string func, list<Trait> traits = []> :
@@ -120,7 +126,8 @@ class LLVM_PowFI<string func> :
(ins LLVM_ScalarOrVectorOf<LLVM_AnyFloat>:$val,
AnySignlessInteger:$power,
DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
- let assemblyFormat = "`(` operands `)` attr-dict `:` "
+ let assemblyFormat = "`(` operands `)` (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` "
"functional-type(operands, results)";
}
@@ -134,7 +141,8 @@ def LLVM_FractionExpOp : LLVM_TwoResultIntrOp<"frexp", [0, 1], [],
let arguments =
(ins LLVM_ScalarOrVectorOf<LLVM_AnyFloat>:$val,
DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
- let assemblyFormat = "`(` operands `)` attr-dict `:` "
+ let assemblyFormat = "`(` operands `)` (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` "
"functional-type(operands, results)";
}
def LLVM_FAbsOp : LLVM_UnaryIntrOpF<"fabs">;
@@ -208,7 +216,8 @@ def LLVM_SincosOp : LLVM_TwoResultIntrOp<"sincos", [], [0],
let arguments =
(ins LLVM_ScalarOrVectorOf<LLVM_AnyFloat>:$val,
DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
- let assemblyFormat = "`(` operands `)` attr-dict `:` "
+ let assemblyFormat = "`(` operands `)` (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` "
"functional-type(operands, results)";
let hasVerifier = 1;
}
@@ -1194,7 +1203,8 @@ class LLVM_VecReductionF<string mnem>
ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let arguments = !con(commonArgs, fmfArg);
- let assemblyFormat = "`(` operands `)` attr-dict `:` "
+ let assemblyFormat = "`(` operands `)` (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` "
"functional-type(operands, results)";
}
@@ -1213,7 +1223,10 @@ class LLVM_VecReductionAccBase<string mnem, Type element>
/*requiresFastmath=*/1>,
Arguments<(ins element:$start_value,
LLVM_VectorOf<element>:$input,
- DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags)>;
+ DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags)> {
+ let assemblyFormat = "`(` operands `)` (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` functional-type(operands, results)";
+}
class LLVM_VecReductionAccF<string mnem>
: LLVM_VecReductionAccBase<mnem, AnyFloat>;
@@ -1252,8 +1265,10 @@ def LLVM_MatrixColumnMajorLoadOp : LLVM_OneResultIntrOp<"matrix.column.major.loa
I32Attr:$rows, I32Attr:$columns);
let results = (outs LLVM_AnyVector:$res);
let builders = [LLVM_OneResultOpBuilder];
- let assemblyFormat = "$data `,` `<` `stride` `=` $stride `>` attr-dict"
- "`:` type($res) `from` qualified(type($data)) `stride` type($stride)";
+ let assemblyFormat = "$data `,` `<` `stride` `=` $stride `>` "
+ "`is_volatile` `=` $isVolatile `rows` `=` $rows "
+ "`columns` `=` $columns attr-dict `:` type($res) `from` "
+ "qualified(type($data)) `stride` type($stride)";
string llvmBuilder = [{
llvm::MatrixBuilder mb(builder);
@@ -1287,7 +1302,9 @@ def LLVM_MatrixColumnMajorStoreOp : LLVM_ZeroResultIntrOp<"matrix.column.major.s
I32Attr:$columns);
let builders = [LLVM_VoidResultTypeOpBuilder, LLVM_ZeroResultOpBuilder];
let assemblyFormat = "$matrix `,` $data `,` `<` `stride` `=` $stride `>` "
- "attr-dict`:` type($matrix) `to` qualified(type($data)) `stride` type($stride)";
+ "`is_volatile` `=` $isVolatile `rows` `=` $rows "
+ "`columns` `=` $columns attr-dict `:` type($matrix) `to` "
+ "qualified(type($data)) `stride` type($stride)";
string llvmBuilder = [{
llvm::MatrixBuilder mb(builder);
@@ -1314,7 +1331,9 @@ def LLVM_MatrixMultiplyOp : LLVM_OneResultIntrOp<"matrix.multiply"> {
I32Attr:$lhs_columns, I32Attr:$rhs_columns);
let results = (outs LLVM_AnyVector:$res);
let builders = [LLVM_OneResultOpBuilder];
- let assemblyFormat = "$lhs `,` $rhs attr-dict "
+ let assemblyFormat = "$lhs `,` $rhs "
+ "`lhs_rows` `=` $lhs_rows `lhs_columns` `=` $lhs_columns "
+ "`rhs_columns` `=` $rhs_columns attr-dict "
"`:` `(` type($lhs) `,` type($rhs) `)` `->` type($res)";
string llvmBuilder = [{
@@ -1336,7 +1355,8 @@ def LLVM_MatrixTransposeOp : LLVM_OneResultIntrOp<"matrix.transpose"> {
let arguments = (ins LLVM_AnyVector:$matrix, I32Attr:$rows, I32Attr:$columns);
let results = (outs LLVM_AnyVector:$res);
let builders = [LLVM_OneResultOpBuilder];
- let assemblyFormat = "$matrix attr-dict `:` type($matrix) `into` type($res)";
+ let assemblyFormat = "$matrix `rows` `=` $rows `columns` `=` $columns "
+ "attr-dict `:` type($matrix) `into` type($res)";
string llvmBuilder = [{
llvm::MatrixBuilder mb(builder);
@@ -1369,7 +1389,8 @@ def LLVM_MaskedLoadOp : LLVM_OneResultIntrOp<"masked.load"> {
UnitAttr:$nontemporal);
let results = (outs LLVM_AnyVector:$res);
let assemblyFormat =
- "operands attr-dict `:` functional-type(operands, results)";
+ "operands `alignment` `=` $alignment (`nontemporal` $nontemporal^)? "
+ "attr-dict `:` functional-type(operands, results)";
string llvmBuilder = [{
auto *inst = $pass_thru ? builder.CreateMaskedLoad(
@@ -1396,7 +1417,8 @@ def LLVM_MaskedStoreOp : LLVM_ZeroResultIntrOp<"masked.store"> {
LLVM_VectorOf<I1>:$mask, I32Attr:$alignment,
UnitAttr:$nontemporal);
let builders = [LLVM_VoidResultTypeOpBuilder, LLVM_ZeroResultOpBuilder];
- let assemblyFormat = "$value `,` $data `,` $mask attr-dict `:` "
+ let assemblyFormat = "$value `,` $data `,` $mask `alignment` `=` "
+ "$alignment attr-dict `:` "
"type($value) `,` type($mask) `into` qualified(type($data))";
string llvmBuilder = [{
@@ -1422,7 +1444,8 @@ def LLVM_masked_gather : LLVM_OneResultIntrOp<"masked.gather"> {
let results = (outs LLVM_AnyVector:$res);
let builders = [LLVM_OneResultOpBuilder];
let assemblyFormat =
- "operands attr-dict `:` functional-type(operands, results)";
+ "operands `alignment` `=` $alignment attr-dict `:` "
+ "functional-type(operands, results)";
string llvmBuilder = [{
$res = $pass_thru.empty() ? builder.CreateMaskedGather(
@@ -1447,7 +1470,8 @@ def LLVM_masked_scatter : LLVM_ZeroResultIntrOp<"masked.scatter"> {
let arguments = (ins LLVM_AnyVector:$value, LLVM_VectorOf<LLVM_AnyPointer>:$ptrs,
LLVM_VectorOf<I1>:$mask, I32Attr:$alignment);
let builders = [LLVM_VoidResultTypeOpBuilder, LLVM_ZeroResultOpBuilder];
- let assemblyFormat = "$value `,` $ptrs `,` $mask attr-dict `:` "
+ let assemblyFormat = "$value `,` $ptrs `,` $mask `alignment` `=` "
+ "$alignment attr-dict `:` "
"type($value) `,` type($mask) `into` type($ptrs)";
string llvmBuilder = [{
@@ -1554,7 +1578,7 @@ def LLVM_UBSanTrap : LLVM_ZeroResultIntrOp<"ubsantrap",
/*immArgPositions=*/[0], /*immArgAttrNames=*/["failureKind"]> {
let arguments = (ins I8Attr:$failureKind);
- let assemblyFormat = "prop-dict attr-dict";
+ let assemblyFormat = "`failureKind` `=` $failureKind attr-dict";
}
/// Create a call to vscale intrinsic.
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 86b9e6f58ea31..707f31ba287bb 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -121,6 +121,8 @@ class LLVM_FloatArithmeticOp<string mnemonic, string instName,
dag fmfArg = (
ins DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let arguments = !con(commonArgs, fmfArg);
+ let assemblyFormat = "$lhs `,` $rhs (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` type($res)";
string mlirBuilder = [{
auto op = $_qualCppClassName::create($_builder, $_location, $lhs, $rhs);
moduleImport.setFastmathFlagsAttr(inst, op);
@@ -139,7 +141,8 @@ class LLVM_UnaryFloatArithmeticOp<Type type, string mnemonic,
DefaultValuedAttr<LLVM_FastmathFlagsAttr, "{}">:$fastmathFlags);
let results = (outs type:$res);
let builders = [LLVM_OneResultOpBuilder];
- let assemblyFormat = "$operand attr-dict `:` type($res)";
+ let assemblyFormat = "$operand (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` type($res)";
string llvmInstName = instName;
string mlirBuilder = [{
auto op = $_qualCppClassName::create($_builder, $_location, $operand);
@@ -422,6 +425,14 @@ def LLVM_LoadOp : LLVM_MemAccessOpBase<"load",
(`invariant` $invariant^)?
(`invariant_group` $invariantGroup^)?
(`dereferenceable` `` $dereferenceable^)?
+ oilist(
+ `nontemporal` $nontemporal |
+ `alignment` `=` $alignment |
+ `access_groups` `=` $access_groups |
+ `alias_scopes` `=` $alias_scopes |
+ `noalias_scopes` `=` $noalias_scopes |
+ `tbaa` `=` $tbaa
+ )
attr-dict `:` qualified(type($addr)) `->` type($res)
}];
string llvmBuilder = [{
@@ -507,6 +518,14 @@ def LLVM_StoreOp : LLVM_MemAccessOpBase<"store",
(`volatile` $volatile_^)? $value `,` $addr
(`atomic` (`syncscope` `(` $syncscope^ `)`)? $ordering^)?
(`invariant_group` $invariantGroup^)?
+ oilist(
+ `nontemporal` $nontemporal |
+ `alignment` `=` $alignment |
+ `access_groups` `=` $access_groups |
+ `alias_scopes` `=` $alias_scopes |
+ `noalias_scopes` `=` $noalias_scopes |
+ `tbaa` `=` $tbaa
+ )
attr-dict `:` type($value) `,` qualified(type($addr))
}];
string llvmBuilder = [{
@@ -1087,7 +1106,8 @@ def LLVM_SelectOp
DefaultValuedAttr<LLVM_FastmathFlagsAttr,
"{}">:$fastmathFlags);
let results = (outs LLVM_Type:$res);
- let assemblyFormat = "operands attr-dict `:` type($condition) `,` type($res)";
+ let assemblyFormat = "operands (`fastmath` `` $fastmathFlags^)? "
+ "attr-dict `:` type($condition) `,` type($res)";
string llvmInstName = "Select";
string mlirBuilder = [{
auto op = LLVM::SelectOp::create($_builder,
@@ -1117,7 +1137,8 @@ def LLVM_BrOp : LLVM_TerminatorOp<"br",
);
let successors = (successor AnySuccessor:$dest);
let assemblyFormat = [{
- $dest (`(` $destOperands^ `:` type($destOperands) `)`)? attr-dict
+ $dest (`(` $destOperands^ `:` type($destOperands) `)`)?
+ oilist(`loop_annotation` `=` $loop_annotation) attr-dict
}];
let builders = [
OpBuilder<(ins "Block *":$dest), [{
@@ -1151,6 +1172,7 @@ def LLVM_CondBrOp
$condition ( `weights` `(` $branch_weights^ `)` )? `,`
$trueDest (`(` $trueDestOperands^ `:` type($trueDestOperands) `)`)? `,`
$falseDest (`(` $falseDestOperands^ `:` type($falseDestOperands) `)`)?
+ oilist(`loop_annotation` `=` $loop_annotation)
attr-dict
}];
@@ -1255,6 +1277,7 @@ def LLVM_SwitchOp
$defaultDestination (`(` $defaultOperands^ `:` type($defaultOperands) `)`)?
custom<SwitchOpCases>(ref(type($value)), $case_values, $caseDestinations,
$caseOperands, type($caseOperands))
+ (`weights` `(` $branch_weights^ `)`)?
attr-dict
}];
let hasVerifier = 1;
@@ -1780,7 +1803,9 @@ def LLVM_IFuncOp : LLVM_Op<"mlir.ifunc",
let assemblyFormat = [{
custom<LLVMLinkage>($linkage) ($visibility_^)? ($unnamed_addr^)?
- $sym_name `:` $i_func_type `,` $resolver_type $resolver attr-dict
+ $sym_name `:` $i_func_type `,` $resolver_type $resolver
+ oilist(`dso_local` $dso_local | `addr_space` `=` $address_space)
+ attr-dict
}];
let hasVerifier = 1;
}
@@ -2375,7 +2400,15 @@ def LLVM_AtomicRMWOp : LLVM_MemAccessOpBase<"atomicrmw", [
let results = (outs LLVM_AtomicRMWType:$res);
let assemblyFormat = [{
(`volatile` $volatile_^)? $bin_op $ptr `,` $val
- (`syncscope` `(` $syncscope^ `)`)? $ordering attr-dict `:`
+ (`syncscope` `(` $syncscope^ `)`)? $ordering
+ oilist(
+ `alignment` `=` $alignment |
+ `access_groups` `=` $access_groups |
+ `alias_scopes` `=` $alias_scopes |
+ `noalias_scopes` `=` $noalias_scopes |
+ `tbaa` `=` $tbaa
+ )
+ attr-dict `:`
qualified(type($ptr)) `,` type($val)
}];
string llvmInstName = "AtomicRMW";
@@ -2430,7 +2463,15 @@ def LLVM_AtomicCmpXchgOp : LLVM_MemAccessOpBase<"cmpxchg", [
let assemblyFormat = [{
(`weak` $weak^)? (`volatile` $volatile_^)? $ptr `,` $cmp `,` $val
(`syncscope` `(` $syncscope^ `)`)? $success_ordering $failure_ordering
- attr-dict `:` qualified(type($ptr)) `,` type($val)
+ oilist(
+ `alignment` `=` $alignment |
+ `access_groups` `=` $access_groups |
+ `alias_scopes` `=` $alias_scopes |
+ `noalias_scopes` `=` $noalias_scopes |
+ `tbaa` `=` $tbaa
+ )
+ attr-dict `:`
+ qualified(type($ptr)) `,` type($val)
}];
string llvmInstName = "AtomicCmpXchg";
string llvmBuilder = [{
diff --git a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
index 34a80eff42fed..14a24c5621594 100644
--- a/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
+++ b/mlir/test/Conversion/ArithToLLVM/arith-to-llvm.mlir
@@ -845,11 +845,11 @@ func.func @minmaxf(%arg0 : f32, %arg1 : f32) -> f32 {
// CHECK-LABEL: @fastmath
func.func @fastmath(%arg0: f32, %arg1: f32, %arg2: i32) {
-// CHECK: llvm.fadd %arg0, %arg1 {fastmathFlags = #llvm.fastmath<fast>} : f32
-// CHECK: llvm.fmul %arg0, %arg1 {fastmathFlags = #llvm.fastmath<fast>} : f32
-// CHECK: llvm.fneg %arg0 {fastmathFlags = #llvm.fastmath<fast>} : f32
+// CHECK: llvm.fadd %arg0, %arg1 fastmath<fast> : f32
+// CHECK: llvm.fmul %arg0, %arg1 fastmath<fast> : f32
+// CHECK: llvm.fneg %arg0 fastmath<fast> : f32
// CHECK: llvm.fadd %arg0, %arg1 : f32
-// CHECK: llvm.fadd %arg0, %arg1 {fastmathFlags = #llvm.fastmath<nnan, ninf>} : f32
+// CHECK: llvm.fadd %arg0, %arg1 fastmath<nnan, ninf> : f32
%0 = arith.addf %arg0, %arg1 fastmath<fast> : f32
%1 = arith.mulf %arg0, %arg1 fastmath<fast> : f32
%2 = arith.negf %arg0 fastmath<fast> : f32
@@ -862,21 +862,21 @@ func.func @fastmath(%arg0: f32, %arg1: f32, %arg2: i32) {
// CHECK-LABEL: @ops_supporting_fastmath
func.func @ops_supporting_fastmath(%arg0: f32, %arg1: f32, %arg2: i32) {
-// CHECK: llvm.fadd %arg0, %arg1 {fastmathFlags = #llvm.fastmath<fast>} : f32
+// CHECK: llvm.fadd %arg0, %arg1 fastmath<fast> : f32
%0 = arith.addf %arg0, %arg1 fastmath<fast> : f32
-// CHECK: llvm.fdiv %arg0, %arg1 {fastmathFlags = #llvm.fastmath<fast>} : f32
+// CHECK: llvm.fdiv %arg0, %arg1 fastmath<fast> : f32
%1 = arith.divf %arg0, %arg1 fastmath<fast> : f32
-// CHECK: llvm.intr.maximum(%arg0, %arg1) {fastmathFlags = #llvm.fastmath<fast>} : (f32, f32) -> f32
+// CHECK: llvm.intr.maximum(%arg0, %arg1) fastmath<fast> : (f32, f32) -> f32
%2 = arith.maximumf %arg0, %arg1 fastmath<fast> : f32
-// CHECK: llvm.intr.minimum(%arg0, %arg1) {fastmathFlags = #llvm.fastmath<fast>} : (f32, f32) -> f32
+// CHECK: llvm.intr.minimum(%arg0, %arg1) fastmath<fast> : (f32, f32) -> f32
%3 = arith.minimumf %arg0, %arg1 fastmath<fast> : f32
-// CHECK: llvm.fmul %arg0, %arg1 {fastmathFlags = #llvm.fastmath<fast>} : f32
+// CHECK: llvm.fmul %arg0, %arg1 fastmath<fast> : f32
%4 = arith.mulf %arg0, %arg1 fastmath<fast> : f32
-// CHECK: llvm.fneg %arg0 {fastmathFlags = #llvm.fastmath<fast>} : f32
+// CHECK: llvm.fneg %arg0 fastmath<fast> : f32
%5 = arith.negf %arg0 fastmath<fast> : f32
-// CHECK: llvm.frem %arg0, %arg1 {fastmathFlags = #llvm.fastmath<fast>} : f32
+// CHECK: llvm.frem %arg0, %arg1 fastmath<fast> : f32
%6 = arith.remf %arg0, %arg1 fastmath<fast> : f32
-// CHECK: llvm.fsub %arg0, %arg1 {fastmathFlags = #llvm.fastmath<fast>} : f32
+// CHECK: llvm.fsub %arg0, %arg1 fastmath<fast> : f32
%7 = arith.subf %arg0, %arg1 fastmath<fast> : f32
return
}
diff --git a/mlir/test/Conversion/ComplexToLLVM/complex-range-option.mlir b/mlir/test/Conversion/ComplexToLLVM/complex-range-option.mlir
index 78e8db795788a..089da8073b27f 100644
--- a/mlir/test/Conversion/ComplexToLLVM/complex-range-option.mlir
+++ b/mlir/test/Conversion/ComplexToLLVM/complex-range-option.mlir
@@ -169,31 +169,31 @@ func.func @complex_div_with_fmf(%lhs: complex<f32>, %rhs: complex<f32>) -> compl
// DIV-SMITH: %[[RESULT_0:.*]] = llvm.mlir.poison : ![[C_TY]]
-// DIV-SMITH: %[[RHS_REAL_IMAG_RATIO:.*]] = llvm.fdiv %[[RHS_REAL]], %[[RHS_IMAG]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[RHS_REAL_TIMES_RHS_REAL_IMAG_RATIO:.*]] = llvm.fmul %[[RHS_REAL_IMAG_RATIO]], %[[RHS_REAL]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[RHS_REAL_IMAG_DENOM:.*]] = llvm.fadd %[[RHS_IMAG]], %[[RHS_REAL_TIMES_RHS_REAL_IMAG_RATIO]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[LHS_REAL_TIMES_RHS_REAL_IMAG_RATIO:.*]] = llvm.fmul %[[LHS_REAL]], %[[RHS_REAL_IMAG_RATIO]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[REAL_NUMERATOR_1:.*]] = llvm.fadd %[[LHS_REAL_TIMES_RHS_REAL_IMAG_RATIO]], %[[LHS_IMAG]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[RESULT_REAL_1:.*]] = llvm.fdiv %[[REAL_NUMERATOR_1]], %[[RHS_REAL_IMAG_DENOM]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[LHS_IMAG_TIMES_RHS_REAL_IMAG_RATIO:.*]] = llvm.fmul %[[LHS_IMAG]], %[[RHS_REAL_IMAG_RATIO]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[IMAG_NUMERATOR_1:.*]] = llvm.fsub %[[LHS_IMAG_TIMES_RHS_REAL_IMAG_RATIO]], %[[LHS_REAL]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[RESULT_IMAG_1:.*]] = llvm.fdiv %[[IMAG_NUMERATOR_1]], %[[RHS_REAL_IMAG_DENOM]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-
-// DIV-SMITH: %[[RHS_IMAG_REAL_RATIO:.*]] = llvm.fdiv %[[RHS_IMAG]], %[[RHS_REAL]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[RHS_IMAG_TIMES_RHS_IMAG_REAL_RATIO:.*]] = llvm.fmul %[[RHS_IMAG_REAL_RATIO]], %[[RHS_IMAG]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[RHS_IMAG_REAL_DENOM:.*]] = llvm.fadd %[[RHS_REAL]], %[[RHS_IMAG_TIMES_RHS_IMAG_REAL_RATIO]] {fastmathFlags = #llvm.fastmath<nsz, arcp>} : f32
-// DIV-SMITH: %[[LHS_IMAG_TIMES_RHS_IMAG_R...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/217277
More information about the Mlir-commits
mailing list