• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86 -disable-block-placement | FileCheck %s
2;
3; Test RegistersDefinedFromSameValue. We have multiple copies of the same vreg:
4; while.body85.i:
5;   vreg1 = copy vreg2
6;   vreg2 = add
7; critical edge from land.lhs.true.i -> if.end117.i:
8;   vreg27 = vreg2
9; critical edge from land.lhs.true103.i -> if.end117.i:
10;   vreg27 = vreg2
11; if.then108.i:
12;   vreg27 = vreg1
13;
14; Prior to fixing PR10920 401.bzip miscompile, the coalescer would
15; consider vreg1 and vreg27 to be copies of the same value. It would
16; then remove one of the critical edge copes, which cannot safely be removed.
17
18; There are two obvious ways the register-allocator could go here, either
19; reusing the pre-addition register later, or the post-addition one. Currently,
20; it does the latter, so we check:
21
22; CHECK: # %while.body85.i{{$}}
23; CHECK-NOT: # %
24; CHECK-NOT: add
25; CHECK: movl %[[POSTR:e[abcdxi]+]], %[[PRER:e[abcdxi]+]]
26; CHECK: addl %{{.*}}, %[[POSTR]]
27; CHECK: # %while.end.i
28; CHECK-NOT: movl %[[POSTR]]
29; CHECK: # %land.lhs.true.i
30; CHECK-NOT: movl %[[POSTR]]
31; CHECK: # %land.lhs.true103.i
32; CHECK-NOT: movl %[[POSTR]]
33; CHECK: # %if.then108.i
34; CHECK: movl %[[PRER]], %[[POSTR]]
35; CHECK: # %if.end117.i
36;   and use it for fprintf:
37; CHECK: movl %[[POSTR]], 12(%esp)
38
39
40; If it ever reverts to reusing the pre-addition register then we should
41; *probably* check this instead (it certainly worked last time):
42
43; CHECKALT: # %while.body85.i
44; CHECKALT-NOT: # %
45; CHECKALT-NOT: add
46; CHECKALT: movl %[[POSTR:e[abcdxi]+]], %[[PRER:e[abcdxi]+]]
47; CHECKALT: addl %{{.*}}, %[[POSTR]]
48; CHECKALT: # %while.end.i
49; CHECKALT: movl %[[POSTR]], %[[USER:e[abcdxi]+]]
50; CHECKALT: # %land.lhs.true.i
51; CHECKALT: movl %[[POSTR]], %[[USER]]
52; CHECKALT: # %land.lhs.true103.i
53; CHECKALT: movl %[[POSTR]], %[[USER]]
54; CHECKALT: # %if.then108.i
55; [[PRER] live out, so nothing on this path should define it.
56; CHECKALT-NOT: , %[[PRER]]
57; CHECKALT: # %if.end117.i
58
59target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
60
61@.str3 = external unnamed_addr constant [59 x i8], align 1
62
63define void @BZ2_compressBlock() nounwind ssp {
64entry:
65  br i1 undef, label %if.then68, label %if.end85
66
67if.then68:                                        ; preds = %entry
68  br label %for.body.i.i
69
70for.body.i.i:                                     ; preds = %for.inc.i.i, %if.then68
71  br i1 undef, label %for.inc.i.i, label %if.then.i.i
72
73if.then.i.i:                                      ; preds = %for.body.i.i
74  br label %for.inc.i.i
75
76for.inc.i.i:                                      ; preds = %if.then.i.i, %for.body.i.i
77  br i1 undef, label %makeMaps_e.exit.i, label %for.body.i.i
78
79makeMaps_e.exit.i:                                ; preds = %for.inc.i.i
80  br i1 undef, label %for.cond19.preheader.i, label %for.cond.for.cond19.preheader_crit_edge.i
81
82for.cond.for.cond19.preheader_crit_edge.i:        ; preds = %makeMaps_e.exit.i
83  unreachable
84
85for.cond19.preheader.i:                           ; preds = %makeMaps_e.exit.i
86  br i1 undef, label %for.body25.lr.ph.i, label %for.cond33.preheader.i
87
88for.body25.lr.ph.i:                               ; preds = %for.cond19.preheader.i
89  br label %for.body25.i
90
91for.cond33.preheader.i:                           ; preds = %for.body25.i, %for.cond19.preheader.i
92  br i1 undef, label %if.then.i, label %if.end.i
93
94for.body25.i:                                     ; preds = %for.body25.i, %for.body25.lr.ph.i
95  br i1 undef, label %for.body25.i, label %for.cond33.preheader.i
96
97if.then.i:                                        ; preds = %for.cond33.preheader.i
98  br label %if.end.i
99
100if.end.i:                                         ; preds = %if.then.i, %for.cond33.preheader.i
101  br i1 undef, label %for.inc27.us.5.i, label %for.end30.i
102
103for.end30.i:                                      ; preds = %for.inc27.us.5.i, %if.end.i
104  br i1 undef, label %if.end36.i, label %if.then35.i
105
106if.then35.i:                                      ; preds = %for.end30.i
107  unreachable
108
109if.end36.i:                                       ; preds = %for.end30.i
110  %sub83.i = add nsw i32 undef, 1
111  br label %while.body.i188
112
113for.cond182.preheader.i:                          ; preds = %for.end173.i
114  br i1 undef, label %for.inc220.us.i, label %while.body300.preheader.i
115
116while.body.i188:                                  ; preds = %for.end173.i, %if.end36.i
117  %gs.0526.i = phi i32 [ 0, %if.end36.i ], [ %add177.i, %for.end173.i ]
118  %or.cond514517.i = and i1 false, undef
119  br i1 %or.cond514517.i, label %while.body85.i, label %if.end117.i
120
121while.body85.i:                                   ; preds = %while.body85.i, %while.body.i188
122  %aFreq.0518.i = phi i32 [ %add93.i, %while.body85.i ], [ 0, %while.body.i188 ]
123  %inc87.i = add nsw i32 0, 1
124  %tmp91.i = load i32, i32* undef, align 4
125  %add93.i = add nsw i32 %tmp91.i, %aFreq.0518.i
126  %or.cond514.i = and i1 undef, false
127  br i1 %or.cond514.i, label %while.body85.i, label %while.end.i
128
129while.end.i:                                      ; preds = %while.body85.i
130  br i1 undef, label %land.lhs.true.i, label %if.end117.i
131
132land.lhs.true.i:                                  ; preds = %while.end.i
133  br i1 undef, label %land.lhs.true103.i, label %if.end117.i
134
135land.lhs.true103.i:                               ; preds = %land.lhs.true.i
136  br i1 undef, label %if.then108.i, label %if.end117.i
137
138if.then108.i:                                     ; preds = %land.lhs.true103.i
139  br label %if.end117.i
140
141if.end117.i:                                      ; preds = %if.then108.i, %land.lhs.true103.i, %land.lhs.true.i, %while.end.i, %while.body.i188
142  %aFreq.1.i = phi i32 [ %aFreq.0518.i, %if.then108.i ], [ %add93.i, %land.lhs.true103.i ], [ %add93.i, %land.lhs.true.i ], [ %add93.i, %while.end.i ], [ 0, %while.body.i188 ]
143  %ge.1.i = phi i32 [ 0, %if.then108.i ], [ %inc87.i, %land.lhs.true103.i ], [ %inc87.i, %land.lhs.true.i ], [ %inc87.i, %while.end.i ], [ 0, %while.body.i188 ]
144  br i1 undef, label %if.then122.i, label %for.cond138.preheader.i
145
146if.then122.i:                                     ; preds = %if.end117.i
147  call void (...) @fprintf(i32 undef, i32 %gs.0526.i, i32 %ge.1.i, i32 %aFreq.1.i, double undef) nounwind
148  br label %for.cond138.preheader.i
149
150for.cond138.preheader.i:                          ; preds = %if.then122.i, %if.end117.i
151  br i1 undef, label %for.body143.lr.ph.i, label %for.end173.i
152
153for.body143.lr.ph.i:                              ; preds = %for.cond138.preheader.i
154  br label %for.body143.i
155
156for.body143.i:                                    ; preds = %for.body143.i, %for.body143.lr.ph.i
157  br i1 undef, label %for.end173.i, label %for.body143.i
158
159for.end173.i:                                     ; preds = %for.body143.i, %for.cond138.preheader.i
160  %add177.i = add nsw i32 %ge.1.i, 1
161  %cmp73.i = icmp sgt i32 undef, 0
162  br i1 %cmp73.i, label %while.body.i188, label %for.cond182.preheader.i
163
164for.inc220.us.i:                                  ; preds = %for.cond182.preheader.i
165  unreachable
166
167while.body300.preheader.i:                        ; preds = %for.cond182.preheader.i
168  br i1 undef, label %for.end335.i, label %while.end2742.i
169
170for.end335.i:                                     ; preds = %for.end2039.i, %while.body300.preheader.i
171  br label %for.body2021.i
172
173for.body2021.i:                                   ; preds = %for.body2021.i, %for.end335.i
174  br i1 undef, label %for.body2021.i, label %for.end2039.i
175
176for.end2039.i:                                    ; preds = %for.body2021.i
177  br label %for.end335.i
178
179while.end2742.i:                                  ; preds = %while.body300.preheader.i
180  br i1 undef, label %if.then2748.i, label %for.body2778.i
181
182if.then2748.i:                                    ; preds = %while.end2742.i
183  unreachable
184
185for.body2778.i:                                   ; preds = %while.end2742.i
186  unreachable
187
188for.inc27.us.5.i:                                 ; preds = %if.end.i
189  br label %for.end30.i
190
191if.end85:                                         ; preds = %entry
192  ret void
193}
194
195declare void @fprintf(...) nounwind
196