Simplify branch arguments after splitting EBB arguments.

The EBB argument splitting may generate concat-split dependencies when
it repairs branch arguments in EBBs that have not yet been fully
legalized. Add a branch argument simplification step that can resolve
these dependency chains.

This means that all split and concatenation instructions will be dead
after legalization for types that have no legal instructions using them.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-22 15:26:06 -07:00
parent 07740b5e3c
commit 12b2af3f8a
4 changed files with 86 additions and 5 deletions

View File

@@ -36,7 +36,8 @@ ebb0:
; check: $(v1new=$V) = iconcat $v1l, $v1h
; check: $v1 = copy $v1new
jump ebb1(v1)
; check: jump $ebb1($v1)
; The v1 copy gets resolved by split::simplify_branch_arguments().
; check: jump $ebb1($v1new)
ebb1(v10: i64):
jump ebb1(v10)
@@ -50,9 +51,9 @@ ebb0:
; check: $ebb0:
; nextln: $v1, $(v2l=$V), $(v2h=$V) = call $fn1()
; check: $(v2new=$V) = iconcat $v2l, $v2h
; check: $v2 -> $v2new
jump ebb1(v1, v2)
; check: jump $ebb1($v1, $v2)
; The v2 -> v2new alias is resolved by split::simplify_branch_arguments().
; check: jump $ebb1($v1, $v2new)
ebb1(v9: i32, v10: i64):
jump ebb1(v9, v10)
@@ -78,7 +79,8 @@ ebb0:
; check: $(v1new=$V) = ireduce.i8 $rv
; check: $v1 = copy $v1new
jump ebb1(v1)
; check: jump $ebb1($v1)
; The v1 copy gets resolved by split::simplify_branch_arguments().
; check: jump $ebb1($v1new)
ebb1(v10: i8):
jump ebb1(v10)

View File

@@ -38,3 +38,18 @@ ebb3(v4: i64):
return v5
; check: return $v5l, $v5h
}
function loop(i64, i64) -> i64 {
ebb0(v1: i64, v2: i64):
; check: $ebb0($(v1l=$V): i32, $(v1h=$V): i32, $(v2l=$V): i32, $(v2h=$V): i32):
jump ebb1(v1)
; check: jump $ebb1($v1l, $v1h)
ebb1(v3: i64):
; check: $ebb1($(v3l=$V): i32, $(v3h=$V): i32):
v4 = band v3, v2
; check: $(v4l=$V) = band $v3l, $v2l
; check: $(v4h=$V) = band $v3h, $v2h
jump ebb1(v4)
; check: jump $ebb1($v4l, $v4h)
}