Add support for multiple results to the printer/parser, add support
for forward references to the parser, add initial support for SSA
use-list iteration and RAUW.
PiperOrigin-RevId: 205484031
diff --git a/test/IR/parser-errors.mlir b/test/IR/parser-errors.mlir
index b2c7432..1d29c1b 100644
--- a/test/IR/parser-errors.mlir
+++ b/test/IR/parser-errors.mlir
@@ -176,11 +176,21 @@
cfgfunc @redef() {
bb42:
- %x = "dim"(){index: 0} : ()->i32
- %x = "dim"(){index: 0} : ()->i32 // expected-error {{redefinition of SSA value %x}}
+ %x = "dim"(){index: 0} : ()->i32 // expected-error {{previously defined here}}
+ %x = "dim"(){index: 0} : ()->i32 // expected-error {{redefinition of SSA value '%x'}}
return
}
+// -----
+
+cfgfunc @undef() {
+bb42:
+ %x = "xxx"(%y) : (i32)->i32 // expected-error {{use of undeclared SSA value}}
+ return
+}
+
+// -----
+
mlfunc @missing_rbrace() {
return %a
mlfunc @d {return} // expected-error {{expected ',' or '}'}}
diff --git a/test/IR/parser.mlir b/test/IR/parser.mlir
index 222fa12..d10b1b6 100644
--- a/test/IR/parser.mlir
+++ b/test/IR/parser.mlir
@@ -178,3 +178,21 @@
"addf"(%f, %f) : (f32,f32) -> f32
return
}
+
+// CHECK-LABEL: cfgfunc @ssa_values() {
+cfgfunc @ssa_values() {
+bb0: // CHECK: bb0:
+ // CHECK: %0 = "foo"() : () -> (i1, i17)
+ %0 = "foo"() : () -> (i1, i17)
+ br bb2
+
+bb1: // CHECK: bb1:
+ // CHECK: %1 = "baz"(%2#1, %2#0, %0#1) : (f32, i11, i17) -> i16
+ %1 = "baz"(%2#1, %2#0, %0#1) : (f32, i11, i17) -> i16
+ return
+
+bb2: // CHECK: bb2:
+ // CHECK: %2 = "bar"(%0#0, %0#1) : (i1, i17) -> (i11, f32)
+ %2 = "bar"(%0#0, %0#1) : (i1, i17) -> (i11, f32)
+ br bb1
+}
\ No newline at end of file