Skip to content

Commit 52b95c7

Browse files
committed
Update test to check full output
1 parent c9d1b6e commit 52b95c7

File tree

1 file changed

+43
-24
lines changed

1 file changed

+43
-24
lines changed

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

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,17 @@
1+
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 5
12
# Ensure that loads into FAKE_USEs are correctly removed by the
23
# remove-loads-into-fake-uses pass.
3-
# RUN: llc -run-pass remove-loads-into-fake-uses -mtriple=x86_64-unknown-linux -debug-only=remove-loads-into-fake-uses 2>&1 -o - %s | FileCheck %s --implicit-check-not=DELETING
4+
# RUN: llc -run-pass remove-loads-into-fake-uses -mtriple=x86_64-unknown-linux -debug-only=remove-loads-into-fake-uses 2>&1 -o - %s | FileCheck %s
45
# REQUIRES: asserts
56
#
6-
## We ensure that the load into the FAKE_USE is removed, along with the FAKE_USE
7-
## itself, even when the FAKE_USE is for a subregister of the move, and that we
8-
## correctly handle situations where FAKE_USE has additional `killed` operands
9-
## added by other passes.
10-
11-
# CHECK: DELETING: renamable $rax = MOV64rm $rbp
12-
# CHECK: DELETING: FAKE_USE renamable $eax
13-
14-
## Also verify that the store to the stack slot still exists.
15-
16-
# CHECK-LABEL: bb.0:
17-
# CHECK: MOV64mr $rbp, 1, $noreg, -48, $noreg, killed renamable $rax :: (store (s64) into %stack.0)
18-
19-
## Finally, verify that when the register has a use between the restore and the
20-
## FAKE_USE, we do not delete the load or fake use.
21-
22-
# CHECK: renamable $r11 = MOV64rm $rbp, 1, $noreg, -40, $noreg :: (load (s64) from %stack.1)
23-
# CHECK: renamable $r12d = XOR32rr $r12d, $r11d, implicit-def dead $eflags
24-
# CHECK: FAKE_USE killed renamable $r11d
7+
## We verify that:
8+
## - The load into the FAKE_USE is removed, along with the FAKE_USE itself,
9+
## even when the FAKE_USE is for a subregister of the move.
10+
## - We correctly handle situations where FAKE_USE has additional `killed`
11+
## operands added by other passes.
12+
## - The store to the stack slot still exists.
13+
## - When the register has a use between the restore and the FAKE_USE, we do
14+
## not delete the load or fake use.
2515

2616

2717
---
@@ -39,16 +29,45 @@ liveins:
3929
frameInfo:
4030
isCalleeSavedInfoValid: true
4131
stack:
42-
- { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
43-
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
32+
- { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
33+
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
4434
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
45-
- { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
46-
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
35+
- { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
36+
stack-id: default, callee-saved-register: '', callee-saved-restored: true,
4737
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
4838
body: |
4939
bb.0:
5040
liveins: $esi, $rdi, $rdx, $r15, $r14, $r13, $r12, $r11, $rbx
5141
42+
; CHECK-LABEL: name: _ZN1g1jEv
43+
; CHECK: liveins: $esi, $rdi, $rdx, $r15, $r14, $r13, $r12, $r11, $rbx
44+
; CHECK-NEXT: {{ $}}
45+
; CHECK-NEXT: $rbx = MOV64rr $rdx
46+
; CHECK-NEXT: $r14d = MOV32rr $esi
47+
; CHECK-NEXT: $r15 = MOV64rr $rdi
48+
; CHECK-NEXT: renamable $r12d = XOR32rr undef $r12d, undef $r12d, implicit-def dead $eflags, implicit-def $r12
49+
; CHECK-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, implicit-def $rax
50+
51+
;; The store to the stack slot is still present.
52+
; CHECK-NEXT: MOV64mr $rbp, 1, $noreg, -48, $noreg, killed renamable $rax :: (store (s64) into %stack.0)
53+
54+
; CHECK-NEXT: MOV64mr $rbp, 1, $noreg, -40, $noreg, killed renamable $r11 :: (store (s64) into %stack.1)
55+
; CHECK-NEXT: renamable $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags
56+
; CHECK-NEXT: $r13d = MOV32rr killed $eax
57+
; CHECK-NEXT: $rdi = MOV64rr $r15
58+
; CHECK-NEXT: CALL64r renamable $r12, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit-def $rsp, implicit-def $ssp
59+
; CHECK-NEXT: dead renamable $eax = MOV32rm renamable $rbx, 1, $noreg, 0, $noreg
60+
; CHECK-NEXT: renamable $eax = MOV32ri 1
61+
; CHECK-NEXT: TEST8ri renamable $r14b, 1, implicit-def $eflags
62+
63+
;; First FAKE_USE and its corresponding load are removed; second FAKE_USE of
64+
;; a restored value that is also used is preserved.
65+
; CHECK-NEXT: renamable $r11 = MOV64rm $rbp, 1, $noreg, -40, $noreg :: (load (s64) from %stack.1)
66+
; CHECK-NEXT: renamable $r12d = XOR32rr $r12d, $r11d, implicit-def dead $eflags
67+
; CHECK-NEXT: FAKE_USE killed renamable $r11d
68+
69+
; CHECK-NEXT: TEST32rr killed renamable $r13d, renamable $r13d, implicit-def $eflags
70+
; CHECK-NEXT: RET64
5271
$rbx = MOV64rr $rdx
5372
$r14d = MOV32rr $esi
5473
$r15 = MOV64rr $rdi

0 commit comments

Comments
 (0)