Skip to content

Commit 92c0631

Browse files
committed
Update test to be more update_test_checks-friendly
1 parent 026fc06 commit 92c0631

File tree

1 file changed

+99
-55
lines changed

1 file changed

+99
-55
lines changed

llvm/test/CodeGen/X86/fake-use-remove-loads.mir

Lines changed: 99 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
# Ensure that loads into FAKE_USEs are correctly removed by the
33
# remove-loads-into-fake-uses pass, and that if the function does not use
44
# instruction referencing then no changes are made.
5-
# RUN: sed 's/USE_INSTR_REF/true/' %s | llc - -x mir -run-pass remove-loads-into-fake-uses -mtriple=x86_64-unknown-linux -debug-only=remove-loads-into-fake-uses 2>&1 -o - | FileCheck %s --check-prefix=ENABLED
6-
# RUN: sed 's/USE_INSTR_REF/false/' %s | llc - -x mir -run-pass remove-loads-into-fake-uses -mtriple=x86_64-unknown-linux -debug-only=remove-loads-into-fake-uses 2>&1 -o - | FileCheck %s --check-prefixes=DISABLED
5+
# RUN: llc %s -run-pass remove-loads-into-fake-uses -mtriple=x86_64-unknown-linux -debug-only=remove-loads-into-fake-uses 2>&1 -o - | FileCheck %s
76
# REQUIRES: asserts
87
#
98
## We verify that:
@@ -17,14 +16,14 @@
1716

1817

1918
---
20-
name: _ZN1g1jEv
19+
name: enabled
2120
alignment: 16
2221
tracksRegLiveness: true
2322
noPhis: true
2423
noVRegs: true
2524
hasFakeUses: true
26-
debugInstrRef: USE_INSTR_REF
2725
tracksDebugUserValues: true
26+
debugInstrRef: true
2827
liveins:
2928
- { reg: '$rdi', virtual-reg: '' }
3029
- { reg: '$esi', virtual-reg: '' }
@@ -42,66 +41,111 @@ body: |
4241
bb.0:
4342
liveins: $esi, $rdi, $rdx, $r15, $r14, $r13, $r12, $r11, $rbx
4443
45-
46-
47-
48-
49-
; ENABLED-LABEL: name: _ZN1g1jEv
50-
; ENABLED: liveins: $esi, $rdi, $rdx, $r15, $r14, $r13, $r12, $r11, $rbx
51-
; ENABLED-NEXT: {{ $}}
52-
; ENABLED-NEXT: $rbx = MOV64rr $rdx
53-
; ENABLED-NEXT: $r14d = MOV32rr $esi
54-
; ENABLED-NEXT: $r15 = MOV64rr $rdi
55-
; ENABLED-NEXT: renamable $r12d = XOR32rr undef $r12d, undef $r12d, implicit-def dead $eflags, implicit-def $r12
56-
; ENABLED-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $rax
44+
; CHECK-LABEL: name: enabled
45+
; CHECK: liveins: $esi, $rdi, $rdx, $r15, $r14, $r13, $r12, $r11, $rbx
46+
; CHECK-NEXT: {{ $}}
47+
; CHECK-NEXT: $rbx = MOV64rr $rdx
48+
; CHECK-NEXT: $r14d = MOV32rr $esi
49+
; CHECK-NEXT: $r15 = MOV64rr $rdi
50+
; CHECK-NEXT: renamable $r12d = XOR32rr undef $r12d, undef $r12d, implicit-def dead $eflags, implicit-def $r12
51+
; CHECK-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $rax
5752
5853
;; The store to the stack slot is still present.
59-
; ENABLED-NEXT: MOV64mr $rbp, 1, $noreg, -48, $noreg, killed renamable $rax :: (store (s64) into %stack.0)
54+
; CHECK-NEXT: MOV64mr $rbp, 1, $noreg, -48, $noreg, killed renamable $rax :: (store (s64) into %stack.0)
6055
61-
; ENABLED-NEXT: MOV64mr $rbp, 1, $noreg, -40, $noreg, killed renamable $r11 :: (store (s64) into %stack.1)
62-
; ENABLED-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
63-
; ENABLED-NEXT: $r13d = MOV32rr killed $eax
64-
; ENABLED-NEXT: $rdi = MOV64rr $r15
65-
; ENABLED-NEXT: CALL64r renamable $r12, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp
66-
; ENABLED-NEXT: dead renamable $eax = MOV32rm renamable $rbx, 1, $noreg, 0, $noreg
67-
; ENABLED-NEXT: renamable $eax = MOV32ri 1
68-
; ENABLED-NEXT: TEST8ri renamable $r14b, 1, implicit-def $eflags
56+
; CHECK-NEXT: MOV64mr $rbp, 1, $noreg, -40, $noreg, killed renamable $r11 :: (store (s64) into %stack.1)
57+
; CHECK-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
58+
; CHECK-NEXT: $r13d = MOV32rr killed $eax
59+
; CHECK-NEXT: $rdi = MOV64rr $r15
60+
; CHECK-NEXT: CALL64r renamable $r12, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp
61+
; CHECK-NEXT: dead renamable $eax = MOV32rm renamable $rbx, 1, $noreg, 0, $noreg
62+
; CHECK-NEXT: renamable $eax = MOV32ri 1
63+
; CHECK-NEXT: TEST8ri renamable $r14b, 1, implicit-def $eflags
6964
7065
;; First FAKE_USE and its corresponding load are removed; second FAKE_USE of
7166
;; a restored value that is also used is preserved.
72-
; ENABLED-NEXT: renamable $r11 = MOV64rm $rbp, 1, $noreg, -40, $noreg :: (load (s64) from %stack.1)
73-
; ENABLED-NEXT: renamable $r12d = XOR32rr $r12d, $r11d, implicit-def dead $eflags
74-
; ENABLED-NEXT: FAKE_USE killed renamable $r11d
67+
; CHECK-NEXT: renamable $r11 = MOV64rm $rbp, 1, $noreg, -40, $noreg :: (load (s64) from %stack.1)
68+
; CHECK-NEXT: renamable $r12d = XOR32rr $r12d, $r11d, implicit-def dead $eflags
69+
; CHECK-NEXT: FAKE_USE killed renamable $r11d
70+
71+
; CHECK-NEXT: TEST32rr killed renamable $r13d, renamable $r13d, implicit-def $eflags
72+
; CHECK-NEXT: RET64
73+
74+
$rbx = MOV64rr $rdx
75+
$r14d = MOV32rr $esi
76+
$r15 = MOV64rr $rdi
77+
renamable $r12d = XOR32rr undef $r12d, undef $r12d, implicit-def dead $eflags, implicit-def $r12
78+
renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $rax
79+
MOV64mr $rbp, 1, $noreg, -48, $noreg, killed renamable $rax :: (store (s64) into %stack.0)
80+
MOV64mr $rbp, 1, $noreg, -40, $noreg, killed renamable $r11 :: (store (s64) into %stack.1)
81+
renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
82+
$r13d = MOV32rr killed $eax
83+
$rdi = MOV64rr $r15
84+
CALL64r renamable $r12, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp
85+
dead renamable $eax = MOV32rm renamable $rbx, 1, $noreg, 0, $noreg
86+
renamable $eax = MOV32ri 1
87+
TEST8ri renamable $r14b, 1, implicit-def $eflags
88+
renamable $rax = MOV64rm $rbp, 1, $noreg, -48, $noreg :: (load (s64) from %stack.0)
89+
FAKE_USE renamable $eax, implicit killed $rax
90+
renamable $r11 = MOV64rm $rbp, 1, $noreg, -40, $noreg :: (load (s64) from %stack.1)
91+
renamable $r12d = XOR32rr $r12d, $r11d, implicit-def dead $eflags
92+
FAKE_USE killed renamable $r11d
93+
TEST32rr killed renamable $r13d, renamable $r13d, implicit-def $eflags
94+
RET64
95+
96+
...
97+
---
98+
name: disabled
99+
alignment: 16
100+
tracksRegLiveness: true
101+
noPhis: true
102+
noVRegs: true
103+
hasFakeUses: true
104+
tracksDebugUserValues: true
105+
debugInstrRef: false
106+
liveins:
107+
- { reg: '$rdi', virtual-reg: '' }
108+
- { reg: '$esi', virtual-reg: '' }
109+
- { reg: '$rdx', virtual-reg: '' }
110+
frameInfo:
111+
isCalleeSavedInfoValid: true
112+
stack:
113+
- { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
114+
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
115+
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
116+
- { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
117+
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
118+
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
119+
body: |
120+
bb.0:
121+
liveins: $esi, $rdi, $rdx, $r15, $r14, $r13, $r12, $r11, $rbx
75122
76-
; ENABLED-NEXT: TEST32rr killed renamable $r13d, renamable $r13d, implicit-def $eflags
77-
; ENABLED-NEXT: RET64
78-
;
79-
; DISABLED-LABEL: name: _ZN1g1jEv
80-
; DISABLED: liveins: $esi, $rdi, $rdx, $r15, $r14, $r13, $r12, $r11, $rbx
81-
; DISABLED-NEXT: {{ $}}
82-
; DISABLED-NEXT: $rbx = MOV64rr $rdx
83-
; DISABLED-NEXT: $r14d = MOV32rr $esi
84-
; DISABLED-NEXT: $r15 = MOV64rr $rdi
85-
; DISABLED-NEXT: renamable $r12d = XOR32rr undef $r12d, undef $r12d, implicit-def dead $eflags, implicit-def $r12
86-
; DISABLED-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $rax
87-
; DISABLED-NEXT: MOV64mr $rbp, 1, $noreg, -48, $noreg, killed renamable $rax :: (store (s64) into %stack.0)
88-
; DISABLED-NEXT: MOV64mr $rbp, 1, $noreg, -40, $noreg, killed renamable $r11 :: (store (s64) into %stack.1)
89-
; DISABLED-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
90-
; DISABLED-NEXT: $r13d = MOV32rr killed $eax
91-
; DISABLED-NEXT: $rdi = MOV64rr $r15
92-
; DISABLED-NEXT: CALL64r renamable $r12, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp
93-
; DISABLED-NEXT: dead renamable $eax = MOV32rm renamable $rbx, 1, $noreg, 0, $noreg
94-
; DISABLED-NEXT: renamable $eax = MOV32ri 1
95-
; DISABLED-NEXT: TEST8ri renamable $r14b, 1, implicit-def $eflags
123+
; CHECK-LABEL: name: disabled
124+
; CHECK: liveins: $esi, $rdi, $rdx, $r15, $r14, $r13, $r12, $r11, $rbx
125+
; CHECK-NEXT: {{ $}}
126+
; CHECK-NEXT: $rbx = MOV64rr $rdx
127+
; CHECK-NEXT: $r14d = MOV32rr $esi
128+
; CHECK-NEXT: $r15 = MOV64rr $rdi
129+
; CHECK-NEXT: renamable $r12d = XOR32rr undef $r12d, undef $r12d, implicit-def dead $eflags, implicit-def $r12
130+
; CHECK-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $rax
131+
; CHECK-NEXT: MOV64mr $rbp, 1, $noreg, -48, $noreg, killed renamable $rax :: (store (s64) into %stack.0)
132+
; CHECK-NEXT: MOV64mr $rbp, 1, $noreg, -40, $noreg, killed renamable $r11 :: (store (s64) into %stack.1)
133+
; CHECK-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
134+
; CHECK-NEXT: $r13d = MOV32rr killed $eax
135+
; CHECK-NEXT: $rdi = MOV64rr $r15
136+
; CHECK-NEXT: CALL64r renamable $r12, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp
137+
; CHECK-NEXT: dead renamable $eax = MOV32rm renamable $rbx, 1, $noreg, 0, $noreg
138+
; CHECK-NEXT: renamable $eax = MOV32ri 1
139+
; CHECK-NEXT: TEST8ri renamable $r14b, 1, implicit-def $eflags
96140
97141
;; Verify that when instr-ref is disabled, we do not remove fake uses.
98-
; DISABLED-NEXT: renamable $rax = MOV64rm $rbp, 1, $noreg, -48, $noreg :: (load (s64) from %stack.0)
99-
; DISABLED-NEXT: FAKE_USE renamable $eax, implicit killed $rax
100-
; DISABLED-NEXT: renamable $r11 = MOV64rm $rbp, 1, $noreg, -40, $noreg :: (load (s64) from %stack.1)
101-
; DISABLED-NEXT: renamable $r12d = XOR32rr $r12d, $r11d, implicit-def dead $eflags
102-
; DISABLED-NEXT: FAKE_USE killed renamable $r11d
103-
; DISABLED-NEXT: TEST32rr killed renamable $r13d, renamable $r13d, implicit-def $eflags
104-
; DISABLED-NEXT: RET64
142+
; CHECK-NEXT: renamable $rax = MOV64rm $rbp, 1, $noreg, -48, $noreg :: (load (s64) from %stack.0)
143+
; CHECK-NEXT: FAKE_USE renamable $eax, implicit killed $rax
144+
; CHECK-NEXT: renamable $r11 = MOV64rm $rbp, 1, $noreg, -40, $noreg :: (load (s64) from %stack.1)
145+
; CHECK-NEXT: renamable $r12d = XOR32rr $r12d, $r11d, implicit-def dead $eflags
146+
; CHECK-NEXT: FAKE_USE killed renamable $r11d
147+
; CHECK-NEXT: TEST32rr killed renamable $r13d, renamable $r13d, implicit-def $eflags
148+
; CHECK-NEXT: RET64
105149
$rbx = MOV64rr $rdx
106150
$r14d = MOV32rr $esi
107151
$r15 = MOV64rr $rdi

0 commit comments

Comments
 (0)