Skip to content

Commit 1734346

Browse files
committed
[mlir][emitc] Add a test for invalid lvalue for get_global_op
1 parent 2cea9f4 commit 1734346

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

mlir/test/Dialect/EmitC/invalid_ops.mlir

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,16 @@ func.func @use_global() {
532532

533533
// -----
534534

535+
emitc.global @myglobal_value : f32
536+
537+
func.func @use_global() {
538+
// expected-error @+1 {{'emitc.get_global' op on non-array type expects result type to be an lvalue type for the global @myglobal_value}}
539+
%0 = emitc.get_global @myglobal_value : !emitc.array<2xf32>
540+
return
541+
}
542+
543+
// -----
544+
535545
func.func @member(%arg0: !emitc.lvalue<i32>) {
536546
// expected-error @+1 {{'emitc.member' op operand #0 must be emitc.lvalue of EmitC opaque type values, but got '!emitc.lvalue<i32>'}}
537547
%0 = "emitc.member" (%arg0) {member = "a"} : (!emitc.lvalue<i32>) -> !emitc.lvalue<i32>

0 commit comments

Comments
 (0)