Commit b9bb4e8
Only emit value label aliases for lowered instructions (bytecodealliance#12779)
If we emit a value label alias for an instruction that isn't lowered,
then that signals that the value has been optimised out. However, since
it is an alias we know that the value also exists in an earlier vreg, so
we should skip the alias and use that instead.
This situation occurs often for memory indexes on AArch64. We translate
memory stores into instructions such as:
v8 = iconst.i32 42
v9 = uextend.i64 v6
v10 = load.i64 notrap aligned readonly can_move checked v0+56
v11 = iadd v10, v9
v12 = iconst.i64 20
v13 = iadd v11, v12 ; v12 = 20
store little heap v8, v13 ; v8 = 42
Here, v6 is a memory index (which has a label) and v9 is an
extension of the memory index (which has a label alias, added by
cast_index_to_pointer_ty()). This is lowered to:
40c: 52800540 mov w0, #0x2a // bytecodealliance#42
410: f9401c41 ldr x1, [x2, bytecodealliance#56]
414: 91005021 add x1, x1, #0x14
418: b8384820 str w0, [x1, w24, uxtw]
The uextend has been folded into the str, so v9 has been optimised
out. But v6 is still present in w24, so the debuginfo should use that
instead.
This fixes the following tests for AArch64:
native_debug::lldb::dwarf_cold_block
native_debug::lldb::dwarf_fib_wasm
native_debug::lldb::dwarf_fib_wasm_dwarf5
native_debug::lldb::dwarf_fib_wasm_split4
native_debug::lldb::dwarf_fission
native_debug::lldb::dwarf_fraction_norm
native_debug::lldb::dwarf_imported_memory
native_debug::lldb::dwarf_shared_memory
native_debug::lldb::dwarf_simple
native_debug::lldb::dwarf_spilled_frame_base1 parent 4321e38 commit b9bb4e8
1 file changed
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
802 | 802 | | |
803 | 803 | | |
804 | 804 | | |
805 | | - | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
806 | 808 | | |
807 | 809 | | |
808 | 810 | | |
| |||
949 | 951 | | |
950 | 952 | | |
951 | 953 | | |
952 | | - | |
| 954 | + | |
953 | 955 | | |
954 | 956 | | |
955 | 957 | | |
956 | 958 | | |
957 | 959 | | |
958 | 960 | | |
959 | | - | |
| 961 | + | |
960 | 962 | | |
961 | 963 | | |
962 | 964 | | |
| |||
971 | 973 | | |
972 | 974 | | |
973 | 975 | | |
974 | | - | |
| 976 | + | |
975 | 977 | | |
976 | 978 | | |
977 | 979 | | |
| |||
982 | 984 | | |
983 | 985 | | |
984 | 986 | | |
985 | | - | |
| 987 | + | |
986 | 988 | | |
987 | 989 | | |
988 | 990 | | |
| |||
993 | 995 | | |
994 | 996 | | |
995 | 997 | | |
996 | | - | |
| 998 | + | |
997 | 999 | | |
998 | 1000 | | |
999 | 1001 | | |
| |||
0 commit comments