llvm.org GIT mirror llvm / da6a17a
[UpdateTestChecks][PowerPC] Avoid empty string when scrubbing loop comments Summary: SCRUB_LOOP_COMMENT_RE was introduced in https://reviews.llvm.org/D31285 This works for some loops. However, we may generate lines with loop comments only. And since we don't scrub leading white spaces, this will leave an empty line there, and FileCheck will complain it. eg: llvm/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll:27:15: error: found empty check string with prefix 'CHECK:' ; CHECK-NEXT: This prevented us from using the `update_llc_test_checks.py` for quite some cases. We should still keep the comment token there, so that we can safely scrub the loop comment without breaking FileCheck. Reviewers: timshen, hfinkel, lebedev.ri, RKSimon Subscribers: nemanjai, jfb, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63957 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364775 91177308-0d34-0410-b5e6-96231b3b80d8 Jinsong Ji 1 year, 4 months ago
2 changed file(s) with 127 addition(s) and 55 deletion(s). Raw diff Collapse all Expand all
99
1010 define signext i32 @main() {
1111 ; CHECK-LABEL: main:
12 ; CHECK: li 3, -32477
13 ; CHECK: li 6, 234
14 ; CHECK: sth 3, 46(1)
15 ; CHECK: lis 3, 0
16 ; CHECK: ori 4, 3, 33059
17 ; CHECK: sync
18 ; CHECK: .LBB0_1: # %L.entry
19 ; CHECK: lharx 3, 0, 5
20 ; CHECK: cmpw 4, 3
21 ; CHECK: bne 0, .LBB0_3
22 ; CHECK: sthcx. 6, 0, 5
23 ; CHECK: bne 0, .LBB0_1
24 ; CHECK: b .LBB0_4
25 ; CHECK: .LBB0_3: # %L.entry
26 ; CHECK: sthcx. 3, 0, 5
27 ; CHECK: .LBB0_4: # %L.entry
28 ; CHECK: cmplwi 3, 33059
29 ; CHECK: lwsync
30 ; CHECK: lhz 3, 46(1)
31 ; CHECK: cmplwi 3, 234
12 ; CHECK: # %bb.0: # %L.entry
13 ; CHECK-NEXT: mflr 0
14 ; CHECK-NEXT: std 0, 16(1)
15 ; CHECK-NEXT: stdu 1, -48(1)
16 ; CHECK-NEXT: .cfi_def_cfa_offset 48
17 ; CHECK-NEXT: .cfi_offset lr, 16
18 ; CHECK-NEXT: li 3, -32477
19 ; CHECK-NEXT: li 6, 234
20 ; CHECK-NEXT: addi 5, 1, 46
21 ; CHECK-NEXT: sth 3, 46(1)
22 ; CHECK-NEXT: lis 3, 0
23 ; CHECK-NEXT: ori 4, 3, 33059
24 ; CHECK-NEXT: sync
25 ; CHECK-NEXT: .LBB0_1: # %L.entry
26 ; CHECK-NEXT: #
27 ; CHECK-NEXT: lharx 3, 0, 5
28 ; CHECK-NEXT: cmpw 4, 3
29 ; CHECK-NEXT: bne 0, .LBB0_3
30 ; CHECK-NEXT: # %bb.2: # %L.entry
31 ; CHECK-NEXT: #
32 ; CHECK-NEXT: sthcx. 6, 0, 5
33 ; CHECK-NEXT: bne 0, .LBB0_1
34 ; CHECK-NEXT: b .LBB0_4
35 ; CHECK-NEXT: .LBB0_3: # %L.entry
36 ; CHECK-NEXT: sthcx. 3, 0, 5
37 ; CHECK-NEXT: .LBB0_4: # %L.entry
38 ; CHECK-NEXT: cmplwi 3, 33059
39 ; CHECK-NEXT: lwsync
40 ; CHECK-NEXT: bne 0, .LBB0_7
41 ; CHECK-NEXT: # %bb.5: # %L.B0000
42 ; CHECK-NEXT: lhz 3, 46(1)
43 ; CHECK-NEXT: cmplwi 3, 234
44 ; CHECK-NEXT: bne 0, .LBB0_8
45 ; CHECK-NEXT: # %bb.6: # %L.B0001
46 ; CHECK-NEXT: addis 3, 2, .Lstr.2@toc@ha
47 ; CHECK-NEXT: addi 3, 3, .Lstr.2@toc@l
48 ; CHECK-NEXT: bl puts
49 ; CHECK-NEXT: nop
50 ; CHECK-NEXT: li 3, 0
51 ; CHECK-NEXT: b .LBB0_10
52 ; CHECK-NEXT: .LBB0_7: # %L.B0003
53 ; CHECK-NEXT: addis 3, 2, .Lstr@toc@ha
54 ; CHECK-NEXT: addi 3, 3, .Lstr@toc@l
55 ; CHECK-NEXT: b .LBB0_9
56 ; CHECK-NEXT: .LBB0_8: # %L.B0005
57 ; CHECK-NEXT: addis 3, 2, .Lstr.1@toc@ha
58 ; CHECK-NEXT: addi 3, 3, .Lstr.1@toc@l
59 ; CHECK-NEXT: .LBB0_9: # %L.B0003
60 ; CHECK-NEXT: bl puts
61 ; CHECK-NEXT: nop
62 ; CHECK-NEXT: li 3, 1
63 ; CHECK-NEXT: .LBB0_10: # %L.B0003
64 ; CHECK-NEXT: addi 1, 1, 48
65 ; CHECK-NEXT: ld 0, 16(1)
66 ; CHECK-NEXT: mtlr 0
67 ; CHECK-NEXT: blr
3268 ;
3369 ; CHECK-P7-LABEL: main:
34 ; CHECK-P7: li 3, -32477
35 ; CHECK-P7: lis 5, 0
36 ; CHECK-P7: li 7, 0
37 ; CHECK-P7: sth 3, 46(1)
38 ; CHECK-P7: li 6, 234
39 ; CHECK-P7: ori 5, 5, 33059
40 ; CHECK-P7: rlwinm 3, 4, 3, 27, 27
41 ; CHECK-P7: ori 7, 7, 65535
42 ; CHECK-P7: sync
43 ; CHECK-P7: slw 6, 6, 3
44 ; CHECK-P7: slw 8, 5, 3
45 ; CHECK-P7: slw 5, 7, 3
46 ; CHECK-P7: rldicr 4, 4, 0, 61
47 ; CHECK-P7: and 7, 6, 5
48 ; CHECK-P7: and 8, 8, 5
49 ; CHECK-P7: .LBB0_1: # %L.entry
50 ; CHECK-P7: lwarx 9, 0, 4
51 ; CHECK-P7: and 6, 9, 5
52 ; CHECK-P7: cmpw 6, 8
53 ; CHECK-P7: bne 0, .LBB0_3
54 ; CHECK-P7: andc 9, 9, 5
55 ; CHECK-P7: or 9, 9, 7
56 ; CHECK-P7: stwcx. 9, 0, 4
57 ; CHECK-P7: bne 0, .LBB0_1
58 ; CHECK-P7: b .LBB0_4
59 ; CHECK-P7: .LBB0_3: # %L.entry
60 ; CHECK-P7: stwcx. 9, 0, 4
61 ; CHECK-P7: .LBB0_4: # %L.entry
62 ; CHECK-P7: srw 3, 6, 3
63 ; CHECK-P7: lwsync
64 ; CHECK-P7: cmplwi 3, 33059
65 ; CHECK-P7: lhz 3, 46(1)
66 ; CHECK-P7: cmplwi 3, 234
70 ; CHECK-P7: # %bb.0: # %L.entry
71 ; CHECK-P7-NEXT: mflr 0
72 ; CHECK-P7-NEXT: std 0, 16(1)
73 ; CHECK-P7-NEXT: stdu 1, -48(1)
74 ; CHECK-P7-NEXT: .cfi_def_cfa_offset 48
75 ; CHECK-P7-NEXT: .cfi_offset lr, 16
76 ; CHECK-P7-NEXT: li 3, -32477
77 ; CHECK-P7-NEXT: lis 5, 0
78 ; CHECK-P7-NEXT: addi 4, 1, 46
79 ; CHECK-P7-NEXT: li 7, 0
80 ; CHECK-P7-NEXT: sth 3, 46(1)
81 ; CHECK-P7-NEXT: li 6, 234
82 ; CHECK-P7-NEXT: ori 5, 5, 33059
83 ; CHECK-P7-NEXT: rlwinm 3, 4, 3, 27, 27
84 ; CHECK-P7-NEXT: ori 7, 7, 65535
85 ; CHECK-P7-NEXT: sync
86 ; CHECK-P7-NEXT: slw 6, 6, 3
87 ; CHECK-P7-NEXT: slw 8, 5, 3
88 ; CHECK-P7-NEXT: slw 5, 7, 3
89 ; CHECK-P7-NEXT: rldicr 4, 4, 0, 61
90 ; CHECK-P7-NEXT: and 7, 6, 5
91 ; CHECK-P7-NEXT: and 8, 8, 5
92 ; CHECK-P7-NEXT: .LBB0_1: # %L.entry
93 ; CHECK-P7-NEXT: #
94 ; CHECK-P7-NEXT: lwarx 9, 0, 4
95 ; CHECK-P7-NEXT: and 6, 9, 5
96 ; CHECK-P7-NEXT: cmpw 6, 8
97 ; CHECK-P7-NEXT: bne 0, .LBB0_3
98 ; CHECK-P7-NEXT: # %bb.2: # %L.entry
99 ; CHECK-P7-NEXT: #
100 ; CHECK-P7-NEXT: andc 9, 9, 5
101 ; CHECK-P7-NEXT: or 9, 9, 7
102 ; CHECK-P7-NEXT: stwcx. 9, 0, 4
103 ; CHECK-P7-NEXT: bne 0, .LBB0_1
104 ; CHECK-P7-NEXT: b .LBB0_4
105 ; CHECK-P7-NEXT: .LBB0_3: # %L.entry
106 ; CHECK-P7-NEXT: stwcx. 9, 0, 4
107 ; CHECK-P7-NEXT: .LBB0_4: # %L.entry
108 ; CHECK-P7-NEXT: srw 3, 6, 3
109 ; CHECK-P7-NEXT: lwsync
110 ; CHECK-P7-NEXT: cmplwi 3, 33059
111 ; CHECK-P7-NEXT: bne 0, .LBB0_7
112 ; CHECK-P7-NEXT: # %bb.5: # %L.B0000
113 ; CHECK-P7-NEXT: lhz 3, 46(1)
114 ; CHECK-P7-NEXT: cmplwi 3, 234
115 ; CHECK-P7-NEXT: bne 0, .LBB0_8
116 ; CHECK-P7-NEXT: # %bb.6: # %L.B0001
117 ; CHECK-P7-NEXT: addis 3, 2, .Lstr.2@toc@ha
118 ; CHECK-P7-NEXT: addi 3, 3, .Lstr.2@toc@l
119 ; CHECK-P7-NEXT: bl puts
120 ; CHECK-P7-NEXT: nop
121 ; CHECK-P7-NEXT: li 3, 0
122 ; CHECK-P7-NEXT: b .LBB0_10
123 ; CHECK-P7-NEXT: .LBB0_7: # %L.B0003
124 ; CHECK-P7-NEXT: addis 3, 2, .Lstr@toc@ha
125 ; CHECK-P7-NEXT: addi 3, 3, .Lstr@toc@l
126 ; CHECK-P7-NEXT: b .LBB0_9
127 ; CHECK-P7-NEXT: .LBB0_8: # %L.B0005
128 ; CHECK-P7-NEXT: addis 3, 2, .Lstr.1@toc@ha
129 ; CHECK-P7-NEXT: addi 3, 3, .Lstr.1@toc@l
130 ; CHECK-P7-NEXT: .LBB0_9: # %L.B0003
131 ; CHECK-P7-NEXT: bl puts
132 ; CHECK-P7-NEXT: nop
133 ; CHECK-P7-NEXT: li 3, 1
134 ; CHECK-P7-NEXT: .LBB0_10: # %L.B0003
135 ; CHECK-P7-NEXT: addi 1, 1, 48
136 ; CHECK-P7-NEXT: ld 0, 16(1)
137 ; CHECK-P7-NEXT: mtlr 0
138 ; CHECK-P7-NEXT: blr
67139 L.entry:
68140 %value.addr = alloca i16, align 2
69141 store i16 -32477, i16* %value.addr, align 2
214214 asm = common.SCRUB_WHITESPACE_RE.sub(r' ', asm)
215215 # Expand the tabs used for indentation.
216216 asm = string.expandtabs(asm, 2)
217 # Stripe unimportant comments
218 asm = SCRUB_LOOP_COMMENT_RE.sub(r'', asm)
217 # Stripe unimportant comments, but leave the token '#' in place.
218 asm = SCRUB_LOOP_COMMENT_RE.sub(r'#', asm)
219219 # Strip trailing whitespace.
220220 asm = common.SCRUB_TRAILING_WHITESPACE_RE.sub(r'', asm)
221221 return asm