Accept redundant alias definitions.
In the text format, allow aliases to be defined multiple times, as long as they're always aliasing the same value. write.rs is already emitting redundant aliases, because it emits them at their uses, so this change allows the parser to be able to parse such code.
This commit is contained in:
32
cranelift/filetests/parser/alias.cton
Normal file
32
cranelift/filetests/parser/alias.cton
Normal file
@@ -0,0 +1,32 @@
|
||||
test cat
|
||||
test verifier
|
||||
|
||||
function %basic(i32, i32) -> i32 {
|
||||
ebb0(v0: i32, v1: i32):
|
||||
v2 -> v0
|
||||
v3 -> v1
|
||||
v4 = iadd.i32 v2, v3
|
||||
return v4
|
||||
}
|
||||
|
||||
function %transitive() -> i32 {
|
||||
ebb0:
|
||||
v0 = iconst.i32 0
|
||||
v1 -> v0
|
||||
v2 -> v1
|
||||
v3 -> v2
|
||||
v4 -> v3
|
||||
return v4
|
||||
}
|
||||
|
||||
function %duplicate(i32, i32) -> i32 {
|
||||
ebb0(v0: i32, v1: i32):
|
||||
v2 -> v0
|
||||
v2 -> v0
|
||||
v2 -> v0
|
||||
v3 -> v1
|
||||
v3 -> v1
|
||||
v3 -> v1
|
||||
v4 = iadd.i32 v2, v3
|
||||
return v4
|
||||
}
|
||||
Reference in New Issue
Block a user