Skip to content

Commit

Permalink
jumpthreading: Resolve alias on blockcalls
Browse files Browse the repository at this point in the history
  • Loading branch information
afonso360 committed Jul 8, 2024
1 parent e09ca8b commit 672f2fa
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions cranelift/codegen/src/jump_threading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ impl JumpThreadAction {
// Prepare a set of values that we will replace the old block call with.
let new_target_values: Vec<_> = new_target_values
.into_iter()
.map(|val| jt.func.dfg.resolve_aliases(val))
.map(|val| block_to_call_map[&val])
.collect();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
test jump-threading precise-output
target x86_64

function u1:0() -> i64, i64 sext, i32 sext, i8 sext, i16x8, i64 sext, i16x8, i16x8, i16x8, i16x8 fast {
const0 = 0x00000000000000000000000000000000

block0:
v0 = vconst.i16x8 const0
v6 = iconst.i32 0
v7 = iconst.i8 0
v14 = iconst.i64 0
v60 = vconst.i16x8 const0
v68 = iconst.i32 0
br_table v6, block1, [block2, block2, block1, block1, block4(v0), block4(v0), block4(v0), block4(v0), block4(v0), block4(v0), block4(v0), block4(v0), block4(v0), block4(v0), block4(v0), block4(v0)]

block1 cold:
trap user0

block2 cold:
v28 = vconst.i16x8 const0
v44 -> v28
jump block4(v44)

block4(v45: i16x8) cold:
return v14, v14, v68, v7, v60, v14, v60, v60, v60, v60
}

; function u1:0() -> i64, i64 sext, i32 sext, i8 sext, i16x8, i64 sext, i16x8, i16x8, i16x8, i16x8 fast {
; const0 = 0x00000000000000000000000000000000
;
; block0:
; v0 = vconst.i16x8 const0
; v6 = iconst.i32 0
; v7 = iconst.i8 0
; v14 = iconst.i64 0
; v60 = vconst.i16x8 const0
; v68 = iconst.i32 0
; v69 = vconst.i16x8 const0
; v45 -> v69
; return v14, v14, v68, v7, v60, v14, v60, v60, v60, v60 ; v14 = 0, v14 = 0, v68 = 0, v7 = 0, v60 = const0, v14 = 0, v60 = const0, v60 = const0, v60 = const0, v60 = const0
; }

0 comments on commit 672f2fa

Please sign in to comment.