Files
wasmtime/cranelift/filetests/licm/critical-edge.clif
Dan Gohman 0fed78e063 Don't allow loop preheaders to have critical edges.
If the block which would be a preheader for a loop has other successors,
don't hoist instructions into it. Instead create a dedicated preheader.
2018-11-16 10:27:24 +01:00

43 lines
973 B
Plaintext

test licm
target riscv32
; The loop in this function is entered from a critical edge.
function %critical_edge(i32, i32) -> i32 {
ebb0(v0: i32, v7: i32):
[SBzero#38] brnz v7, ebb1(v0)
[Iret#19] return v0
ebb1(v1: i32):
v2 = iconst.i32 1
v3 = iconst.i32 2
v4 = iadd v2, v3
[SBzero#18] brz v1, ebb2(v1)
v5 = isub v1, v2
[UJ#1b] jump ebb1(v5)
ebb2(v6: i32):
[Iret#19] return v6
}
; sameln: function %critical_edge
; nextln: ebb0(v0: i32, v7: i32):
; nextln: brnz v7, ebb3(v0)
; nextln: return v0
; nextln:
; nextln: ebb3(v8: i32):
; nextln: v2 = iconst.i32 1
; nextln: v3 = iconst.i32 2
; nextln: v4 = iadd v2, v3
; nextln: jump ebb1(v8)
; nextln:
; 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: }