Skip to content

Commit 938c1ea

Browse files
committed
Use cfg_live walk in codegen scheduling
Once again, the goal is to make sure that phi inputs from dead regions aren't followed at all. This caused a fair bit of churn in codegen tests because the scheduling of "root" floating nodes (i.e., constants and stack slots) changed a bit, and the resulting side effects cascaded pretty far. There shouldn't be any meaningful codegen changes, though.
1 parent 4a36468 commit 938c1ea

29 files changed

+3835
-3837
lines changed

crates/codegen/src/schedule.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ impl Schedule {
5252
cfg_ctx: &CfgContext,
5353
block_map: &FunctionBlockMap,
5454
) -> Self {
55-
let entry = valgraph_cfg_preorder.preorder[0];
56-
let walk_info = GraphWalkInfo::compute_full(graph, entry);
57-
55+
let walk_info = GraphWalkInfo::compute_cfg_live(graph, valgraph_cfg_preorder);
5856
let ctx = ScheduleContext::new(graph, &walk_info, &valgraph_cfg_preorder.preorder);
5957

6058
let mut schedule = Self {

crates/filetests/cases/codegen/tdn/array_jagged.spdr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ func @"System.Int32 Tests.CodeGenBringUpTests::ArrayJagged(System.Int32)":i32(i3
5050
# nextln: 000034: 48 89 d1 mov rcx, rdx
5151
# nextln: 000037: be 18 00 00 00 mov esi, 0x18
5252
# nextln: 00003c: 48 03 f0 add rsi, rax
53-
# nextln: 00003f: 41 bc 01 00 00 00 mov r12d, 1
54-
# nextln: 000045: 48 89 cb mov rbx, rcx
55-
# nextln: 000048: 4d 63 ec movsxd r13, r12d
56-
# nextln: 00004b: bf ab 00 00 00 mov edi, 0xab
57-
# nextln: 000050: e8 00 00 00 00 call 0x55 # RELOC_PC32 -> @gc_new + -4
53+
# nextln: 00003f: 48 89 cb mov rbx, rcx
54+
# nextln: 000042: bf ab 00 00 00 mov edi, 0xab
55+
# nextln: 000047: e8 00 00 00 00 call 0x4c # RELOC_PC32 -> @gc_new + -4
56+
# nextln: 00004c: 41 bc 01 00 00 00 mov r12d, 1
57+
# nextln: 000052: 4d 63 ec movsxd r13, r12d
5858
# nextln: 000055: 44 89 70 10 mov dword ptr [rax + 0x10], r14d
5959
# nextln: 000059: 48 89 04 24 mov qword ptr [rsp], rax
6060
# nextln: 00005d: 4c 8b 3c 24 mov r15, qword ptr [rsp]

crates/filetests/cases/codegen/tdn/calc_loop_nest_2_canon.spdr

Lines changed: 105 additions & 105 deletions
Large diffs are not rendered by default.

crates/filetests/cases/codegen/tdn/calc_loop_nest_debug_canon.spdr

Lines changed: 230 additions & 230 deletions
Large diffs are not rendered by default.

crates/filetests/cases/codegen/tdn/int_no_op_sub_funclet_10_canon.spdr

Lines changed: 255 additions & 255 deletions
Large diffs are not rendered by default.

crates/filetests/cases/codegen/tdn/jtrue_ge.spdr

Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -6,113 +6,113 @@ func @"System.Int32 Tests.CodeGenBringUpTests::JTrueGeInt1(System.Int32)":i32(i3
66
# nextln: 000001: 48 89 e5 mov rbp, rsp
77
# nextln: 000004: 48 83 ec 10 sub rsp, 0x10
88
# nextln: 000008: 33 c0 xor eax, eax
9-
# nextln: 00000a: 89 44 24 04 mov dword ptr [rsp + 4], eax
10-
# nextln: 00000e: 88 44 24 08 mov byte ptr [rsp + 8], al
11-
# nextln: 000012: 88 44 24 0d mov byte ptr [rsp + 0xd], al
12-
# nextln: 000016: 88 44 24 09 mov byte ptr [rsp + 9], al
13-
# nextln: 00001a: 88 44 24 0e mov byte ptr [rsp + 0xe], al
14-
# nextln: 00001e: 88 44 24 0c mov byte ptr [rsp + 0xc], al
15-
# nextln: 000022: 88 44 24 0a mov byte ptr [rsp + 0xa], al
16-
# nextln: 000026: 88 44 24 0b mov byte ptr [rsp + 0xb], al
17-
# nextln: 00002a: 89 04 24 mov dword ptr [rsp], eax
9+
# nextln: 00000a: 89 04 24 mov dword ptr [rsp], eax
10+
# nextln: 00000d: 88 44 24 08 mov byte ptr [rsp + 8], al
11+
# nextln: 000011: 88 44 24 0d mov byte ptr [rsp + 0xd], al
12+
# nextln: 000015: 88 44 24 09 mov byte ptr [rsp + 9], al
13+
# nextln: 000019: 88 44 24 0e mov byte ptr [rsp + 0xe], al
14+
# nextln: 00001d: 88 44 24 0c mov byte ptr [rsp + 0xc], al
15+
# nextln: 000021: 88 44 24 0a mov byte ptr [rsp + 0xa], al
16+
# nextln: 000025: 88 44 24 0b mov byte ptr [rsp + 0xb], al
17+
# nextln: 000029: 89 44 24 04 mov dword ptr [rsp + 4], eax
1818
# nextln: 00002d: 33 c9 xor ecx, ecx
1919
# nextln: 00002f: 81 ff ff ff ff 7f cmp edi, 0x7fffffff
2020
# nextln: 000035: 0f 9c c1 setl cl
2121
# nextln: 000038: 33 c0 xor eax, eax
2222
# nextln: 00003a: 85 c9 test ecx, ecx
2323
# nextln: 00003c: 0f 94 c0 sete al
2424
# nextln: 00003f: b9 ff ff ff ff mov ecx, 0xffffffff
25-
# nextln: 000044: 89 4c 24 04 mov dword ptr [rsp + 4], ecx
26-
# nextln: 000048: 88 44 24 08 mov byte ptr [rsp + 8], al
27-
# nextln: 00004c: 0f b6 44 24 08 movzx eax, byte ptr [rsp + 8]
28-
# nextln: 000051: 85 c0 test eax, eax
29-
# nextln: 000053: 0f 84 0e 00 00 00 je 0x67
30-
# nextln: 000059: b8 07 00 00 00 mov eax, 7
31-
# nextln: 00005e: 89 44 24 04 mov dword ptr [rsp + 4], eax
32-
# nextln: 000062: e9 13 01 00 00 jmp 0x17a
33-
# nextln: 000067: 33 c0 xor eax, eax
34-
# nextln: 000069: 83 ff 02 cmp edi, 2
35-
# nextln: 00006c: 0f 9c c0 setl al
36-
# nextln: 00006f: 33 c9 xor ecx, ecx
37-
# nextln: 000071: 85 c0 test eax, eax
38-
# nextln: 000073: 0f 94 c1 sete cl
39-
# nextln: 000076: 88 4c 24 0d mov byte ptr [rsp + 0xd], cl
40-
# nextln: 00007a: 0f b6 44 24 0d movzx eax, byte ptr [rsp + 0xd]
41-
# nextln: 00007f: 85 c0 test eax, eax
42-
# nextln: 000081: 0f 84 0e 00 00 00 je 0x95
43-
# nextln: 000087: b8 06 00 00 00 mov eax, 6
44-
# nextln: 00008c: 89 44 24 04 mov dword ptr [rsp + 4], eax
45-
# nextln: 000090: e9 e5 00 00 00 jmp 0x17a
46-
# nextln: 000095: 33 c0 xor eax, eax
47-
# nextln: 000097: 85 ff test edi, edi
48-
# nextln: 000099: 0f 9e c0 setle al
49-
# nextln: 00009c: 33 c9 xor ecx, ecx
50-
# nextln: 00009e: 85 c0 test eax, eax
51-
# nextln: 0000a0: 0f 94 c1 sete cl
52-
# nextln: 0000a3: 88 4c 24 09 mov byte ptr [rsp + 9], cl
53-
# nextln: 0000a7: 0f b6 44 24 09 movzx eax, byte ptr [rsp + 9]
54-
# nextln: 0000ac: 85 c0 test eax, eax
55-
# nextln: 0000ae: 0f 84 0e 00 00 00 je 0xc2
56-
# nextln: 0000b4: b8 05 00 00 00 mov eax, 5
57-
# nextln: 0000b9: 89 44 24 04 mov dword ptr [rsp + 4], eax
58-
# nextln: 0000bd: e9 b8 00 00 00 jmp 0x17a
59-
# nextln: 0000c2: 33 c0 xor eax, eax
60-
# nextln: 0000c4: 85 ff test edi, edi
61-
# nextln: 0000c6: 0f 98 c0 sets al
62-
# nextln: 0000c9: 33 c9 xor ecx, ecx
63-
# nextln: 0000cb: 85 c0 test eax, eax
64-
# nextln: 0000cd: 0f 94 c1 sete cl
65-
# nextln: 0000d0: 88 4c 24 0e mov byte ptr [rsp + 0xe], cl
66-
# nextln: 0000d4: 0f b6 44 24 0e movzx eax, byte ptr [rsp + 0xe]
67-
# nextln: 0000d9: 85 c0 test eax, eax
68-
# nextln: 0000db: 0f 84 0e 00 00 00 je 0xef
69-
# nextln: 0000e1: b8 04 00 00 00 mov eax, 4
70-
# nextln: 0000e6: 89 44 24 04 mov dword ptr [rsp + 4], eax
71-
# nextln: 0000ea: e9 8b 00 00 00 jmp 0x17a
72-
# nextln: 0000ef: 33 c0 xor eax, eax
73-
# nextln: 0000f1: 83 ff ff cmp edi, -1
74-
# nextln: 0000f4: 0f 9c c0 setl al
75-
# nextln: 0000f7: 33 c9 xor ecx, ecx
76-
# nextln: 0000f9: 85 c0 test eax, eax
77-
# nextln: 0000fb: 0f 94 c1 sete cl
78-
# nextln: 0000fe: 88 4c 24 0c mov byte ptr [rsp + 0xc], cl
79-
# nextln: 000102: 0f b6 44 24 0c movzx eax, byte ptr [rsp + 0xc]
80-
# nextln: 000107: 85 c0 test eax, eax
81-
# nextln: 000109: 0f 84 0e 00 00 00 je 0x11d
82-
# nextln: 00010f: b8 03 00 00 00 mov eax, 3
83-
# nextln: 000114: 89 44 24 04 mov dword ptr [rsp + 4], eax
84-
# nextln: 000118: e9 5d 00 00 00 jmp 0x17a
85-
# nextln: 00011d: 33 c0 xor eax, eax
86-
# nextln: 00011f: 81 ff 01 00 00 80 cmp edi, 0x80000001
87-
# nextln: 000125: 0f 9c c0 setl al
88-
# nextln: 000128: 33 c9 xor ecx, ecx
89-
# nextln: 00012a: 85 c0 test eax, eax
90-
# nextln: 00012c: 0f 94 c1 sete cl
91-
# nextln: 00012f: 88 4c 24 0a mov byte ptr [rsp + 0xa], cl
92-
# nextln: 000133: 0f b6 44 24 0a movzx eax, byte ptr [rsp + 0xa]
93-
# nextln: 000138: 85 c0 test eax, eax
94-
# nextln: 00013a: 0f 84 0e 00 00 00 je 0x14e
95-
# nextln: 000140: b8 02 00 00 00 mov eax, 2
96-
# nextln: 000145: 89 44 24 04 mov dword ptr [rsp + 4], eax
97-
# nextln: 000149: e9 2c 00 00 00 jmp 0x17a
98-
# nextln: 00014e: 33 c0 xor eax, eax
99-
# nextln: 000150: 81 ff 00 00 00 80 cmp edi, 0x80000000
100-
# nextln: 000156: 0f 9c c0 setl al
101-
# nextln: 000159: 33 c9 xor ecx, ecx
102-
# nextln: 00015b: 85 c0 test eax, eax
103-
# nextln: 00015d: 0f 94 c1 sete cl
104-
# nextln: 000160: 88 4c 24 0b mov byte ptr [rsp + 0xb], cl
105-
# nextln: 000164: 0f b6 44 24 0b movzx eax, byte ptr [rsp + 0xb]
106-
# nextln: 000169: 85 c0 test eax, eax
107-
# nextln: 00016b: 0f 84 09 00 00 00 je 0x17a
108-
# nextln: 000171: b8 01 00 00 00 mov eax, 1
109-
# nextln: 000176: 89 44 24 04 mov dword ptr [rsp + 4], eax
110-
# nextln: 00017a: 8b 44 24 04 mov eax, dword ptr [rsp + 4]
111-
# nextln: 00017e: 89 04 24 mov dword ptr [rsp], eax
112-
# nextln: 000181: 8b 04 24 mov eax, dword ptr [rsp]
113-
# nextln: 000184: 48 83 c4 10 add rsp, 0x10
114-
# nextln: 000188: 5d pop rbp
115-
# nextln: 000189: c3 ret
25+
# nextln: 000044: 89 0c 24 mov dword ptr [rsp], ecx
26+
# nextln: 000047: 88 44 24 08 mov byte ptr [rsp + 8], al
27+
# nextln: 00004b: 0f b6 44 24 08 movzx eax, byte ptr [rsp + 8]
28+
# nextln: 000050: 85 c0 test eax, eax
29+
# nextln: 000052: 0f 84 0d 00 00 00 je 0x65
30+
# nextln: 000058: b8 07 00 00 00 mov eax, 7
31+
# nextln: 00005d: 89 04 24 mov dword ptr [rsp], eax
32+
# nextln: 000060: e9 0d 01 00 00 jmp 0x172
33+
# nextln: 000065: 33 c0 xor eax, eax
34+
# nextln: 000067: 83 ff 02 cmp edi, 2
35+
# nextln: 00006a: 0f 9c c0 setl al
36+
# nextln: 00006d: 33 c9 xor ecx, ecx
37+
# nextln: 00006f: 85 c0 test eax, eax
38+
# nextln: 000071: 0f 94 c1 sete cl
39+
# nextln: 000074: 88 4c 24 0d mov byte ptr [rsp + 0xd], cl
40+
# nextln: 000078: 0f b6 44 24 0d movzx eax, byte ptr [rsp + 0xd]
41+
# nextln: 00007d: 85 c0 test eax, eax
42+
# nextln: 00007f: 0f 84 0d 00 00 00 je 0x92
43+
# nextln: 000085: b8 06 00 00 00 mov eax, 6
44+
# nextln: 00008a: 89 04 24 mov dword ptr [rsp], eax
45+
# nextln: 00008d: e9 e0 00 00 00 jmp 0x172
46+
# nextln: 000092: 33 c0 xor eax, eax
47+
# nextln: 000094: 85 ff test edi, edi
48+
# nextln: 000096: 0f 9e c0 setle al
49+
# nextln: 000099: 33 c9 xor ecx, ecx
50+
# nextln: 00009b: 85 c0 test eax, eax
51+
# nextln: 00009d: 0f 94 c1 sete cl
52+
# nextln: 0000a0: 88 4c 24 09 mov byte ptr [rsp + 9], cl
53+
# nextln: 0000a4: 0f b6 44 24 09 movzx eax, byte ptr [rsp + 9]
54+
# nextln: 0000a9: 85 c0 test eax, eax
55+
# nextln: 0000ab: 0f 84 0d 00 00 00 je 0xbe
56+
# nextln: 0000b1: b8 05 00 00 00 mov eax, 5
57+
# nextln: 0000b6: 89 04 24 mov dword ptr [rsp], eax
58+
# nextln: 0000b9: e9 b4 00 00 00 jmp 0x172
59+
# nextln: 0000be: 33 c0 xor eax, eax
60+
# nextln: 0000c0: 85 ff test edi, edi
61+
# nextln: 0000c2: 0f 98 c0 sets al
62+
# nextln: 0000c5: 33 c9 xor ecx, ecx
63+
# nextln: 0000c7: 85 c0 test eax, eax
64+
# nextln: 0000c9: 0f 94 c1 sete cl
65+
# nextln: 0000cc: 88 4c 24 0e mov byte ptr [rsp + 0xe], cl
66+
# nextln: 0000d0: 0f b6 44 24 0e movzx eax, byte ptr [rsp + 0xe]
67+
# nextln: 0000d5: 85 c0 test eax, eax
68+
# nextln: 0000d7: 0f 84 0d 00 00 00 je 0xea
69+
# nextln: 0000dd: b8 04 00 00 00 mov eax, 4
70+
# nextln: 0000e2: 89 04 24 mov dword ptr [rsp], eax
71+
# nextln: 0000e5: e9 88 00 00 00 jmp 0x172
72+
# nextln: 0000ea: 33 c0 xor eax, eax
73+
# nextln: 0000ec: 83 ff ff cmp edi, -1
74+
# nextln: 0000ef: 0f 9c c0 setl al
75+
# nextln: 0000f2: 33 c9 xor ecx, ecx
76+
# nextln: 0000f4: 85 c0 test eax, eax
77+
# nextln: 0000f6: 0f 94 c1 sete cl
78+
# nextln: 0000f9: 88 4c 24 0c mov byte ptr [rsp + 0xc], cl
79+
# nextln: 0000fd: 0f b6 44 24 0c movzx eax, byte ptr [rsp + 0xc]
80+
# nextln: 000102: 85 c0 test eax, eax
81+
# nextln: 000104: 0f 84 0d 00 00 00 je 0x117
82+
# nextln: 00010a: b8 03 00 00 00 mov eax, 3
83+
# nextln: 00010f: 89 04 24 mov dword ptr [rsp], eax
84+
# nextln: 000112: e9 5b 00 00 00 jmp 0x172
85+
# nextln: 000117: 33 c0 xor eax, eax
86+
# nextln: 000119: 81 ff 01 00 00 80 cmp edi, 0x80000001
87+
# nextln: 00011f: 0f 9c c0 setl al
88+
# nextln: 000122: 33 c9 xor ecx, ecx
89+
# nextln: 000124: 85 c0 test eax, eax
90+
# nextln: 000126: 0f 94 c1 sete cl
91+
# nextln: 000129: 88 4c 24 0a mov byte ptr [rsp + 0xa], cl
92+
# nextln: 00012d: 0f b6 44 24 0a movzx eax, byte ptr [rsp + 0xa]
93+
# nextln: 000132: 85 c0 test eax, eax
94+
# nextln: 000134: 0f 84 0d 00 00 00 je 0x147
95+
# nextln: 00013a: b8 02 00 00 00 mov eax, 2
96+
# nextln: 00013f: 89 04 24 mov dword ptr [rsp], eax
97+
# nextln: 000142: e9 2b 00 00 00 jmp 0x172
98+
# nextln: 000147: 33 c0 xor eax, eax
99+
# nextln: 000149: 81 ff 00 00 00 80 cmp edi, 0x80000000
100+
# nextln: 00014f: 0f 9c c0 setl al
101+
# nextln: 000152: 33 c9 xor ecx, ecx
102+
# nextln: 000154: 85 c0 test eax, eax
103+
# nextln: 000156: 0f 94 c1 sete cl
104+
# nextln: 000159: 88 4c 24 0b mov byte ptr [rsp + 0xb], cl
105+
# nextln: 00015d: 0f b6 44 24 0b movzx eax, byte ptr [rsp + 0xb]
106+
# nextln: 000162: 85 c0 test eax, eax
107+
# nextln: 000164: 0f 84 08 00 00 00 je 0x172
108+
# nextln: 00016a: b8 01 00 00 00 mov eax, 1
109+
# nextln: 00016f: 89 04 24 mov dword ptr [rsp], eax
110+
# nextln: 000172: 8b 04 24 mov eax, dword ptr [rsp]
111+
# nextln: 000175: 89 44 24 04 mov dword ptr [rsp + 4], eax
112+
# nextln: 000179: 8b 44 24 04 mov eax, dword ptr [rsp + 4]
113+
# nextln: 00017d: 48 83 c4 10 add rsp, 0x10
114+
# nextln: 000181: 5d pop rbp
115+
# nextln: 000182: c3 ret
116116

117117
%0:ctrl, %1:i32 = entry
118118
%2:ctrl, %3:phisel = region %0

0 commit comments

Comments
 (0)