Disallow branching to the entry block.
Functions that would otherwise start with a loop should start with a separate ebb which just branches to the header of the loop.
This commit is contained in:
@@ -2,30 +2,33 @@ test licm
|
||||
|
||||
function %simple_loop(i32) -> i32 {
|
||||
|
||||
ebb1(v0: i32):
|
||||
v1 = iconst.i32 1
|
||||
v2 = iconst.i32 2
|
||||
v3 = iadd v1, v2
|
||||
brz v0, ebb2(v0)
|
||||
v4 = isub v0, v1
|
||||
jump ebb1(v4)
|
||||
ebb0(v0: i32):
|
||||
jump ebb1(v0)
|
||||
|
||||
ebb2(v5: i32):
|
||||
return v5
|
||||
ebb1(v1: i32):
|
||||
v2 = iconst.i32 1
|
||||
v3 = iconst.i32 2
|
||||
v4 = iadd v2, v3
|
||||
brz v1, ebb2(v1)
|
||||
v5 = isub v1, v2
|
||||
jump ebb1(v5)
|
||||
|
||||
ebb2(v6: i32):
|
||||
return v6
|
||||
|
||||
}
|
||||
; sameln: function %simple_loop
|
||||
; nextln: ebb2(v6: i32):
|
||||
; nextln: v1 = iconst.i32 1
|
||||
; nextln: v2 = iconst.i32 2
|
||||
; nextln: v3 = iadd v1, v2
|
||||
; nextln: jump ebb0(v6)
|
||||
; nextln:
|
||||
; nextln: ebb0(v0: i32):
|
||||
; nextln: brz v0, ebb1(v0)
|
||||
; nextln: v4 = isub v0, v1
|
||||
; nextln: jump ebb0(v4)
|
||||
; nextln: v2 = iconst.i32 1
|
||||
; nextln: v3 = iconst.i32 2
|
||||
; nextln: v4 = iadd v2, v3
|
||||
; nextln: jump ebb1(v0)
|
||||
; nextln:
|
||||
; nextln: ebb1(v5: i32):
|
||||
; nextln: return v5
|
||||
; nextln: ebb1(v1: i32):
|
||||
; nextln: brz v1, ebb2(v1)
|
||||
; nextln: v5 = isub v1, v2
|
||||
; nextln: jump ebb1(v5)
|
||||
; nextln:
|
||||
; nextln: ebb2(v6: i32):
|
||||
; nextln: return v6
|
||||
; nextln: }
|
||||
|
||||
Reference in New Issue
Block a user