* Cranelift: remove non-egraphs optimization pipeline and `use_egraphs` option. This PR removes the LICM, GVN, and preopt passes, and associated support pieces, from `cranelift-codegen`. Not to worry, we still have optimizations: the egraph framework subsumes all of these, and has been on by default since #5181. A few decision points: - Filetests for the legacy LICM, GVN and simple_preopt were removed too. As we built optimizations in the egraph framework we wrote new tests for the equivalent functionality, and many of the old tests were testing specific behaviors in the old implementations that may not be relevant anymore. However if folks prefer I could take a different approach here and try to port over all of the tests. - The corresponding filetest modes (commands) were deleted too. The `test alias_analysis` mode remains, but no longer invokes a separate GVN first (since there is no separate GVN that will not also do alias analysis) so the tests were tweaked slightly to work with that. The egrpah testsuite also covers alias analysis. - The `divconst_magic_numbers` module is removed since it's unused without `simple_preopt`, though this is the one remaining optimization we still need to build in the egraphs framework, pending #5908. The magic numbers will live forever in git history so removing this in the meantime is not a major issue IMHO. - The `use_egraphs` setting itself was removed at both the Cranelift and Wasmtime levels. It has been marked deprecated for a few releases now (Wasmtime 6.0, 7.0, upcoming 8.0, and corresponding Cranelift versions) so I think this is probably OK. As an alternative if anyone feels strongly, we could leave the setting and make it a no-op. * Update test outputs for remaining test differences.
157 lines
2.5 KiB
Plaintext
157 lines
2.5 KiB
Plaintext
test compile precise-output
|
|
set unwind_info=false
|
|
target riscv64
|
|
|
|
function %f(i8, i64, i64) -> i64 {
|
|
block0(v0: i8, v1: i64, v2: i64):
|
|
v3 = iconst.i8 42
|
|
v4 = icmp eq v0, v3
|
|
v5 = select.i64 v4, v1, v2
|
|
return v5
|
|
}
|
|
|
|
; VCode:
|
|
; block0:
|
|
; li a4,42
|
|
; andi a3,a0,255
|
|
; andi a4,a4,255
|
|
; select_reg a0,a1,a2##condition=(a3 eq a4)
|
|
; ret
|
|
;
|
|
; Disassembled:
|
|
; block0: ; offset 0x0
|
|
; addi a4, zero, 0x2a
|
|
; andi a3, a0, 0xff
|
|
; andi a4, a4, 0xff
|
|
; beq a3, a4, 0xc
|
|
; ori a0, a2, 0
|
|
; j 8
|
|
; ori a0, a1, 0
|
|
; ret
|
|
|
|
function %g(i8) -> i8 {
|
|
block0(v0: i8):
|
|
v3 = iconst.i8 42
|
|
v4 = icmp eq v0, v3
|
|
return v4
|
|
}
|
|
|
|
; VCode:
|
|
; block0:
|
|
; li a2,42
|
|
; andi a0,a0,255
|
|
; andi a2,a2,255
|
|
; eq a0,a0,a2##ty=i8
|
|
; ret
|
|
;
|
|
; Disassembled:
|
|
; block0: ; offset 0x0
|
|
; addi a2, zero, 0x2a
|
|
; andi a0, a0, 0xff
|
|
; andi a2, a2, 0xff
|
|
; bne a0, a2, 0xc
|
|
; addi a0, zero, 1
|
|
; j 8
|
|
; mv a0, zero
|
|
; ret
|
|
|
|
function %h(i8, i8, i8) -> i8 {
|
|
block0(v0: i8, v1: i8, v2: i8):
|
|
v3 = bitselect.i8 v0, v1, v2
|
|
return v3
|
|
}
|
|
|
|
; VCode:
|
|
; block0:
|
|
; and a1,a0,a1
|
|
; not a3,a0
|
|
; and a5,a3,a2
|
|
; or a0,a1,a5
|
|
; ret
|
|
;
|
|
; Disassembled:
|
|
; block0: ; offset 0x0
|
|
; and a1, a0, a1
|
|
; not a3, a0
|
|
; and a5, a3, a2
|
|
; or a0, a1, a5
|
|
; ret
|
|
|
|
function %i(i8, i8, i8) -> i8 {
|
|
block0(v0: i8, v1: i8, v2: i8):
|
|
v3 = select.i8 v0, v1, v2
|
|
return v3
|
|
}
|
|
|
|
; VCode:
|
|
; block0:
|
|
; andi a3,a0,255
|
|
; select_i8 a0,a1,a2##condition=a3
|
|
; ret
|
|
;
|
|
; Disassembled:
|
|
; block0: ; offset 0x0
|
|
; andi a3, a0, 0xff
|
|
; beqz a3, 0xc
|
|
; ori a0, a1, 0
|
|
; j 8
|
|
; ori a0, a2, 0
|
|
; ret
|
|
|
|
function %i(i32, i8, i8) -> i8 {
|
|
block0(v0: i32, v1: i8, v2: i8):
|
|
v3 = iconst.i32 42
|
|
v4 = icmp.i32 eq v0, v3
|
|
v5 = select.i8 v4, v1, v2
|
|
return v5
|
|
}
|
|
|
|
; VCode:
|
|
; block0:
|
|
; li a6,42
|
|
; slli a3,a0,32
|
|
; srli a4,a3,32
|
|
; slli a6,a6,32
|
|
; srli t3,a6,32
|
|
; select_reg a0,a1,a2##condition=(a4 eq t3)
|
|
; ret
|
|
;
|
|
; Disassembled:
|
|
; block0: ; offset 0x0
|
|
; addi a6, zero, 0x2a
|
|
; slli a3, a0, 0x20
|
|
; srli a4, a3, 0x20
|
|
; slli a6, a6, 0x20
|
|
; srli t3, a6, 0x20
|
|
; beq a4, t3, 0xc
|
|
; ori a0, a2, 0
|
|
; j 8
|
|
; ori a0, a1, 0
|
|
; ret
|
|
|
|
function %i128_select(i8, i128, i128) -> i128 {
|
|
block0(v0: i8, v1: i128, v2: i128):
|
|
v3 = select.i128 v0, v1, v2
|
|
return v3
|
|
}
|
|
|
|
; VCode:
|
|
; block0:
|
|
; mv a7,a1
|
|
; andi a5,a0,255
|
|
; select_i128 [a0,a1],[a7,a2],[a3,a4]##condition=a5
|
|
; ret
|
|
;
|
|
; Disassembled:
|
|
; block0: ; offset 0x0
|
|
; ori a7, a1, 0
|
|
; andi a5, a0, 0xff
|
|
; beqz a5, 0x10
|
|
; ori a0, a7, 0
|
|
; ori a1, a2, 0
|
|
; j 0xc
|
|
; ori a0, a3, 0
|
|
; ori a1, a4, 0
|
|
; ret
|
|
|