Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cranelift/codegen/src/egraph/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ where
// infinite or problematic recursion, we bound the rewrite
// depth to a small constant here.
const REWRITE_LIMIT: usize = 5;
if ctx.rewrite_depth > REWRITE_LIMIT {
if ctx.rewrite_depth >= REWRITE_LIMIT {
ctx.stats.rewrite_depth_limit += 1;
return orig_value;
}
Expand Down
16 changes: 8 additions & 8 deletions cranelift/filetests/filetests/egraph/cprop.clif
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,10 @@ block0(v0: i32, v1: i32):
return v7
}

; check: v15 = iconst.i32 333
; check: v19 = iadd v1, v15
; check: v20 = icmp eq v0, v19
; nextln: return v20
; check: v16 = iconst.i32 333
; check: v18 = iadd v1, v16
; check: v19 = icmp eq v0, v18
; nextln: return v19

function %icmp_subs_const_addends(i32, i32) -> i8 {
block0(v0: i32, v1: i32):
Expand All @@ -364,10 +364,10 @@ block0(v0: i32, v1: i32):
return v7
}

; check: v47 = iconst.i32 333
; check: v49 = iadd v0, v47
; check: v50 = icmp eq v1, v49
; nextln: return v50
; check: v40 = iconst.i32 333
; check: v44 = iadd v0, v40
; check: v45 = icmp eq v1, v44
; nextln: return v45

function %ireduce_iconst() -> i8 {
block0:
Expand Down
4 changes: 2 additions & 2 deletions cranelift/filetests/filetests/egraph/i128-opts.clif
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ block0:
v4 = bor v1, v3
return v4
; check: v6 = iconst.i32 13
; check: v12 = uextend.i128 v6 ; v6 = 13
; check: return v12
; check: v11 = uextend.i128 v6 ; v6 = 13
; check: return v11
}

;; These are big enough that they overflow u64, so should not be collapsed
Expand Down
8 changes: 4 additions & 4 deletions cranelift/filetests/filetests/egraph/remat.clif
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ block2:
; check: brif v2, block1, block2
; check: block1:
; check: v6 = iconst.i32 126
; check: v12 = iadd.i32 v0, v6
; check: return v12
; check: v11 = iadd.i32 v0, v6
; check: return v11
; check: block2:
; check: v14 = iadd.i32 v0, v1
; check: return v14
; check: v13 = iadd.i32 v0, v1
; check: return v13
16 changes: 8 additions & 8 deletions cranelift/filetests/filetests/egraph/shifts.clif
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,8 @@ block0(v0: i8):
}

; check: v6 = iconst.i8 2
; check: v12 = rotr v0, v6 ; v6 = 2
; check: return v12
; check: v11 = rotr v0, v6 ; v6 = 2
; check: return v11

function %rotr_rotr_add(i8, i8, i8) -> i8 {
block0(v0: i8, v1: i8, v2: i8):
Expand All @@ -676,8 +676,8 @@ block0(v0: i8):
}

; check: v6 = iconst.i8 2
; check: v12 = rotl v0, v6 ; v6 = 2
; check: return v12
; check: v11 = rotl v0, v6 ; v6 = 2
; check: return v11

function %rotl_rotl_add(i8, i8, i8) -> i8 {
block0(v0: i8, v1: i8, v2: i8):
Expand All @@ -701,8 +701,8 @@ block0(v0: i8):
}

; check: v2 = iconst.i8 1
; check: v15 = rotr v0, v2 ; v2 = 1
; check: return v15
; check: v14 = rotr v0, v2 ; v2 = 1
; check: return v14

function %rotl_rotr_add(i8, i8, i8) -> i8 {
block0(v0: i8, v1: i8, v2: i8):
Expand All @@ -725,8 +725,8 @@ block0(v0: i8):
}

; check: v2 = iconst.i8 1
; check: v15 = rotl v0, v2 ; v2 = 1
; check: return v15
; check: v14 = rotl v0, v2 ; v2 = 1
; check: return v14

function %rotl_rotr_add(i8, i8, i8) -> i8 {
block0(v0: i8, v1: i8, v2: i8):
Expand Down
19 changes: 9 additions & 10 deletions cranelift/filetests/filetests/egraph/skeleton.clif
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ block0:

; function %cprop_udiv() -> i32 fast {
; block0:
; v18 = iconst.i32 1
; v2 -> v18
; return v18 ; v18 = 1
; v16 = iconst.i32 1
; v2 -> v16
; return v16 ; v16 = 1
; }

function %cprop_urem() -> i32 {
Expand All @@ -105,9 +105,9 @@ block0:

; function %cprop_urem() -> i32 fast {
; block0:
; v37 = iconst.i32 6
; v2 -> v37
; return v37 ; v37 = 6
; v33 = iconst.i32 6
; v2 -> v33
; return v33 ; v33 = 6
; }

function %cprop_sdiv() -> i32 {
Expand Down Expand Up @@ -181,12 +181,11 @@ block0:

; function %cprop_srem() -> i32 fast {
; block0:
; v28 = iconst.i32 -3
; v2 -> v28
; return v28 ; v28 = -3
; v26 = iconst.i32 -3
; v2 -> v26
; return v26 ; v26 = -3
; }


function %udiv_by_one(i32) -> i32 {
block0(v0: i32):
v1 = iconst.i32 1
Expand Down
18 changes: 9 additions & 9 deletions tests/disas/component-model/direct-adapter-calls-inlining.wat
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@
;; v24 = iconst.i32 -2
;; v25 = band v23, v24 ; v24 = -2
;; store notrap aligned table v25, v22
;; v56 = iconst.i32 1
;; v57 = bor v23, v56 ; v56 = 1
;; store notrap aligned table v57, v22
;; v55 = iconst.i32 1
;; v56 = bor v23, v55 ; v55 = 1
;; store notrap aligned table v56, v22
;; jump block6
;;
;; block6:
Expand All @@ -115,12 +115,12 @@
;;
;; block8:
;; v36 = load.i32 notrap aligned table v12
;; v58 = iconst.i32 -2
;; v59 = band v36, v58 ; v58 = -2
;; store notrap aligned table v59, v12
;; v60 = iconst.i32 1
;; v61 = bor v36, v60 ; v60 = 1
;; store notrap aligned table v61, v12
;; v57 = iconst.i32 -2
;; v58 = band v36, v57 ; v57 = -2
;; store notrap aligned table v58, v12
;; v59 = iconst.i32 1
;; v60 = bor v36, v59 ; v59 = 1
;; store notrap aligned table v60, v12
;; jump block3
;;
;; block3:
Expand Down
4 changes: 2 additions & 2 deletions tests/disas/component-model/inlining-fuzz-bug.wat
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@
;; @00c6 jump block1
;;
;; block1:
;; v26 = iconst.i32 301
;; @00c6 return v26 ; v26 = 301
;; v25 = iconst.i32 301
;; @00c6 return v25 ; v25 = 301
;; }
64 changes: 32 additions & 32 deletions tests/disas/gc/drc/array-new-fixed-of-gc-refs.wat
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
;; @0025 v14 = iconst.i32 -1476395008
;; @0025 v16 = load.i64 notrap aligned readonly can_move v0+40
;; @0025 v17 = load.i32 notrap aligned readonly can_move v16
;; v150 = iconst.i32 40
;; v149 = iconst.i32 40
;; @0025 v18 = iconst.i32 8
;; @0025 v19 = call fn0(v0, v14, v17, v150, v18), stack_map=[i32 @ ss2+0, i32 @ ss1+0, i32 @ ss0+0] ; v14 = -1476395008, v150 = 40, v18 = 8
;; @0025 v19 = call fn0(v0, v14, v17, v149, v18), stack_map=[i32 @ ss2+0, i32 @ ss1+0, i32 @ ss0+0] ; v14 = -1476395008, v149 = 40, v18 = 8
;; @0025 v6 = iconst.i32 3
;; @0025 v131 = load.i64 notrap aligned readonly can_move v0+8
;; @0025 v20 = load.i64 notrap aligned readonly can_move v131+32
Expand All @@ -57,8 +57,8 @@
;; block2:
;; @0025 v32 = uextend.i64 v93
;; @0025 v34 = iadd.i64 v20, v32
;; v168 = iconst.i64 8
;; @0025 v36 = iadd v34, v168 ; v168 = 8
;; v165 = iconst.i64 8
;; @0025 v36 = iadd v34, v165 ; v165 = 8
;; @0025 v37 = load.i64 notrap aligned v36
;; v98 = iconst.i64 1
;; @0025 v38 = iadd v37, v98 ; v98 = 1
Expand All @@ -67,59 +67,59 @@
;;
;; block3:
;; v89 = load.i32 notrap v137
;; v152 = iconst.i64 28
;; v158 = iadd.i64 v22, v152 ; v152 = 28
;; @0025 store notrap aligned little v89, v158
;; v151 = iconst.i64 28
;; v156 = iadd.i64 v22, v151 ; v151 = 28
;; @0025 store notrap aligned little v89, v156
;; v88 = load.i32 notrap v136
;; v258 = iconst.i32 1
;; v259 = band v88, v258 ; v258 = 1
;; v260 = iconst.i32 0
;; v261 = icmp eq v88, v260 ; v260 = 0
;; @0025 v47 = uextend.i32 v261
;; @0025 v48 = bor v259, v47
;; v243 = iconst.i32 1
;; v244 = band v88, v243 ; v243 = 1
;; v245 = iconst.i32 0
;; v246 = icmp eq v88, v245 ; v245 = 0
;; @0025 v47 = uextend.i32 v246
;; @0025 v48 = bor v244, v47
;; @0025 brif v48, block5, block4
;;
;; block4:
;; @0025 v49 = uextend.i64 v88
;; @0025 v51 = iadd.i64 v20, v49
;; v262 = iconst.i64 8
;; @0025 v53 = iadd v51, v262 ; v262 = 8
;; v247 = iconst.i64 8
;; @0025 v53 = iadd v51, v247 ; v247 = 8
;; @0025 v54 = load.i64 notrap aligned v53
;; v263 = iconst.i64 1
;; @0025 v55 = iadd v54, v263 ; v263 = 1
;; v248 = iconst.i64 1
;; @0025 v55 = iadd v54, v248 ; v248 = 1
;; @0025 store notrap aligned v55, v53
;; @0025 jump block5
;;
;; block5:
;; v84 = load.i32 notrap v136
;; v133 = iconst.i64 32
;; v166 = iadd.i64 v22, v133 ; v133 = 32
;; @0025 store notrap aligned little v84, v166
;; v163 = iadd.i64 v22, v133 ; v133 = 32
;; @0025 store notrap aligned little v84, v163
;; v83 = load.i32 notrap v135
;; v264 = iconst.i32 1
;; v265 = band v83, v264 ; v264 = 1
;; v266 = iconst.i32 0
;; v267 = icmp eq v83, v266 ; v266 = 0
;; @0025 v64 = uextend.i32 v267
;; @0025 v65 = bor v265, v64
;; v249 = iconst.i32 1
;; v250 = band v83, v249 ; v249 = 1
;; v251 = iconst.i32 0
;; v252 = icmp eq v83, v251 ; v251 = 0
;; @0025 v64 = uextend.i32 v252
;; @0025 v65 = bor v250, v64
;; @0025 brif v65, block7, block6
;;
;; block6:
;; @0025 v66 = uextend.i64 v83
;; @0025 v68 = iadd.i64 v20, v66
;; v268 = iconst.i64 8
;; @0025 v70 = iadd v68, v268 ; v268 = 8
;; v253 = iconst.i64 8
;; @0025 v70 = iadd v68, v253 ; v253 = 8
;; @0025 v71 = load.i64 notrap aligned v70
;; v269 = iconst.i64 1
;; @0025 v72 = iadd v71, v269 ; v269 = 1
;; v254 = iconst.i64 1
;; @0025 v72 = iadd v71, v254 ; v254 = 1
;; @0025 store notrap aligned v72, v70
;; @0025 jump block7
;;
;; block7:
;; v79 = load.i32 notrap v135
;; v184 = iconst.i64 36
;; v190 = iadd.i64 v22, v184 ; v184 = 36
;; @0025 store notrap aligned little v79, v190
;; v179 = iconst.i64 36
;; v184 = iadd.i64 v22, v179 ; v179 = 36
;; @0025 store notrap aligned little v79, v184
;; @0029 jump block1
;;
;; block1:
Expand Down
20 changes: 10 additions & 10 deletions tests/disas/gc/drc/array-new-fixed.wat
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
;; @0025 v14 = iconst.i32 -1476395008
;; @0025 v16 = load.i64 notrap aligned readonly can_move v0+40
;; @0025 v17 = load.i32 notrap aligned readonly can_move v16
;; v47 = iconst.i32 56
;; v46 = iconst.i32 56
;; @0025 v18 = iconst.i32 8
;; @0025 v19 = call fn0(v0, v14, v17, v47, v18) ; v14 = -1476395008, v47 = 56, v18 = 8
;; @0025 v19 = call fn0(v0, v14, v17, v46, v18) ; v14 = -1476395008, v46 = 56, v18 = 8
;; @0025 v6 = iconst.i32 3
;; @0025 v32 = load.i64 notrap aligned readonly can_move v0+8
;; @0025 v20 = load.i64 notrap aligned readonly can_move v32+32
Expand All @@ -36,14 +36,14 @@
;; @0025 v23 = iadd v22, v37 ; v37 = 24
;; @0025 store notrap aligned v6, v23 ; v6 = 3
;; v34 = iconst.i64 32
;; v54 = iadd v22, v34 ; v34 = 32
;; @0025 store notrap aligned little v2, v54
;; v57 = iconst.i64 40
;; v63 = iadd v22, v57 ; v57 = 40
;; @0025 store notrap aligned little v3, v63
;; v81 = iconst.i64 48
;; v87 = iadd v22, v81 ; v81 = 48
;; @0025 store notrap aligned little v4, v87
;; v52 = iadd v22, v34 ; v34 = 32
;; @0025 store notrap aligned little v2, v52
;; v55 = iconst.i64 40
;; v60 = iadd v22, v55 ; v55 = 40
;; @0025 store notrap aligned little v3, v60
;; v76 = iconst.i64 48
;; v81 = iadd v22, v76 ; v76 = 48
;; @0025 store notrap aligned little v4, v81
;; @0029 jump block1
;;
;; block1:
Expand Down
10 changes: 5 additions & 5 deletions tests/disas/gc/drc/array-new.wat
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,21 @@
;; v32 = iconst.i64 24
;; @0022 v21 = iadd v20, v32 ; v32 = 24
;; @0022 store notrap aligned v3, v21
;; v54 = iadd v20, v35 ; v35 = 32
;; v53 = iadd v20, v35 ; v35 = 32
;; @0022 v27 = uextend.i64 v10
;; @0022 v28 = iadd v20, v27
;; v36 = iconst.i64 8
;; @0022 jump block2(v54)
;; @0022 jump block2(v53)
;;
;; block2(v29: i64):
;; @0022 v30 = icmp eq v29, v28
;; @0022 brif v30, block4, block3
;;
;; block3:
;; @0022 store.i64 notrap aligned little v2, v29
;; v59 = iconst.i64 8
;; v60 = iadd.i64 v29, v59 ; v59 = 8
;; @0022 jump block2(v60)
;; v58 = iconst.i64 8
;; v59 = iadd.i64 v29, v58 ; v58 = 8
;; @0022 jump block2(v59)
;;
;; block4:
;; @0025 jump block1
Expand Down
4 changes: 2 additions & 2 deletions tests/disas/gc/drc/externref-globals.wat
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
;; @003b v29 = iconst.i64 8
;; @003b v14 = iadd v12, v29 ; v29 = 8
;; @003b v15 = load.i64 notrap aligned v14
;; v64 = iconst.i64 1
;; @003b v16 = iadd v15, v64 ; v64 = 1
;; v63 = iconst.i64 1
;; @003b v16 = iadd v15, v63 ; v63 = 1
;; @003b store notrap aligned v16, v14
;; @003b jump block3
;;
Expand Down
4 changes: 2 additions & 2 deletions tests/disas/gc/drc/struct-new-default.wat
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@
;; @0021 jump block3
;;
;; block3:
;; v68 = iconst.i32 0
;; v65 = iconst.i32 0
;; v43 = iconst.i64 32
;; @0021 v19 = iadd.i64 v16, v43 ; v43 = 32
;; @0021 store notrap aligned little v68, v19 ; v68 = 0
;; @0021 store notrap aligned little v65, v19 ; v65 = 0
;; @0024 jump block1
;;
;; block1:
Expand Down
4 changes: 2 additions & 2 deletions tests/disas/gc/drc/struct-set.wat
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
;; @004a v33 = iconst.i64 8
;; @004a v18 = iadd v16, v33 ; v33 = 8
;; @004a v19 = load.i64 notrap aligned v18
;; v69 = iconst.i64 1
;; @004a v20 = iadd v19, v69 ; v69 = 1
;; v68 = iconst.i64 1
;; @004a v20 = iadd v19, v68 ; v68 = 1
;; @004a store notrap aligned v20, v18
;; @004a jump block3
;;
Expand Down
Loading
Loading