[Mlir-commits] [mlir] [MLIR][EmitC] Enable strict property assembly format (PR #217271)
Mehdi Amini
llvmlistbot at llvm.org
Wed Aug 26 03:57:06 PDT 2026
https://github.com/joker-eph updated https://github.com/llvm/llvm-project/pull/217271
>From 48181b1e84a295cc42c192576f32452055b7a2e7 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Wed, 6 May 2026 14:37:31 -0700
Subject: [PATCH] [MLIR][EmitC] Enable strict property assembly format
Enable strict property assembly format mode for the EmitC dialect. Spell call
metadata directly in the affected declarative assembly formats and drop
unneeded property dictionaries from formats that already cover their inherent
attributes.
Refresh EmitC tests and related C++ target checks so call properties use direct
syntax while ordinary attributes remain in attr-dict.
Assisted-by: Codex
---
mlir/include/mlir/Dialect/EmitC/IR/EmitC.td | 34 ++++++-----
.../mlir/Dialect/EmitC/IR/EmitCBase.td | 1 +
mlir/test/Dialect/EmitC/canonicalize.mlir | 2 +-
mlir/test/Dialect/EmitC/form-expressions.mlir | 24 ++++----
mlir/test/Dialect/EmitC/invalid_ops.mlir | 30 +++++-----
mlir/test/Dialect/EmitC/invalid_types.mlir | 24 ++++----
mlir/test/Dialect/EmitC/ops.mlir | 40 ++++++++-----
mlir/test/Dialect/EmitC/types.mlir | 28 ++++-----
mlir/test/Target/Cpp/attrs.mlir | 4 +-
mlir/test/Target/Cpp/call.mlir | 4 +-
mlir/test/Target/Cpp/common-cpp.mlir | 20 +++----
mlir/test/Target/Cpp/const.mlir | 32 +++++-----
mlir/test/Target/Cpp/expressions.mlir | 38 ++++++------
mlir/test/Target/Cpp/invalid.mlir | 2 +-
.../test/Target/Cpp/literal_call_operand.mlir | 2 +-
mlir/test/Target/Cpp/lvalue.mlir | 8 +--
mlir/test/Target/Cpp/member.mlir | 16 ++---
mlir/test/Target/Cpp/subscript.mlir | 2 +-
mlir/test/Target/Cpp/switch.mlir | 58 +++++++++----------
mlir/test/Target/Cpp/types.mlir | 30 +++++-----
mlir/test/Target/Cpp/variable.mlir | 18 +++---
mlir/test/Target/Cpp/verbatim.mlir | 2 +-
22 files changed, 217 insertions(+), 202 deletions(-)
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
index 49412d1dfb01c..8dc066f952ceb 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitC.td
@@ -332,7 +332,7 @@ def EmitC_CallOpaqueOp : EmitC_Op<"call_opaque", [CExpressionInterface]> {
%0 = emitc.call_opaque "foo" () : () -> i32
// Generic form of the same operation.
- %0 = "emitc.call_opaque"() {callee = "foo"} : () -> i32
+ %0 = "emitc.call_opaque"() <{callee = "foo"}> : () -> i32
```
}];
let arguments = (ins
@@ -435,7 +435,8 @@ def EmitC_CastOp : EmitC_Op<"cast",
);
let results = (outs EmitCType:$dest);
- let assemblyFormat = "$source attr-dict `:` type($source) `to` type($dest)";
+ let assemblyFormat =
+ "$source (`pure` $pure^)? attr-dict `:` type($source) `to` type($dest)";
let extraClassDeclaration = [{
bool hasSideEffects() {
@@ -502,10 +503,10 @@ def EmitC_ConstantOp
```mlir
// Integer constant
- %0 = "emitc.constant"(){value = 42 : i32} : () -> i32
+ %0 = "emitc.constant"() <{value = 42 : i32}> : () -> i32
// Constant emitted as `char = CHAR_MIN;`
- %1 = "emitc.constant"() {value = #emitc.opaque<"CHAR_MIN">}
+ %1 = "emitc.constant"() <{value = #emitc.opaque<"CHAR_MIN">}>
: () -> !emitc.opaque<"char">
```
}];
@@ -808,7 +809,10 @@ def EmitC_CallOp : EmitC_Op<"call",
}];
let assemblyFormat = [{
- $callee `(` $operands `)` attr-dict `:` functional-type($operands, results)
+ $callee `(` $operands `)`
+ oilist<`,`>(`arg_attrs` `=` $arg_attrs
+ | `res_attrs` `=` $res_attrs) attr-dict `:`
+ functional-type($operands, results)
}];
}
@@ -976,13 +980,13 @@ def EmitC_IncludeOp
emitc.include <"myheader.h">
// Generic form of the same operation.
- "emitc.include" (){include = "myheader.h", is_standard_include} : () -> ()
+ "emitc.include" () <{include = "myheader.h", is_standard_include}> : () -> ()
// Custom form defining the inclusion of `"myheader"`.
emitc.include "myheader.h"
// Generic form of the same operation.
- "emitc.include" (){include = "myheader.h"} : () -> ()
+ "emitc.include" () <{include = "myheader.h"}> : () -> ()
```
}];
let arguments = (ins
@@ -1203,7 +1207,7 @@ def EmitC_MemberOp : EmitC_Op<"member", [CExpressionInterface]> {
: (!emitc.opaque<"mystruct">) -> i32
%0 = "emitc.member" (%arg0) {member = "a"}
: (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
- %1 = "emitc.member" (%arg0) {member = "b"}
+ %1 = "emitc.member" (%arg0) <{member = "b"}>
: (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
```
}];
@@ -1235,10 +1239,10 @@ def EmitC_MemberOfPtrOp : EmitC_Op<"member_of_ptr", [CExpressionInterface]> {
Example:
```mlir
- %0 = "emitc.member_of_ptr" (%arg0) {member = "a"}
+ %0 = "emitc.member_of_ptr" (%arg0) <{member = "a"}>
: (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>)
-> !emitc.lvalue<i32>
- %1 = "emitc.member_of_ptr" (%arg0) {member = "b"}
+ %1 = "emitc.member_of_ptr" (%arg0) <{member = "b"}>
: (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>)
-> !emitc.array<2xi32>
```
@@ -1272,8 +1276,8 @@ def EmitC_ConditionalOp : EmitC_Op<"conditional",
```mlir
%0 = emitc.cmp gt, %arg0, %arg1 : (i32, i32) -> i1
- %c0 = "emitc.constant"() {value = 10 : i32} : () -> i32
- %c1 = "emitc.constant"() {value = 11 : i32} : () -> i32
+ %c0 = "emitc.constant"() <{value = 10 : i32}> : () -> i32
+ %c1 = "emitc.constant"() <{value = 11 : i32}> : () -> i32
%1 = emitc.conditional %0, %c0, %c1 : i32
```
@@ -1399,7 +1403,7 @@ def EmitC_VariableOp : EmitC_Op<"variable", []> {
```mlir
// Integer variable
- %0 = "emitc.variable"(){value = 42 : i32} : () -> !emitc.lvalue<i32>
+ %0 = "emitc.variable"() <{value = 42 : i32}> : () -> !emitc.lvalue<i32>
// Variable emitted as `int32_t* = NULL;`
%1 = "emitc.variable"() {value = #emitc.opaque<"NULL">}
@@ -1588,7 +1592,7 @@ def EmitC_AssignOp : EmitC_Op<"assign", []> {
```mlir
// Integer variable
- %0 = "emitc.variable"(){value = 42 : i32} : () -> !emitc.lvalue<i32>
+ %0 = "emitc.variable"() <{value = 42 : i32}> : () -> !emitc.lvalue<i32>
%1 = emitc.call_opaque "foo"() : () -> (i32)
// Assign emitted as `... = ...;`
@@ -1857,7 +1861,7 @@ def EmitC_SwitchOp : EmitC_Op<"switch", [RecursiveMemoryEffects,
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
}
```
diff --git a/mlir/include/mlir/Dialect/EmitC/IR/EmitCBase.td b/mlir/include/mlir/Dialect/EmitC/IR/EmitCBase.td
index 375dbcbce1d03..a7144df36045e 100644
--- a/mlir/include/mlir/Dialect/EmitC/IR/EmitCBase.td
+++ b/mlir/include/mlir/Dialect/EmitC/IR/EmitCBase.td
@@ -31,6 +31,7 @@ def EmitC_Dialect : Dialect {
let hasConstantMaterializer = 1;
let useDefaultTypePrinterParser = 1;
let useDefaultAttributePrinterParser = 1;
+ let useStrictPropertiesInAssemblyFormat = 1;
}
#endif // MLIR_DIALECT_EMITC_IR_EMITCBASE
diff --git a/mlir/test/Dialect/EmitC/canonicalize.mlir b/mlir/test/Dialect/EmitC/canonicalize.mlir
index 29d2fd157229d..eb035ee12de6b 100644
--- a/mlir/test/Dialect/EmitC/canonicalize.mlir
+++ b/mlir/test/Dialect/EmitC/canonicalize.mlir
@@ -8,6 +8,6 @@ func.func @no_fold_cast_to_f32(%arg0: i32) {
func.func @fold_cast_to_i64(%arg0: i32) {
// CHECK-NOT: emitc.cast
- %1 = emitc.cast %arg0 {pure} : i32 to i64
+ %1 = emitc.cast %arg0 pure : i32 to i64
return
}
diff --git a/mlir/test/Dialect/EmitC/form-expressions.mlir b/mlir/test/Dialect/EmitC/form-expressions.mlir
index b233766b65a1c..03494fbadde33 100644
--- a/mlir/test/Dialect/EmitC/form-expressions.mlir
+++ b/mlir/test/Dialect/EmitC/form-expressions.mlir
@@ -13,7 +13,7 @@
// CHECK: }
func.func @single_expression(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: i32) -> i1 {
- %c42 = "emitc.constant"(){value = 42 : i32} : () -> i32
+ %c42 = "emitc.constant"() <{value = 42 : i32}> : () -> i32
%a = emitc.mul %arg0, %c42 : (i32, i32) -> i32
%b = emitc.sub %a, %arg2 : (i32, i32) -> i32
%c = emitc.cmp lt, %b, %arg3 :(i32, i32) -> i1
@@ -131,7 +131,7 @@ func.func @single_result_requirement() -> (i32, i32) {
// CHECK: }
func.func @expression_with_load(%arg0: i32, %arg1: !emitc.ptr<i32>) -> i1 {
- %c0 = "emitc.constant"() {value = 0 : i64} : () -> i64
+ %c0 = "emitc.constant"() <{value = 0 : i64}> : () -> i64
%0 = "emitc.variable"() <{value = #emitc.opaque<"42">}> : () -> !emitc.lvalue<i32>
%a = emitc.load %0 : !emitc.lvalue<i32>
%ptr = emitc.subscript %arg1[%c0] : (!emitc.ptr<i32>, i64) -> !emitc.lvalue<i32>
@@ -163,7 +163,7 @@ func.func @expression_with_load(%arg0: i32, %arg1: !emitc.ptr<i32>) -> i1 {
func.func @opaque_type_expression(%arg0: i32, %arg1: !emitc.opaque<"T0">, %arg2: i32) -> i1 {
- %c42 = "emitc.constant"(){value = #emitc.opaque<"V">} : () -> !emitc.opaque<"T1">
+ %c42 = "emitc.constant"() <{value = #emitc.opaque<"V">}> : () -> !emitc.opaque<"T1">
%a = emitc.mul %arg0, %c42 : (i32, !emitc.opaque<"T1">) -> i32
%b = emitc.sub %a, %arg1 : (i32, !emitc.opaque<"T0">) -> i32
%c = emitc.cmp lt, %b, %arg2 :(i32, i32) -> i1
@@ -181,7 +181,7 @@ func.func @opaque_type_expression(%arg0: i32, %arg1: !emitc.opaque<"T0">, %arg2
// CHECK: }
func.func @expression_with_constant(%arg0: i32) -> i32 {
- %c42 = "emitc.constant"(){value = 42 : i32} : () -> i32
+ %c42 = "emitc.constant"() <{value = 42 : i32}> : () -> i32
%a = emitc.mul %arg0, %c42 : (i32, i32) -> i32
return %a : i32
}
@@ -274,20 +274,20 @@ func.func @member(%arg0: !emitc.opaque<"mystruct">, %arg1: i32, %arg2: index) {
%var0 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<!emitc.opaque<"mystruct">>
emitc.assign %arg0 : !emitc.opaque<"mystruct"> to %var0 : !emitc.lvalue<!emitc.opaque<"mystruct">>
- %0 = "emitc.member" (%var0) {member = "a"} : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
+ %0 = "emitc.member" (%var0) <{member = "a"}> : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
emitc.assign %arg1 : i32 to %0 : !emitc.lvalue<i32>
- %1 = "emitc.member" (%var0) {member = "b"} : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
+ %1 = "emitc.member" (%var0) <{member = "b"}> : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
%2 = emitc.load %1 : !emitc.lvalue<i32>
%3 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.assign %2 : i32 to %3 : !emitc.lvalue<i32>
- %4 = "emitc.member" (%var0) {member = "c"} : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
+ %4 = "emitc.member" (%var0) <{member = "c"}> : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
%5 = emitc.subscript %4[%arg2] : (!emitc.array<2xi32>, index) -> !emitc.lvalue<i32>
%6 = emitc.load %5 : <i32>
emitc.assign %6 : i32 to %3 : !emitc.lvalue<i32>
- %7 = "emitc.member" (%var0) {member = "d"} : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
+ %7 = "emitc.member" (%var0) <{member = "d"}> : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
%8 = emitc.subscript %7[%arg2] : (!emitc.array<2xi32>, index) -> !emitc.lvalue<i32>
emitc.assign %arg1 : i32 to %8 : !emitc.lvalue<i32>
@@ -332,20 +332,20 @@ func.func @member_of_pointer(%arg0: !emitc.ptr<!emitc.opaque<"mystruct">>, %arg1
%var0 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>
emitc.assign %arg0 : !emitc.ptr<!emitc.opaque<"mystruct">> to %var0 : !emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>
- %0 = "emitc.member_of_ptr" (%var0) {member = "a"} : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.lvalue<i32>
+ %0 = "emitc.member_of_ptr" (%var0) <{member = "a"}> : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.lvalue<i32>
emitc.assign %arg1 : i32 to %0 : !emitc.lvalue<i32>
- %1 = "emitc.member_of_ptr" (%var0) {member = "b"} : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.lvalue<i32>
+ %1 = "emitc.member_of_ptr" (%var0) <{member = "b"}> : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.lvalue<i32>
%2 = emitc.load %1 : !emitc.lvalue<i32>
%3 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.assign %2 : i32 to %3 : !emitc.lvalue<i32>
- %4 = "emitc.member_of_ptr" (%var0) {member = "c"} : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.array<2xi32>
+ %4 = "emitc.member_of_ptr" (%var0) <{member = "c"}> : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.array<2xi32>
%5 = emitc.subscript %4[%arg2] : (!emitc.array<2xi32>, index) -> !emitc.lvalue<i32>
%6 = emitc.load %5 : <i32>
emitc.assign %6 : i32 to %3 : !emitc.lvalue<i32>
- %7 = "emitc.member_of_ptr" (%var0) {member = "d"} : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.array<2xi32>
+ %7 = "emitc.member_of_ptr" (%var0) <{member = "d"}> : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.array<2xi32>
%8 = emitc.subscript %7[%arg2] : (!emitc.array<2xi32>, index) -> !emitc.lvalue<i32>
emitc.assign %arg1 : i32 to %8 : !emitc.lvalue<i32>
diff --git a/mlir/test/Dialect/EmitC/invalid_ops.mlir b/mlir/test/Dialect/EmitC/invalid_ops.mlir
index 889138a22ede3..6855608a522d3 100644
--- a/mlir/test/Dialect/EmitC/invalid_ops.mlir
+++ b/mlir/test/Dialect/EmitC/invalid_ops.mlir
@@ -2,7 +2,7 @@
func.func @const_attribute_str() {
// expected-error @+1 {{'emitc.constant' op string attributes are not supported, use #emitc.opaque instead}}
- %c0 = "emitc.constant"(){value = "NULL"} : () -> !emitc.ptr<i32>
+ %c0 = "emitc.constant"() <{value = "NULL"}> : () -> !emitc.ptr<i32>
return
}
@@ -10,7 +10,7 @@ func.func @const_attribute_str() {
func.func @const_attribute_return_type_1() {
// expected-error @+1 {{'emitc.constant' op requires attribute to either be an #emitc.opaque attribute or it's type ('i64') to match the op's result type ('i32')}}
- %c0 = "emitc.constant"(){value = 42: i64} : () -> i32
+ %c0 = "emitc.constant"() <{value = 42: i64}> : () -> i32
return
}
@@ -18,7 +18,7 @@ func.func @const_attribute_return_type_1() {
func.func @const_attribute_return_type_2() {
// expected-error @+1 {{'emitc.constant' op attribute 'value' failed to satisfy constraint: An opaque attribute or TypedAttr instance}}
- %c0 = "emitc.constant"(){value = unit} : () -> i32
+ %c0 = "emitc.constant"() <{value = unit}> : () -> i32
return
}
@@ -26,7 +26,7 @@ func.func @const_attribute_return_type_2() {
func.func @empty_constant() {
// expected-error @+1 {{'emitc.constant' op value must not be empty}}
- %c0 = "emitc.constant"(){value = #emitc.opaque<"">} : () -> i32
+ %c0 = "emitc.constant"() <{value = #emitc.opaque<"">}> : () -> i32
return
}
@@ -130,7 +130,7 @@ func.func @member_call_dense_template_argument(%arg0 : !emitc.opaque<"MyClass">)
func.func @var_attribute_return_type_1() {
// expected-error @+1 {{'emitc.variable' op requires attribute to either be an #emitc.opaque attribute or it's type ('i64') to match the op's result type ('i32')}}
- %c0 = "emitc.variable"(){value = 42: i64} : () -> !emitc.lvalue<i32>
+ %c0 = "emitc.variable"() <{value = 42: i64}> : () -> !emitc.lvalue<i32>
return
}
@@ -138,7 +138,7 @@ func.func @var_attribute_return_type_1() {
func.func @var_attribute_return_type_2() {
// expected-error @+1 {{'emitc.variable' op attribute 'value' failed to satisfy constraint: An opaque attribute or TypedAttr instance}}
- %c0 = "emitc.variable"(){value = unit} : () -> !emitc.lvalue<i32>
+ %c0 = "emitc.variable"() <{value = unit}> : () -> !emitc.lvalue<i32>
return
}
@@ -313,7 +313,7 @@ func.func @test_assign_to_array(%arg1: !emitc.array<4xi32>) {
func.func @test_expression_no_yield() -> i32 {
// expected-error @+1 {{'emitc.expression' op must yield a value at termination}}
%r = emitc.expression : () -> i32 {
- %c7 = "emitc.constant"(){value = 7 : i32} : () -> i32
+ %c7 = "emitc.constant"() <{value = 7 : i32}> : () -> i32
}
return %r : i32
}
@@ -603,14 +603,14 @@ func.func @member_of_value_array(%arg0: !emitc.opaque<"mystruct">) {
func.func @member_of_ptr(%arg0: !emitc.lvalue<i32>) {
// expected-error @+1 {{'emitc.member_of_ptr' op operand #0 must be emitc.lvalue of EmitC opaque type or EmitC pointer type values, but got '!emitc.lvalue<i32>'}}
- %0 = "emitc.member_of_ptr" (%arg0) {member = "a"} : (!emitc.lvalue<i32>) -> !emitc.lvalue<i32>
+ %0 = "emitc.member_of_ptr" (%arg0) <{member = "a"}> : (!emitc.lvalue<i32>) -> !emitc.lvalue<i32>
return
}
// -----
func.func @emitc_switch() {
- %0 = "emitc.constant"(){value = 1 : i16} : () -> i16
+ %0 = "emitc.constant"() <{value = 1 : i16}> : () -> i16
// expected-error at +1 {{'emitc.switch' op expected region to end with emitc.yield, but got emitc.call_opaque}}
emitc.switch %0 : i16
@@ -622,7 +622,7 @@ func.func @emitc_switch() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -632,7 +632,7 @@ func.func @emitc_switch() {
// -----
func.func @emitc_switch() {
- %0 = "emitc.constant"(){value = 1 : i32} : () -> i32
+ %0 = "emitc.constant"() <{value = 1 : i32}> : () -> i32
emitc.switch %0 : i32
case 2 {
@@ -645,7 +645,7 @@ func.func @emitc_switch() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -655,7 +655,7 @@ func.func @emitc_switch() {
// -----
func.func @emitc_switch() {
- %0 = "emitc.constant"(){value = 1 : i8} : () -> i8
+ %0 = "emitc.constant"() <{value = 1 : i8}> : () -> i8
emitc.switch %0 : i8
case 2 {
@@ -673,7 +673,7 @@ func.func @emitc_switch() {
// -----
func.func @emitc_switch() {
- %0 = "emitc.constant"(){value = 1 : i64} : () -> i64
+ %0 = "emitc.constant"() <{value = 1 : i64}> : () -> i64
// expected-error at +1 {{'emitc.switch' op has duplicate case value: 2}}
emitc.switch %0 : i64
@@ -686,7 +686,7 @@ func.func @emitc_switch() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
diff --git a/mlir/test/Dialect/EmitC/invalid_types.mlir b/mlir/test/Dialect/EmitC/invalid_types.mlir
index f3f998ef56e0f..42b71707d1a4a 100644
--- a/mlir/test/Dialect/EmitC/invalid_types.mlir
+++ b/mlir/test/Dialect/EmitC/invalid_types.mlir
@@ -2,14 +2,14 @@
func.func @illegal_opaque_type_1() {
// expected-error @+1 {{expected non empty string in !emitc.opaque type}}
- %1 = "emitc.variable"(){value = "42" : !emitc.opaque<"">} : () -> !emitc.opaque<"mytype">
+ %1 = "emitc.variable"() <{value = "42" : !emitc.opaque<"">}> : () -> !emitc.opaque<"mytype">
}
// -----
func.func @illegal_opaque_type_2() {
// expected-error @+1 {{pointer not allowed as outer type with !emitc.opaque, use !emitc.ptr instead}}
- %1 = "emitc.variable"(){value = "nullptr" : !emitc.opaque<"int32_t*">} : () -> !emitc.opaque<"int32_t*">
+ %1 = "emitc.variable"() <{value = "nullptr" : !emitc.opaque<"int32_t*">}> : () -> !emitc.opaque<"int32_t*">
}
// -----
@@ -102,7 +102,7 @@ func.func @illegal_float_type(%arg0: f80, %arg1: f80) {
func.func @illegal_lvalue_type_1() {
// expected-error @+1 {{!emitc.lvalue cannot wrap !emitc.array type}}
- %v = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<!emitc.array<1xi32>>
+ %v = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<!emitc.array<1xi32>>
return
}
@@ -110,7 +110,7 @@ func.func @illegal_lvalue_type_1() {
func.func @illegal_lvalue_type_2() {
// expected-error @+1 {{!emitc.lvalue must wrap supported emitc type, but got '!emitc.lvalue<i32>'}}
- %v = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<!emitc.lvalue<i32>>
+ %v = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<!emitc.lvalue<i32>>
return
}
@@ -118,7 +118,7 @@ func.func @illegal_lvalue_type_2() {
func.func @illegal_lvalue_type_3() {
// expected-error @+1 {{!emitc.lvalue must wrap supported emitc type, but got 'i17'}}
- %v = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<i17>
+ %v = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i17>
return
}
@@ -126,7 +126,7 @@ func.func @illegal_lvalue_type_3() {
func.func @illegal_pointee_type_1() {
// expected-error @+1 {{'emitc.constant' op result #0 must be type supported by EmitC, but got '!emitc.ptr<i11>'}}
- %v = "emitc.constant"(){value = #emitc.opaque<"{}">} : () -> !emitc.ptr<i11>
+ %v = "emitc.constant"() <{value = #emitc.opaque<"{}">}> : () -> !emitc.ptr<i11>
return
}
@@ -134,7 +134,7 @@ func.func @illegal_pointee_type_1() {
func.func @illegal_pointee_type_2() {
// expected-error @+1 {{pointers to lvalues are not allowed}}
- %v = "emitc.constant"(){value = #emitc.opaque<"NULL">} : () -> !emitc.ptr<!emitc.lvalue<i32>>
+ %v = "emitc.constant"() <{value = #emitc.opaque<"NULL">}> : () -> !emitc.ptr<!emitc.lvalue<i32>>
return
}
@@ -142,7 +142,7 @@ func.func @illegal_pointee_type_2() {
func.func @illegal_non_static_tensor_shape_type() {
// expected-error @+1 {{'emitc.constant' op result #0 must be type supported by EmitC, but got 'tensor<?xf32>'}}
- %v = "emitc.constant"(){value = #emitc.opaque<"{}">} : () -> tensor<?xf32>
+ %v = "emitc.constant"() <{value = #emitc.opaque<"{}">}> : () -> tensor<?xf32>
return
}
@@ -150,7 +150,7 @@ func.func @illegal_non_static_tensor_shape_type() {
func.func @illegal_tensor_array_element_type() {
// expected-error @+1 {{'emitc.constant' op result #0 must be type supported by EmitC, but got 'tensor<!emitc.array<9xi16>>'}}
- %v = "emitc.constant"(){value = #emitc.opaque<"{}">} : () -> tensor<!emitc.array<9xi16>>
+ %v = "emitc.constant"() <{value = #emitc.opaque<"{}">}> : () -> tensor<!emitc.array<9xi16>>
return
}
@@ -158,7 +158,7 @@ func.func @illegal_tensor_array_element_type() {
func.func @illegal_tensor_integer_element_type() {
// expected-error @+1 {{'emitc.constant' op result #0 must be type supported by EmitC, but got 'tensor<9xi11>'}}
- %v = "emitc.constant"(){value = #emitc.opaque<"{}">} : () -> tensor<9xi11>
+ %v = "emitc.constant"() <{value = #emitc.opaque<"{}">}> : () -> tensor<9xi11>
return
}
@@ -166,7 +166,7 @@ func.func @illegal_tensor_integer_element_type() {
func.func @illegal_tuple_array_element_type() {
// expected-error @+1 {{'emitc.constant' op result #0 must be type supported by EmitC, but got 'tuple<!emitc.array<9xf32>, f32>'}}
- %v = "emitc.constant"(){value = #emitc.opaque<"{}">} : () -> tuple<!emitc.array<9xf32>, f32>
+ %v = "emitc.constant"() <{value = #emitc.opaque<"{}">}> : () -> tuple<!emitc.array<9xf32>, f32>
return
}
@@ -174,6 +174,6 @@ func.func @illegal_tuple_array_element_type() {
func.func @illegal_tuple_float_element_type() {
// expected-error @+1 {{'emitc.constant' op result #0 must be type supported by EmitC, but got 'tuple<i32, f80>'}}
- %v = "emitc.constant"(){value = #emitc.opaque<"{}">} : () -> tuple<i32, f80>
+ %v = "emitc.constant"() <{value = #emitc.opaque<"{}">}> : () -> tuple<i32, f80>
return
}
diff --git a/mlir/test/Dialect/EmitC/ops.mlir b/mlir/test/Dialect/EmitC/ops.mlir
index 3261b2fa467da..84300a1357198 100644
--- a/mlir/test/Dialect/EmitC/ops.mlir
+++ b/mlir/test/Dialect/EmitC/ops.mlir
@@ -32,6 +32,16 @@ emitc.func @call() -> i32 {
emitc.return %0 : i32
}
+// CHECK-LABEL: emitc.func @call_with_attrs
+// CHECK: %0 = call @callee_with_attrs(%{{.*}}) arg_attrs = [{}], res_attrs = [{}] : (i32) -> i32
+emitc.func @call_with_attrs(%arg0: i32) -> i32 {
+ %0 = emitc.call @callee_with_attrs(%arg0)
+ res_attrs = [{}], arg_attrs = [{}] : (i32) -> i32
+ emitc.return %0 : i32
+}
+
+emitc.func private @callee_with_attrs(i32) -> i32
+
emitc.func private @extern(i32) attributes {specifiers = ["extern"]}
func.func @cast(%arg0: i32) {
@@ -45,10 +55,10 @@ func.func @cast_array_to_pointer(%arg0: !emitc.array<3xi32>) {
}
func.func @c() {
- %1 = "emitc.constant"(){value = 42 : i32} : () -> i32
- %2 = "emitc.constant"(){value = 42 : index} : () -> !emitc.size_t
- %3 = "emitc.constant"(){value = 42 : index} : () -> !emitc.ssize_t
- %4 = "emitc.constant"(){value = 42 : index} : () -> !emitc.ptrdiff_t
+ %1 = "emitc.constant"() <{value = 42 : i32}> : () -> i32
+ %2 = "emitc.constant"() <{value = 42 : index}> : () -> !emitc.size_t
+ %3 = "emitc.constant"() <{value = 42 : index}> : () -> !emitc.ssize_t
+ %4 = "emitc.constant"() <{value = 42 : index}> : () -> !emitc.ptrdiff_t
return
}
@@ -118,19 +128,19 @@ func.func @sub_pointer(%arg0: !emitc.ptr<f32>, %arg1: i32, %arg2: !emitc.opaque<
}
func.func @cmp(%arg0 : i32, %arg1 : f32, %arg2 : i64, %arg3 : f64, %arg4 : !emitc.opaque<"unsigned">, %arg5 : !emitc.opaque<"std::valarray<int>">, %arg6 : !emitc.opaque<"custom">) {
- %1 = "emitc.cmp" (%arg0, %arg0) {predicate = 0} : (i32, i32) -> i1
+ %1 = "emitc.cmp" (%arg0, %arg0) <{predicate = 0}> : (i32, i32) -> i1
%2 = emitc.cmp eq, %arg0, %arg0 : (i32, i32) -> i1
- %3 = "emitc.cmp" (%arg1, %arg1) {predicate = 1} : (f32, f32) -> i1
+ %3 = "emitc.cmp" (%arg1, %arg1) <{predicate = 1}> : (f32, f32) -> i1
%4 = emitc.cmp ne, %arg1, %arg1 : (f32, f32) -> i1
- %5 = "emitc.cmp" (%arg2, %arg2) {predicate = 2} : (i64, i64) -> i1
+ %5 = "emitc.cmp" (%arg2, %arg2) <{predicate = 2}> : (i64, i64) -> i1
%6 = emitc.cmp lt, %arg2, %arg2 : (i64, i64) -> i1
- %7 = "emitc.cmp" (%arg3, %arg3) {predicate = 3} : (f64, f64) -> i1
+ %7 = "emitc.cmp" (%arg3, %arg3) <{predicate = 3}> : (f64, f64) -> i1
%8 = emitc.cmp le, %arg3, %arg3 : (f64, f64) -> i1
- %9 = "emitc.cmp" (%arg4, %arg4) {predicate = 4} : (!emitc.opaque<"unsigned">, !emitc.opaque<"unsigned">) -> i1
+ %9 = "emitc.cmp" (%arg4, %arg4) <{predicate = 4}> : (!emitc.opaque<"unsigned">, !emitc.opaque<"unsigned">) -> i1
%10 = emitc.cmp gt, %arg4, %arg4 : (!emitc.opaque<"unsigned">, !emitc.opaque<"unsigned">) -> i1
- %11 = "emitc.cmp" (%arg5, %arg5) {predicate = 5} : (!emitc.opaque<"std::valarray<int>">, !emitc.opaque<"std::valarray<int>">) -> !emitc.opaque<"std::valarray<bool>">
+ %11 = "emitc.cmp" (%arg5, %arg5) <{predicate = 5}> : (!emitc.opaque<"std::valarray<int>">, !emitc.opaque<"std::valarray<int>">) -> !emitc.opaque<"std::valarray<bool>">
%12 = emitc.cmp ge, %arg5, %arg5 : (!emitc.opaque<"std::valarray<int>">, !emitc.opaque<"std::valarray<int>">) -> !emitc.opaque<"std::valarray<bool>">
- %13 = "emitc.cmp" (%arg6, %arg6) {predicate = 6} : (!emitc.opaque<"custom">, !emitc.opaque<"custom">) -> !emitc.opaque<"custom">
+ %13 = "emitc.cmp" (%arg6, %arg6) <{predicate = 6}> : (!emitc.opaque<"custom">, !emitc.opaque<"custom">) -> !emitc.opaque<"custom">
%14 = emitc.cmp three_way, %arg6, %arg6 : (!emitc.opaque<"custom">, !emitc.opaque<"custom">) -> !emitc.opaque<"custom">
return
}
@@ -205,7 +215,7 @@ func.func @compound_assign(%arg0: i32, %arg1: !emitc.opaque<"number">) {
}
func.func @test_expression(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: f32, %arg4: f32) -> i32 {
- %c7 = "emitc.constant"() {value = 7 : i32} : () -> i32
+ %c7 = "emitc.constant"() <{value = 7 : i32}> : () -> i32
%q = emitc.expression %arg1, %c7 : (i32, i32) -> i32 {
%a = emitc.rem %arg1, %c7 : (i32, i32) -> i32
emitc.yield %a : i32
@@ -309,7 +319,7 @@ func.func @test_verbatim(%arg0 : !emitc.ptr<i32>, %arg1 : i32, %arg2: !emitc.arr
// Check there is no ambiguity whether %b is the argument to the emitc.verbatim op.
emitc.verbatim "b"
- %b = "emitc.constant"(){value = 42 : i32} : () -> i32
+ %b = "emitc.constant"() <{value = 42 : i32}> : () -> i32
return
}
@@ -347,7 +357,7 @@ func.func @member_access(%arg0: !emitc.lvalue<!emitc.opaque<"mystruct">>, %arg1:
}
func.func @switch() {
- %0 = "emitc.constant"(){value = 1 : index} : () -> !emitc.ptrdiff_t
+ %0 = "emitc.constant"() <{value = 1 : index}> : () -> !emitc.ptrdiff_t
emitc.switch %0 : !emitc.ptrdiff_t
case 1 {
@@ -359,7 +369,7 @@ func.func @switch() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
}
diff --git a/mlir/test/Dialect/EmitC/types.mlir b/mlir/test/Dialect/EmitC/types.mlir
index ce1e03a83e5d1..3d3dc04d144bc 100644
--- a/mlir/test/Dialect/EmitC/types.mlir
+++ b/mlir/test/Dialect/EmitC/types.mlir
@@ -42,17 +42,17 @@ func.func @lvalue_types() {
// CHECK-LABEL: func @opaque_types() {
func.func @opaque_types() {
// CHECK-NEXT: !emitc.opaque<"int">
- emitc.call_opaque "f"() {template_args = [!emitc<opaque<"int">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc<opaque<"int">>]}> : () -> ()
// CHECK-NEXT: !emitc.opaque<"byte">
- emitc.call_opaque "f"() {template_args = [!emitc<opaque<"byte">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc<opaque<"byte">>]}> : () -> ()
// CHECK-NEXT: !emitc.opaque<"unsigned">
- emitc.call_opaque "f"() {template_args = [!emitc<opaque<"unsigned">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc<opaque<"unsigned">>]}> : () -> ()
// CHECK-NEXT: !emitc.opaque<"status_t">
- emitc.call_opaque "f"() {template_args = [!emitc<opaque<"status_t">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc<opaque<"status_t">>]}> : () -> ()
// CHECK-NEXT: !emitc.opaque<"std::vector<std::string>">
- emitc.call_opaque "f"() {template_args = [!emitc.opaque<"std::vector<std::string>">]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.opaque<"std::vector<std::string>">]}> : () -> ()
// CHECK-NEXT: !emitc.opaque<"SmallVector<int*, 4>">
- emitc.call_opaque "f"() {template_args = [!emitc.opaque<"SmallVector<int*, 4>">]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.opaque<"SmallVector<int*, 4>">]}> : () -> ()
return
}
@@ -60,19 +60,19 @@ func.func @opaque_types() {
// CHECK-LABEL: func @pointer_types() {
func.func @pointer_types() {
// CHECK-NEXT: !emitc.ptr<i32>
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<i32>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<i32>]}> : () -> ()
// CHECK-NEXT: !emitc.ptr<i64>
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<i64>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<i64>]}> : () -> ()
// CHECK-NEXT: !emitc.ptr<f32>
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<f32>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<f32>]}> : () -> ()
// CHECK-NEXT: !emitc.ptr<f64>
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<f64>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<f64>]}> : () -> ()
// CHECK-NEXT: !emitc.ptr<i32>
%0 = emitc.call_opaque "f"() : () -> (!emitc.ptr<i32>)
// CHECK-NEXT: (!emitc.ptr<i32>) -> !emitc.ptr<!emitc.ptr<i32>>
%1 = emitc.call_opaque "f"(%0) : (!emitc.ptr<i32>) -> (!emitc.ptr<!emitc.ptr<i32>>)
// CHECK-NEXT: !emitc.ptr<!emitc.opaque<"int">>
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<!emitc.opaque<"int">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<!emitc.opaque<"int">>]}> : () -> ()
return
}
@@ -80,11 +80,11 @@ func.func @pointer_types() {
// CHECK-LABEL: func @size_types()
func.func @size_types() {
// CHECK-NEXT: !emitc.ssize_t
- emitc.call_opaque "f"() {template_args = [!emitc.ssize_t]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ssize_t]}> : () -> ()
// CHECK-NEXT: !emitc.size_t
- emitc.call_opaque "f"() {template_args = [!emitc.size_t]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.size_t]}> : () -> ()
// CHECK-NEXT: !emitc.ptrdiff_t
- emitc.call_opaque "f"() {template_args = [!emitc.ptrdiff_t]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptrdiff_t]}> : () -> ()
return
}
diff --git a/mlir/test/Target/Cpp/attrs.mlir b/mlir/test/Target/Cpp/attrs.mlir
index 0a42570ecf2a8..b8449467cfe6b 100644
--- a/mlir/test/Target/Cpp/attrs.mlir
+++ b/mlir/test/Target/Cpp/attrs.mlir
@@ -3,8 +3,8 @@
// CHECK-LABEL: void opaque_attrs() {
func.func @opaque_attrs() {
// CHECK-NEXT: f(OPAQUE_ENUM_VALUE);
- emitc.call_opaque "f"() {args = [#emitc.opaque<"OPAQUE_ENUM_VALUE">]} : () -> ()
+ emitc.call_opaque "f"() <{args = [#emitc.opaque<"OPAQUE_ENUM_VALUE">]}> : () -> ()
// CHECK-NEXT: f("some string");
- emitc.call_opaque "f"() {args = [#emitc.opaque<"\"some string\"">]} : () -> ()
+ emitc.call_opaque "f"() <{args = [#emitc.opaque<"\"some string\"">]}> : () -> ()
return
}
diff --git a/mlir/test/Target/Cpp/call.mlir b/mlir/test/Target/Cpp/call.mlir
index 3dd71abdfa81d..41f57ae9f170f 100644
--- a/mlir/test/Target/Cpp/call.mlir
+++ b/mlir/test/Target/Cpp/call.mlir
@@ -61,14 +61,14 @@ func.func @emitc_member_call_args(%arg0 : !emitc.opaque<"MyClass">, %arg1 : i32)
// CPP-DEFAULT-NEXT: int32_t [[V2:[^ ]*]] = [[V0]].method([[V1]]);
func.func @emitc_member_call_args_reorder(%arg0 : !emitc.opaque<"MyClass">, %arg1 : i32, %arg2 : i32) {
- %0 = emitc.member_call_opaque %arg0 "method" (%arg1, %arg2) {args = [1 : index, 0 : index]} : !emitc.opaque<"MyClass">, (i32, i32) -> i32
+ %0 = emitc.member_call_opaque %arg0 "method" (%arg1, %arg2) <{args = [1 : index, 0 : index]}> : !emitc.opaque<"MyClass">, (i32, i32) -> i32
return
}
// CPP-DEFAULT: void emitc_member_call_args_reorder(MyClass [[V0:[^ ]*]], int32_t [[V1:[^ ]*]], int32_t [[V2:[^ ]*]]) {
// CPP-DEFAULT-NEXT: int32_t [[V3:[^ ]*]] = [[V0]].method([[V2]], [[V1]]);
func.func @emitc_member_call_template_args(%arg0 : !emitc.opaque<"MyClass">) {
- %0 = emitc.member_call_opaque %arg0 "method" () {template_args = [i32]} : !emitc.opaque<"MyClass">, () -> i32
+ %0 = emitc.member_call_opaque %arg0 "method" () <{template_args = [i32]}> : !emitc.opaque<"MyClass">, () -> i32
return
}
// CPP-DEFAULT: void emitc_member_call_template_args(MyClass [[V0:[^ ]*]]) {
diff --git a/mlir/test/Target/Cpp/common-cpp.mlir b/mlir/test/Target/Cpp/common-cpp.mlir
index 041321db46290..e686e8b6fff08 100644
--- a/mlir/test/Target/Cpp/common-cpp.mlir
+++ b/mlir/test/Target/Cpp/common-cpp.mlir
@@ -15,11 +15,11 @@ func.func @test_include() {
// CHECK: void test_foo_print() {
func.func @test_foo_print() {
// CHECK: [[V1:[^ ]*]] = foo::constant({0, 1});
- %0 = emitc.call_opaque "foo::constant"() {args = [dense<[0, 1]> : tensor<2xi32>]} : () -> (i32)
+ %0 = emitc.call_opaque "foo::constant"() <{args = [dense<[0, 1]> : tensor<2xi32>]}> : () -> (i32)
// CHECK: [[V2:[^ ]*]] = foo::op_and_attr({0, 1}, [[V1]]);
- %1 = emitc.call_opaque "foo::op_and_attr"(%0) {args = [dense<[0, 1]> : tensor<2xi32>, 0 : index]} : (i32) -> (i32)
+ %1 = emitc.call_opaque "foo::op_and_attr"(%0) <{args = [dense<[0, 1]> : tensor<2xi32>, 0 : index]}> : (i32) -> (i32)
// CHECK: [[V3:[^ ]*]] = foo::op_and_attr([[V2]], {0, 1});
- %2 = emitc.call_opaque "foo::op_and_attr"(%1) {args = [0 : index, dense<[0, 1]> : tensor<2xi32>]} : (i32) -> (i32)
+ %2 = emitc.call_opaque "foo::op_and_attr"(%1) <{args = [0 : index, dense<[0, 1]> : tensor<2xi32>]}> : (i32) -> (i32)
// CHECK: foo::print([[V3]]);
emitc.call_opaque "foo::print"(%2): (i32) -> ()
return
@@ -44,37 +44,37 @@ func.func @test_multiple_return() -> (i32, i32) {
// CHECK: test_float
func.func @test_float() {
// CHECK: foo::constant({0.0e+00f, 1.000000000e+00f})
- %0 = emitc.call_opaque "foo::constant"() {args = [dense<[0.000000e+00, 1.000000e+00]> : tensor<2xf32>]} : () -> f32
+ %0 = emitc.call_opaque "foo::constant"() <{args = [dense<[0.000000e+00, 1.000000e+00]> : tensor<2xf32>]}> : () -> f32
return
}
// CHECK: test_uint
func.func @test_uint() {
// CHECK: uint32_t
- %0 = emitc.call_opaque "foo::constant"() {args = [dense<[0, 1]> : tensor<2xui32>]} : () -> ui32
+ %0 = emitc.call_opaque "foo::constant"() <{args = [dense<[0, 1]> : tensor<2xui32>]}> : () -> ui32
// CHECK: uint64_t
- %1 = emitc.call_opaque "foo::constant"() {args = [dense<[0, 1]> : tensor<2xui64>]} : () -> ui64
+ %1 = emitc.call_opaque "foo::constant"() <{args = [dense<[0, 1]> : tensor<2xui64>]}> : () -> ui64
return
}
// CHECK: int64_t test_plus_int(int64_t [[V1]])
func.func @test_plus_int(%arg0 : i64) -> i64 {
// CHECK: mhlo::add([[V1]], [[V1]])
- %0 = emitc.call_opaque "mhlo::add"(%arg0, %arg0) {args = [0 : index, 1 : index]} : (i64, i64) -> i64
+ %0 = emitc.call_opaque "mhlo::add"(%arg0, %arg0) <{args = [0 : index, 1 : index]}> : (i64, i64) -> i64
return %0 : i64
}
// CHECK: Tensor<float, 2> mixed_types(Tensor<double, 2> [[V1]])
func.func @mixed_types(%arg0: tensor<2xf64>) -> tensor<2xf32> {
// CHECK: foo::mixed_types([[V1]]);
- %0 = emitc.call_opaque "foo::mixed_types"(%arg0) {args = [0 : index]} : (tensor<2xf64>) -> tensor<2xf32>
+ %0 = emitc.call_opaque "foo::mixed_types"(%arg0) <{args = [0 : index]}> : (tensor<2xf64>) -> tensor<2xf32>
return %0 : tensor<2xf32>
}
// CHECK: Tensor<uint64_t> mhlo_convert(Tensor<uint32_t> [[V1]])
func.func @mhlo_convert(%arg0: tensor<ui32>) -> tensor<ui64> {
// CHECK: mhlo::convert([[V1]]);
- %0 = emitc.call_opaque "mhlo::convert"(%arg0) {args = [0 : index]} : (tensor<ui32>) -> tensor<ui64>
+ %0 = emitc.call_opaque "mhlo::convert"(%arg0) <{args = [0 : index]}> : (tensor<ui32>) -> tensor<ui64>
return %0 : tensor<ui64>
}
@@ -167,7 +167,7 @@ func.func @array_type(%arg0: !emitc.array<3xi32>, %arg1: !emitc.array<10x20xf32>
// CHECK: call_opaque_with_template_arg
func.func @call_opaque_with_template_arg() {
- emitc.call_opaque "init_tile"() {template_args = [512 : index]} : () -> ()
+ emitc.call_opaque "init_tile"() <{template_args = [512 : index]}> : () -> ()
// CHECK-NEXT: init_tile<512>();
// CHECK-NEXT: return
return
diff --git a/mlir/test/Target/Cpp/const.mlir b/mlir/test/Target/Cpp/const.mlir
index 2a5ff1a0f0177..cd8e8cc1e403d 100644
--- a/mlir/test/Target/Cpp/const.mlir
+++ b/mlir/test/Target/Cpp/const.mlir
@@ -2,22 +2,22 @@
// RUN: mlir-translate -mlir-to-cpp -declare-variables-at-top %s | FileCheck %s -check-prefix=CPP-DECLTOP
func.func @emitc_constant() {
- %c0 = "emitc.constant"(){value = #emitc.opaque<"INT_MAX">} : () -> i32
- %c1 = "emitc.constant"(){value = 42 : i32} : () -> i32
- %c2 = "emitc.constant"(){value = -1 : i32} : () -> i32
- %c3 = "emitc.constant"(){value = -1 : si8} : () -> si8
- %c4 = "emitc.constant"(){value = 255 : ui8} : () -> ui8
- %c5 = "emitc.constant"(){value = #emitc.opaque<"CHAR_MIN">} : () -> !emitc.opaque<"char">
- %c6 = "emitc.constant"(){value = 2 : index} : () -> index
- %c7 = "emitc.constant"(){value = 2.0 : f32} : () -> f32
- %f64 = "emitc.constant"(){value = 4.0 : f64} : () -> f64
- %f16 = "emitc.constant"(){value = 2.0 : f16} : () -> f16
- %bf16 = "emitc.constant"(){value = 4.0 : bf16} : () -> bf16
- %c8 = "emitc.constant"(){value = dense<0> : tensor<i32>} : () -> tensor<i32>
- %c9 = "emitc.constant"(){value = dense<[0, 1]> : tensor<2xindex>} : () -> tensor<2xindex>
- %c10 = "emitc.constant"(){value = dense<[[0.0, 1.0], [2.0, 3.0]]> : tensor<2x2xf32>} : () -> tensor<2x2xf32>
- %c11 = "emitc.constant"(){value = dense<[0, 1]> : !emitc.array<2xindex>} : () -> !emitc.array<2xindex>
- %c12 = "emitc.constant"(){value = dense<[0.0, 1.0]> : !emitc.array<2xf32>} : () -> !emitc.array<2xf32>
+ %c0 = "emitc.constant"() <{value = #emitc.opaque<"INT_MAX">}> : () -> i32
+ %c1 = "emitc.constant"() <{value = 42 : i32}> : () -> i32
+ %c2 = "emitc.constant"() <{value = -1 : i32}> : () -> i32
+ %c3 = "emitc.constant"() <{value = -1 : si8}> : () -> si8
+ %c4 = "emitc.constant"() <{value = 255 : ui8}> : () -> ui8
+ %c5 = "emitc.constant"() <{value = #emitc.opaque<"CHAR_MIN">}> : () -> !emitc.opaque<"char">
+ %c6 = "emitc.constant"() <{value = 2 : index}> : () -> index
+ %c7 = "emitc.constant"() <{value = 2.0 : f32}> : () -> f32
+ %f64 = "emitc.constant"() <{value = 4.0 : f64}> : () -> f64
+ %f16 = "emitc.constant"() <{value = 2.0 : f16}> : () -> f16
+ %bf16 = "emitc.constant"() <{value = 4.0 : bf16}> : () -> bf16
+ %c8 = "emitc.constant"() <{value = dense<0> : tensor<i32>}> : () -> tensor<i32>
+ %c9 = "emitc.constant"() <{value = dense<[0, 1]> : tensor<2xindex>}> : () -> tensor<2xindex>
+ %c10 = "emitc.constant"() <{value = dense<[[0.0, 1.0], [2.0, 3.0]]> : tensor<2x2xf32>}> : () -> tensor<2x2xf32>
+ %c11 = "emitc.constant"() <{value = dense<[0, 1]> : !emitc.array<2xindex>}> : () -> !emitc.array<2xindex>
+ %c12 = "emitc.constant"() <{value = dense<[0.0, 1.0]> : !emitc.array<2xf32>}> : () -> !emitc.array<2xf32>
return
}
// CPP-DEFAULT: void emitc_constant() {
diff --git a/mlir/test/Target/Cpp/expressions.mlir b/mlir/test/Target/Cpp/expressions.mlir
index 43e43cda49477..8c1e2538b2ac7 100644
--- a/mlir/test/Target/Cpp/expressions.mlir
+++ b/mlir/test/Target/Cpp/expressions.mlir
@@ -11,7 +11,7 @@
func.func @single_expression(%arg0: i32, %arg1: i32, %arg2: i32) -> i1 {
%e = emitc.expression %arg0, %arg1, %arg2 : (i32, i32, i32) -> i1 {
- %c42 = "emitc.constant"(){value = 42 : i32} : () -> i32
+ %c42 = "emitc.constant"() <{value = 42 : i32}> : () -> i32
%a = emitc.mul %arg0, %c42 : (i32, i32) -> i32
%b = emitc.sub %a, %arg1 : (i32, i32) -> i32
%c = emitc.cmp lt, %b, %arg2 :(i32, i32) -> i1
@@ -56,7 +56,7 @@ func.func @single_use(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: i32) -> i32 {
%d = emitc.cmp lt, %c, %arg1 :(i32, i32) -> i1
emitc.yield %d : i1
}
- %v = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<i32>
+ %v = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.if %e {
emitc.assign %arg0 : i32 to %v : !emitc.lvalue<i32>
emitc.yield
@@ -119,7 +119,7 @@ func.func @parentheses_for_low_precedence(%arg0: i32, %arg1: i32, %arg2: i32) ->
func.func @inline_cast_pure(%arg0: i32) -> f32 {
%0 = emitc.expression %arg0 : (i32) -> f32 {
- %1 = cast %arg0 {pure} : i32 to f32
+ %1 = cast %arg0 pure : i32 to f32
yield %1 : f32
}
return %0 : f32
@@ -201,7 +201,7 @@ func.func @parentheses_for_same_precedence(%arg0: i32, %arg1: i32, %arg2: i32) -
// CPP-DECLTOP-NEXT: return [[VAL_3]] / ([[VAL_1]] * [[VAL_2]]);
// CPP-DECLTOP-NEXT: }
func.func @user_with_expression_trait(%arg0: i32, %arg1: i32, %arg2: i32) -> i32 {
- %c0 = "emitc.constant"() {value = 0 : i32} : () -> i32
+ %c0 = "emitc.constant"() <{value = 0 : i32}> : () -> i32
%e0 = emitc.expression %arg0, %arg1, %arg2 : (i32, i32, i32) -> i32 {
%0 = emitc.mul %arg0, %arg1 : (i32, i32) -> i32
%1 = emitc.div %arg2, %0 : (i32, i32) -> i32
@@ -236,7 +236,7 @@ func.func @user_with_expression_trait(%arg0: i32, %arg1: i32, %arg2: i32) -> i32
%add = emitc.add %e1, %c0 : (i32, i32) -> i32
%call = emitc.call_opaque "bar" (%e2, %c0) : (i32, i32) -> (i32)
%cond = emitc.conditional %cast, %e3, %c0 : i32
- %var = "emitc.variable"() {value = #emitc.opaque<"">} : () -> !emitc.lvalue<i32>
+ %var = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.assign %e4 : i32 to %var : !emitc.lvalue<i32>
return %e5 : i32
}
@@ -281,7 +281,7 @@ func.func @multiple_uses(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: i32) -> i32
%d = emitc.cmp lt, %c, %arg3 :(i32, i32) -> i1
emitc.yield %d : i1
}
- %v = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<i32>
+ %v = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.if %e {
emitc.assign %arg0 : i32 to %v : !emitc.lvalue<i32>
emitc.yield
@@ -289,7 +289,7 @@ func.func @multiple_uses(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: i32) -> i32
emitc.assign %arg0 : i32 to %v : !emitc.lvalue<i32>
emitc.yield
}
- %q = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<i1>
+ %q = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i1>
emitc.assign %e : i1 to %q : !emitc.lvalue<i1>
%v_load = emitc.load %v : !emitc.lvalue<i32>
return %v_load : i32
@@ -340,7 +340,7 @@ func.func @different_expressions(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: i32)
%d = emitc.cmp lt, %c, %arg1 :(i32, i32) -> i1
emitc.yield %d : i1
}
- %v = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<i32>
+ %v = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.if %e3 {
emitc.assign %arg0 : i32 to %v : !emitc.lvalue<i32>
emitc.yield
@@ -364,7 +364,7 @@ func.func @different_expressions(%arg0: i32, %arg1: i32, %arg2: i32, %arg3: i32)
// CPP-DECLTOP-NEXT: }
func.func @expression_with_address_taken(%arg0: i32, %arg1: i32, %arg2: !emitc.ptr<i32>) -> i1 {
- %a = "emitc.variable"(){value = 42 : i32} : () -> !emitc.lvalue<i32>
+ %a = "emitc.variable"() <{value = 42 : i32}> : () -> !emitc.lvalue<i32>
%c = emitc.expression %arg1, %arg2, %a : (i32, !emitc.ptr<i32>, !emitc.lvalue<i32>) -> i1 {
%d = emitc.address_of %a : !emitc.lvalue<i32>
%e = emitc.sub %d, %arg1 : (!emitc.ptr<i32>, i32) -> !emitc.ptr<i32>
@@ -410,7 +410,7 @@ func.func @expression_with_subscript(%arg0: !emitc.array<4x8xi32>, %arg1: i32, %
// CPP-DECLTOP-NEXT: return [[VAL_4]];
func.func @expression_with_subscript_user(%arg0: !emitc.ptr<!emitc.opaque<"void">>) -> i32 {
- %c0 = "emitc.constant"() {value = 0 : i64} : () -> i64
+ %c0 = "emitc.constant"() <{value = 0 : i64}> : () -> i64
%0 = emitc.expression %arg0 : (!emitc.ptr<!emitc.opaque<"void">>) -> !emitc.ptr<i32> {
%0 = emitc.cast %arg0 : !emitc.ptr<!emitc.opaque<"void">> to !emitc.ptr<i32>
emitc.yield %0 : !emitc.ptr<i32>
@@ -433,7 +433,7 @@ func.func @expression_with_subscript_user(%arg0: !emitc.ptr<!emitc.opaque<"void"
// CPP-DECLTOP-NEXT: return [[VAL_5]] + [[VAL_2]] < [[VAL_3]][[[VAL_4]]] + [[VAL_1]];
emitc.func @expression_with_load(%arg0: i32, %arg1: i32, %arg2: !emitc.ptr<i32>) -> i1 {
- %c0 = "emitc.constant"() {value = 0 : i64} : () -> i64
+ %c0 = "emitc.constant"() <{value = 0 : i64}> : () -> i64
%0 = "emitc.variable"() <{value = #emitc.opaque<"42">}> : () -> !emitc.lvalue<i32>
%ptr = emitc.subscript %arg2[%c0] : (!emitc.ptr<i32>, i64) -> !emitc.lvalue<i32>
%result = emitc.expression %arg0, %arg1, %0, %ptr : (i32, i32, !emitc.lvalue<i32>, !emitc.lvalue<i32>) -> i1 {
@@ -457,7 +457,7 @@ emitc.func @expression_with_load(%arg0: i32, %arg1: i32, %arg2: !emitc.ptr<i32>)
// CPP-DECLTOP-NEXT: return [[VAL_1]][[[VAL_2]]] + bar([[VAL_1]][[[VAL_2]]]) < [[VAL_1]][[[VAL_2]]];
emitc.func @expression_with_load_and_call(%arg0: !emitc.ptr<i32>) -> i1 {
- %c0 = "emitc.constant"() {value = 0 : i64} : () -> i64
+ %c0 = "emitc.constant"() <{value = 0 : i64}> : () -> i64
%ptr = emitc.subscript %arg0[%c0] : (!emitc.ptr<i32>, i64) -> !emitc.lvalue<i32>
%result = emitc.expression %ptr : (!emitc.lvalue<i32>) -> i1 {
%a = emitc.load %ptr : !emitc.lvalue<i32>
@@ -486,7 +486,7 @@ emitc.func @expression_with_load_and_call(%arg0: !emitc.ptr<i32>) -> i1 {
emitc.func @expression_with_call_opaque_with_args_array(%0 : i32, %1 : i32) {
%2 = expression %0, %1 : (i32, i32) -> i1 {
%3 = cmp lt, %0, %1 : (i32, i32) -> i1
- %4 = emitc.call_opaque "f"(%3) {args = [0: index]} : (i1) -> i1
+ %4 = emitc.call_opaque "f"(%3) <{args = [0: index]}> : (i1) -> i1
yield %4 : i1
}
return
@@ -509,7 +509,7 @@ emitc.func @expression_with_call_opaque_with_args_array(%0 : i32, %1 : i32) {
// CPP-DECLTOP-NEXT: }
emitc.func @inline_side_effects_into_assign(%arg0: i32, %arg1: !emitc.ptr<i32>) {
- %c0 = "emitc.constant"() {value = 0 : i64} : () -> i64
+ %c0 = "emitc.constant"() <{value = 0 : i64}> : () -> i64
%0 = "emitc.variable"() <{value = #emitc.opaque<"42">}> : () -> !emitc.lvalue<i32>
%ptr = emitc.subscript %arg1[%c0] : (!emitc.ptr<i32>, i64) -> !emitc.lvalue<i32>
%result = emitc.expression %arg0, %0, %ptr : (i32, !emitc.lvalue<i32>, !emitc.lvalue<i32>) -> i32 {
@@ -543,7 +543,7 @@ emitc.func @inline_side_effects_into_assign(%arg0: i32, %arg1: !emitc.ptr<i32>)
// CPP-DECLTOP-NEXT: }
emitc.func @do_not_inline_side_effects_into_assign(%arg0: i32, %arg1: !emitc.ptr<i32>) {
- %c0 = "emitc.constant"() {value = 0 : i64} : () -> i64
+ %c0 = "emitc.constant"() <{value = 0 : i64}> : () -> i64
%0 = "emitc.variable"() <{value = #emitc.opaque<"42">}> : () -> !emitc.lvalue<i32>
%ptr = emitc.subscript %arg1[%c0] : (!emitc.ptr<i32>, i64) -> !emitc.lvalue<i32>
%result = emitc.expression %arg0, %0 : (i32, !emitc.lvalue<i32>) -> i32 {
@@ -575,7 +575,7 @@ emitc.func @do_not_inline_side_effects_into_assign(%arg0: i32, %arg1: !emitc.ptr
// CPP-DECLTOP-NEXT: }
emitc.func @do_not_inline_non_preceding_side_effects(%arg0: i32, %arg1: !emitc.ptr<i32>) -> i32 {
- %c0 = "emitc.constant"() {value = 0 : i64} : () -> i64
+ %c0 = "emitc.constant"() <{value = 0 : i64}> : () -> i64
%0 = "emitc.variable"() <{value = #emitc.opaque<"42">}> : () -> !emitc.lvalue<i32>
%ptr = emitc.subscript %arg1[%c0] : (!emitc.ptr<i32>, i64) -> !emitc.lvalue<i32>
%result = emitc.expression %arg0, %0 : (i32, !emitc.lvalue<i32>) -> i32 {
@@ -612,7 +612,7 @@ emitc.func @do_not_inline_non_preceding_side_effects(%arg0: i32, %arg1: !emitc.p
// CPP-DECLTOP-NEXT: }
func.func @inline_side_effects_into_if(%arg0: i32, %arg1: i32, %arg2: i32) -> i32 {
- %v = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<i32>
+ %v = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
%cond = emitc.expression %arg0, %arg1, %arg2 : (i32, i32, i32) -> i1 {
%a = emitc.call_opaque "bar" (%arg0, %arg1) : (i32, i32) -> (i32)
%b = emitc.cmp lt, %a, %arg2 :(i32, i32) -> i1
@@ -686,7 +686,7 @@ func.func @inline_side_effects_into_switch(%arg0: i32, %arg1: i32, %arg2: i32) {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -839,7 +839,7 @@ func.func @expression_with_literal(%arg0: f32) -> f32 {
func.func @expression_tree(%arg0: !emitc.array<2000xi32>, %arg1: i32, %arg2: i32, %arg4: index) -> i1 {
%e1 = emitc.expression %arg0, %arg4 : (!emitc.array<2000xi32>, index) -> !emitc.lvalue<i32> {
- %c42 = "emitc.constant"(){value = 42 : index} : () -> index
+ %c42 = "emitc.constant"() <{value = 42 : index}> : () -> index
%i = mul %arg4, %c42 : (index, index) -> index
%k = subscript %arg0[%i] : (!emitc.array<2000xi32>, index) -> !emitc.lvalue<i32>
yield %k : !emitc.lvalue<i32>
diff --git a/mlir/test/Target/Cpp/invalid.mlir b/mlir/test/Target/Cpp/invalid.mlir
index df4627a158319..034c23b5a9513 100644
--- a/mlir/test/Target/Cpp/invalid.mlir
+++ b/mlir/test/Target/Cpp/invalid.mlir
@@ -90,6 +90,6 @@ func.func @array_as_result(%arg: !emitc.array<4xi8>) -> (!emitc.array<4xi8>) {
func.func @ptr_to_array() {
// expected-error at +1 {{cannot emit pointer to array type '!emitc.ptr<!emitc.array<9xi16>>'}}
- %v = "emitc.variable"(){value = #emitc.opaque<"NULL">} : () -> !emitc.lvalue<!emitc.ptr<!emitc.array<9xi16>>>
+ %v = "emitc.variable"() <{value = #emitc.opaque<"NULL">}> : () -> !emitc.lvalue<!emitc.ptr<!emitc.array<9xi16>>>
return
}
diff --git a/mlir/test/Target/Cpp/literal_call_operand.mlir b/mlir/test/Target/Cpp/literal_call_operand.mlir
index 00adb441cedf5..92b807dac81af 100644
--- a/mlir/test/Target/Cpp/literal_call_operand.mlir
+++ b/mlir/test/Target/Cpp/literal_call_operand.mlir
@@ -15,7 +15,7 @@ func.func @emitc_call_operand() {
func.func @emitc_call_operand_arg() {
%p0 = emitc.literal "M_PI" : f32
- %1 = emitc.call_opaque "bar"(%p0) {args = [42 : i32, 0 : index]} : (f32) -> f32
+ %1 = emitc.call_opaque "bar"(%p0) <{args = [42 : i32, 0 : index]}> : (f32) -> f32
return
}
// CPP-DEFAULT: void emitc_call_operand_arg() {
diff --git a/mlir/test/Target/Cpp/lvalue.mlir b/mlir/test/Target/Cpp/lvalue.mlir
index e2d61a09bef44..af0e4b27a3d8c 100644
--- a/mlir/test/Target/Cpp/lvalue.mlir
+++ b/mlir/test/Target/Cpp/lvalue.mlir
@@ -2,12 +2,12 @@
emitc.func @lvalue_variables(%v1: i32, %v2: i32) -> i32 {
%val = emitc.mul %v1, %v2 : (i32, i32) -> i32
- %variable = "emitc.variable"() {value = #emitc.opaque<"">} : () -> !emitc.lvalue<i32>
+ %variable = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.assign %val : i32 to %variable : !emitc.lvalue<i32>
%addr = emitc.address_of %variable : !emitc.lvalue<i32>
emitc.call @zero (%addr) : (!emitc.ptr<i32>) -> ()
%updated_val = emitc.load %variable : !emitc.lvalue<i32>
- %neg_one = "emitc.constant"() {value = -1 : i32} : () -> i32
+ %neg_one = "emitc.constant"() <{value = -1 : i32}> : () -> i32
emitc.assign %neg_one : i32 to %variable : !emitc.lvalue<i32>
emitc.return %updated_val : i32
}
@@ -18,8 +18,8 @@ emitc.func @lvalue_variables(%v1: i32, %v2: i32) -> i32 {
// CHECK-NEXT: [[VAR]] = [[VAL]];
// CHECK-NEXT: int32_t* [[VAR_PTR:[^ ]*]] = &[[VAR]];
// CHECK-NEXT: zero([[VAR_PTR]]);
-// CHECK-NEXT: int32_t [[VAR_LOAD:[^ ]*]] = [[VAR]];
-// CHECK-NEXT: int32_t [[NEG_ONE:[^ ]*]] = -1;
+// CHECK-NEXT: int32_t [[VAR_LOAD:[^ ]*]] = [[VAR]];
+// CHECK-NEXT: int32_t [[NEG_ONE:[^ ]*]] = -1;
// CHECK-NEXT: [[VAR]] = [[NEG_ONE]];
// CHECK-NEXT: return [[VAR_LOAD]];
diff --git a/mlir/test/Target/Cpp/member.mlir b/mlir/test/Target/Cpp/member.mlir
index 0fd25e440f752..18b5fa1a1f961 100644
--- a/mlir/test/Target/Cpp/member.mlir
+++ b/mlir/test/Target/Cpp/member.mlir
@@ -4,20 +4,20 @@ func.func @member(%arg0: !emitc.opaque<"mystruct">, %arg1: i32, %arg2: index) {
%var0 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<!emitc.opaque<"mystruct">>
emitc.assign %arg0 : !emitc.opaque<"mystruct"> to %var0 : !emitc.lvalue<!emitc.opaque<"mystruct">>
- %0 = "emitc.member" (%var0) {member = "a"} : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
+ %0 = "emitc.member" (%var0) <{member = "a"}> : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
emitc.assign %arg1 : i32 to %0 : !emitc.lvalue<i32>
- %1 = "emitc.member" (%var0) {member = "b"} : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
+ %1 = "emitc.member" (%var0) <{member = "b"}> : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.lvalue<i32>
%2 = emitc.load %1 : !emitc.lvalue<i32>
%3 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.assign %2 : i32 to %3 : !emitc.lvalue<i32>
- %4 = "emitc.member" (%var0) {member = "c"} : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
+ %4 = "emitc.member" (%var0) <{member = "c"}> : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
%5 = emitc.subscript %4[%arg2] : (!emitc.array<2xi32>, index) -> !emitc.lvalue<i32>
%6 = emitc.load %5 : <i32>
emitc.assign %6 : i32 to %3 : !emitc.lvalue<i32>
- %7 = "emitc.member" (%var0) {member = "d"} : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
+ %7 = "emitc.member" (%var0) <{member = "d"}> : (!emitc.lvalue<!emitc.opaque<"mystruct">>) -> !emitc.array<2xi32>
%8 = emitc.subscript %7[%arg2] : (!emitc.array<2xi32>, index) -> !emitc.lvalue<i32>
emitc.assign %arg1 : i32 to %8 : !emitc.lvalue<i32>
@@ -43,20 +43,20 @@ func.func @member_of_pointer(%arg0: !emitc.ptr<!emitc.opaque<"mystruct">>, %arg1
%var0 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>
emitc.assign %arg0 : !emitc.ptr<!emitc.opaque<"mystruct">> to %var0 : !emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>
- %0 = "emitc.member_of_ptr" (%var0) {member = "a"} : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.lvalue<i32>
+ %0 = "emitc.member_of_ptr" (%var0) <{member = "a"}> : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.lvalue<i32>
emitc.assign %arg1 : i32 to %0 : !emitc.lvalue<i32>
- %1 = "emitc.member_of_ptr" (%var0) {member = "b"} : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.lvalue<i32>
+ %1 = "emitc.member_of_ptr" (%var0) <{member = "b"}> : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.lvalue<i32>
%2 = emitc.load %1 : !emitc.lvalue<i32>
%3 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
emitc.assign %2 : i32 to %3 : !emitc.lvalue<i32>
- %4 = "emitc.member_of_ptr" (%var0) {member = "c"} : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.array<2xi32>
+ %4 = "emitc.member_of_ptr" (%var0) <{member = "c"}> : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.array<2xi32>
%5 = emitc.subscript %4[%arg2] : (!emitc.array<2xi32>, index) -> !emitc.lvalue<i32>
%6 = emitc.load %5 : <i32>
emitc.assign %6 : i32 to %3 : !emitc.lvalue<i32>
- %7 = "emitc.member_of_ptr" (%var0) {member = "d"} : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.array<2xi32>
+ %7 = "emitc.member_of_ptr" (%var0) <{member = "d"}> : (!emitc.lvalue<!emitc.ptr<!emitc.opaque<"mystruct">>>) -> !emitc.array<2xi32>
%8 = emitc.subscript %7[%arg2] : (!emitc.array<2xi32>, index) -> !emitc.lvalue<i32>
emitc.assign %arg1 : i32 to %8 : !emitc.lvalue<i32>
diff --git a/mlir/test/Target/Cpp/subscript.mlir b/mlir/test/Target/Cpp/subscript.mlir
index 7f015c210796e..0e1c4a8363b96 100644
--- a/mlir/test/Target/Cpp/subscript.mlir
+++ b/mlir/test/Target/Cpp/subscript.mlir
@@ -70,7 +70,7 @@ emitc.func @call_arg(%arg0: !emitc.array<4x8xf32>, %i: i32, %j: i16,
emitc.call_opaque "func2" (%3) : (f32) -> ()
%4 = emitc.load %0 : <f32>
%5 = emitc.load %1 : <f32>
- emitc.call_opaque "func3" (%4, %5) { args = [1 : index, 0 : index] } : (f32, f32) -> ()
+ emitc.call_opaque "func3" (%4, %5) <{args = [1 : index, 0 : index]}> : (f32, f32) -> ()
emitc.return
}
// CPP-DEFAULT: void call_arg(float [[ARR1:[^ ]*]][4][8], int32_t [[I:[^ ]*]],
diff --git a/mlir/test/Target/Cpp/switch.mlir b/mlir/test/Target/Cpp/switch.mlir
index 87e4cb8715c90..b75f7c6f88b45 100644
--- a/mlir/test/Target/Cpp/switch.mlir
+++ b/mlir/test/Target/Cpp/switch.mlir
@@ -45,7 +45,7 @@
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ptrdiff_t() {
- %0 = "emitc.constant"(){value = 1 : index} : () -> !emitc.ptrdiff_t
+ %0 = "emitc.constant"() <{value = 1 : index}> : () -> !emitc.ptrdiff_t
emitc.switch %0 : !emitc.ptrdiff_t
case 2 {
@@ -57,7 +57,7 @@ func.func @emitc_switch_ptrdiff_t() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
}
return
@@ -107,7 +107,7 @@ func.func @emitc_switch_ptrdiff_t() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ssize_t() {
- %0 = "emitc.constant"(){value = 1 : index} : () -> !emitc.ssize_t
+ %0 = "emitc.constant"() <{value = 1 : index}> : () -> !emitc.ssize_t
emitc.switch %0 : !emitc.ssize_t
case 2 {
@@ -119,7 +119,7 @@ func.func @emitc_switch_ssize_t() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -170,7 +170,7 @@ func.func @emitc_switch_ssize_t() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_size_t() {
- %0 = "emitc.constant"(){value = 1 : index} : () -> !emitc.size_t
+ %0 = "emitc.constant"() <{value = 1 : index}> : () -> !emitc.size_t
emitc.switch %0 : !emitc.size_t
case 2 {
@@ -182,7 +182,7 @@ func.func @emitc_switch_size_t() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -233,7 +233,7 @@ func.func @emitc_switch_size_t() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_index() {
- %0 = "emitc.constant"(){value = 1 : index} : () -> index
+ %0 = "emitc.constant"() <{value = 1 : index}> : () -> index
emitc.switch %0 : index
case 2 {
@@ -245,7 +245,7 @@ func.func @emitc_switch_index() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -296,7 +296,7 @@ func.func @emitc_switch_index() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_opaque() {
- %0 = "emitc.constant"() {value = #emitc.opaque<"1">}
+ %0 = "emitc.constant"() <{value = #emitc.opaque<"1">}>
: () -> !emitc.opaque<"size_t">
emitc.switch %0 : !emitc.opaque<"size_t">
@@ -309,7 +309,7 @@ func.func @emitc_switch_opaque() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -360,7 +360,7 @@ func.func @emitc_switch_opaque() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i1() {
- %0 = "emitc.constant"(){value = 1 : i1} : () -> i1
+ %0 = "emitc.constant"() <{value = 1 : i1}> : () -> i1
emitc.switch %0 : i1
case 2 {
@@ -372,7 +372,7 @@ func.func @emitc_switch_i1() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -423,7 +423,7 @@ func.func @emitc_switch_i1() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i8() {
- %0 = "emitc.constant"(){value = 1 : i8} : () -> i8
+ %0 = "emitc.constant"() <{value = 1 : i8}> : () -> i8
emitc.switch %0 : i8
case 2 {
@@ -435,7 +435,7 @@ func.func @emitc_switch_i8() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -486,7 +486,7 @@ func.func @emitc_switch_i8() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ui8() {
- %0 = "emitc.constant"(){value = 1 : ui8} : () -> ui8
+ %0 = "emitc.constant"() <{value = 1 : ui8}> : () -> ui8
emitc.switch %0 : ui8
case 2 {
@@ -498,7 +498,7 @@ func.func @emitc_switch_ui8() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -549,7 +549,7 @@ func.func @emitc_switch_ui8() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i16() {
- %0 = "emitc.constant"(){value = 1 : i16} : () -> i16
+ %0 = "emitc.constant"() <{value = 1 : i16}> : () -> i16
emitc.switch %0 : i16
case 2 {
@@ -561,7 +561,7 @@ func.func @emitc_switch_i16() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -612,7 +612,7 @@ func.func @emitc_switch_i16() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ui16() {
- %0 = "emitc.constant"(){value = 1 : ui16} : () -> ui16
+ %0 = "emitc.constant"() <{value = 1 : ui16}> : () -> ui16
emitc.switch %0 : ui16
case 2 {
@@ -624,7 +624,7 @@ func.func @emitc_switch_ui16() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -675,7 +675,7 @@ func.func @emitc_switch_ui16() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i32() {
- %0 = "emitc.constant"(){value = 1 : i32} : () -> i32
+ %0 = "emitc.constant"() <{value = 1 : i32}> : () -> i32
emitc.switch %0 : i32
case 2 {
@@ -687,7 +687,7 @@ func.func @emitc_switch_i32() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -738,7 +738,7 @@ func.func @emitc_switch_i32() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ui32() {
- %0 = "emitc.constant"(){value = 1 : ui32} : () -> ui32
+ %0 = "emitc.constant"() <{value = 1 : ui32}> : () -> ui32
emitc.switch %0 : ui32
case 2 {
@@ -750,7 +750,7 @@ func.func @emitc_switch_ui32() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -801,7 +801,7 @@ func.func @emitc_switch_ui32() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_i64() {
- %0 = "emitc.constant"(){value = 1 : i64} : () -> i64
+ %0 = "emitc.constant"() <{value = 1 : i64}> : () -> i64
emitc.switch %0 : i64
case 2 {
@@ -813,7 +813,7 @@ func.func @emitc_switch_i64() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -864,7 +864,7 @@ func.func @emitc_switch_i64() {
// CPP-DECLTOP: return;
// CPP-DECLTOP: }
func.func @emitc_switch_ui64() {
- %0 = "emitc.constant"(){value = 1 : ui64} : () -> ui64
+ %0 = "emitc.constant"() <{value = 1 : ui64}> : () -> ui64
emitc.switch %0 : ui64
case 2 {
@@ -876,7 +876,7 @@ func.func @emitc_switch_ui64() {
emitc.yield
}
default {
- %3 = "emitc.constant"(){value = 42.0 : f32} : () -> f32
+ %3 = "emitc.constant"() <{value = 42.0 : f32}> : () -> f32
emitc.call_opaque "func2" (%3) : (f32) -> ()
emitc.yield
}
@@ -905,7 +905,7 @@ func.func @emitc_switch_ui64() {
// CPP-DECLTOP: }
func.func @emitc_switch_expression() {
- %x = "emitc.constant"(){value = 42 : i64} : () -> i64
+ %x = "emitc.constant"() <{value = 42 : i64}> : () -> i64
%0 = emitc.expression %x : (i64) -> i64 {
%a = emitc.unary_minus %x : (i64) -> i64
diff --git a/mlir/test/Target/Cpp/types.mlir b/mlir/test/Target/Cpp/types.mlir
index e7f935c737438..fbeb2e9851381 100644
--- a/mlir/test/Target/Cpp/types.mlir
+++ b/mlir/test/Target/Cpp/types.mlir
@@ -3,15 +3,15 @@
// CHECK-LABEL: void opaque_types() {
func.func @opaque_types() {
// CHECK-NEXT: f<int>();
- emitc.call_opaque "f"() {template_args = [!emitc<opaque<"int">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc<opaque<"int">>]}> : () -> ()
// CHECK-NEXT: f<byte>();
- emitc.call_opaque "f"() {template_args = [!emitc<opaque<"byte">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc<opaque<"byte">>]}> : () -> ()
// CHECK-NEXT: f<unsigned>();
- emitc.call_opaque "f"() {template_args = [!emitc<opaque<"unsigned">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc<opaque<"unsigned">>]}> : () -> ()
// CHECK-NEXT: f<status_t>();
- emitc.call_opaque "f"() {template_args = [!emitc<opaque<"status_t">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc<opaque<"status_t">>]}> : () -> ()
// CHECK-NEXT: f<std::vector<std::string>>();
- emitc.call_opaque "f"() {template_args = [!emitc.opaque<"std::vector<std::string>">]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.opaque<"std::vector<std::string>">]}> : () -> ()
return
}
@@ -19,23 +19,23 @@ func.func @opaque_types() {
// CHECK-LABEL: void ptr_types() {
func.func @ptr_types() {
// CHECK-NEXT: f<int32_t*>();
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<i32>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<i32>]}> : () -> ()
// CHECK-NEXT: f<int64_t*>();
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<i64>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<i64>]}> : () -> ()
// CHECK-NEXT: f<_Float16*>();
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<f16>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<f16>]}> : () -> ()
// CHECK-NEXT: f<__bf16*>();
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<bf16>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<bf16>]}> : () -> ()
// CHECK-NEXT: f<float*>();
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<f32>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<f32>]}> : () -> ()
// CHECK-NEXT: f<double*>();
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<f64>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<f64>]}> : () -> ()
// CHECK-NEXT: int32_t* [[V0:[^ ]*]] = f();
%0 = emitc.call_opaque "f"() : () -> (!emitc.ptr<i32>)
// CHECK-NEXT: int32_t** [[V1:[^ ]*]] = f([[V0:[^ ]*]]);
%1 = emitc.call_opaque "f"(%0) : (!emitc.ptr<i32>) -> (!emitc.ptr<!emitc.ptr<i32>>)
// CHECK-NEXT: f<int*>();
- emitc.call_opaque "f"() {template_args = [!emitc.ptr<!emitc.opaque<"int">>]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptr<!emitc.opaque<"int">>]}> : () -> ()
return
}
@@ -43,11 +43,11 @@ func.func @ptr_types() {
// CHECK-LABEL: void size_types() {
func.func @size_types() {
// CHECK-NEXT: f<ssize_t>();
- emitc.call_opaque "f"() {template_args = [!emitc.ssize_t]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ssize_t]}> : () -> ()
// CHECK-NEXT: f<size_t>();
- emitc.call_opaque "f"() {template_args = [!emitc.size_t]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.size_t]}> : () -> ()
// CHECK-NEXT: f<ptrdiff_t>();
- emitc.call_opaque "f"() {template_args = [!emitc.ptrdiff_t]} : () -> ()
+ emitc.call_opaque "f"() <{template_args = [!emitc.ptrdiff_t]}> : () -> ()
return
}
diff --git a/mlir/test/Target/Cpp/variable.mlir b/mlir/test/Target/Cpp/variable.mlir
index a26d724127cf2..83438e995b8bc 100644
--- a/mlir/test/Target/Cpp/variable.mlir
+++ b/mlir/test/Target/Cpp/variable.mlir
@@ -2,15 +2,15 @@
// RUN: mlir-translate -mlir-to-cpp -declare-variables-at-top %s | FileCheck %s -check-prefix=CPP-DECLTOP
func.func @emitc_variable() {
- %c0 = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<i32>
- %c1 = "emitc.variable"(){value = 42 : i32} : () -> !emitc.lvalue<i32>
- %c2 = "emitc.variable"(){value = -1 : i32} : () -> !emitc.lvalue<i32>
- %c3 = "emitc.variable"(){value = -1 : si8} : () -> !emitc.lvalue<si8>
- %c4 = "emitc.variable"(){value = 255 : ui8} : () -> !emitc.lvalue<ui8>
- %c5 = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.lvalue<!emitc.ptr<i32>>
- %c6 = "emitc.variable"(){value = #emitc.opaque<"NULL">} : () -> !emitc.lvalue<!emitc.ptr<i32>>
- %c7 = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.array<3x7xi32>
- %c8 = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.array<5x!emitc.ptr<i8>>
+ %c0 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<i32>
+ %c1 = "emitc.variable"() <{value = 42 : i32}> : () -> !emitc.lvalue<i32>
+ %c2 = "emitc.variable"() <{value = -1 : i32}> : () -> !emitc.lvalue<i32>
+ %c3 = "emitc.variable"() <{value = -1 : si8}> : () -> !emitc.lvalue<si8>
+ %c4 = "emitc.variable"() <{value = 255 : ui8}> : () -> !emitc.lvalue<ui8>
+ %c5 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.lvalue<!emitc.ptr<i32>>
+ %c6 = "emitc.variable"() <{value = #emitc.opaque<"NULL">}> : () -> !emitc.lvalue<!emitc.ptr<i32>>
+ %c7 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.array<3x7xi32>
+ %c8 = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.array<5x!emitc.ptr<i8>>
return
}
// CPP-DEFAULT: void emitc_variable() {
diff --git a/mlir/test/Target/Cpp/verbatim.mlir b/mlir/test/Target/Cpp/verbatim.mlir
index e1f225c112a43..ee339cd8997ca 100644
--- a/mlir/test/Target/Cpp/verbatim.mlir
+++ b/mlir/test/Target/Cpp/verbatim.mlir
@@ -22,7 +22,7 @@ emitc.verbatim "typedef float f32;"
emitc.func @func(%arg: f32) {
// CHECK: void func(float [[V0:[^ ]*]]) {
- %a = "emitc.variable"(){value = #emitc.opaque<"">} : () -> !emitc.array<3x7xi32>
+ %a = "emitc.variable"() <{value = #emitc.opaque<"">}> : () -> !emitc.array<3x7xi32>
// CHECK: int32_t [[A:[^ ]*]][3][7];
emitc.verbatim "{}" args %arg : f32
More information about the Mlir-commits
mailing list