]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - test/CodeGen/X86/2011-09-14-valcoalesce.ll
[X86][AVX] Simplified diff between AVX1 and SSE42 fp stack folding tests. NFC.
[opencl/llvm.git] / test / CodeGen / X86 / 2011-09-14-valcoalesce.ll
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.
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:
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)
40 ; If it ever reverts to reusing the pre-addition register then we should
41 ; *probably* check this instead (it certainly worked last time):
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
59 target 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"
61 @.str3 = external unnamed_addr constant [59 x i8], align 1
63 define void @BZ2_compressBlock() nounwind ssp {
64 entry:
65   br i1 undef, label %if.then68, label %if.end85
67 if.then68:                                        ; preds = %entry
68   br label %for.body.i.i
70 for.body.i.i:                                     ; preds = %for.inc.i.i, %if.then68
71   br i1 undef, label %for.inc.i.i, label %if.then.i.i
73 if.then.i.i:                                      ; preds = %for.body.i.i
74   br label %for.inc.i.i
76 for.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
79 makeMaps_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
82 for.cond.for.cond19.preheader_crit_edge.i:        ; preds = %makeMaps_e.exit.i
83   unreachable
85 for.cond19.preheader.i:                           ; preds = %makeMaps_e.exit.i
86   br i1 undef, label %for.body25.lr.ph.i, label %for.cond33.preheader.i
88 for.body25.lr.ph.i:                               ; preds = %for.cond19.preheader.i
89   br label %for.body25.i
91 for.cond33.preheader.i:                           ; preds = %for.body25.i, %for.cond19.preheader.i
92   br i1 undef, label %if.then.i, label %if.end.i
94 for.body25.i:                                     ; preds = %for.body25.i, %for.body25.lr.ph.i
95   br i1 undef, label %for.body25.i, label %for.cond33.preheader.i
97 if.then.i:                                        ; preds = %for.cond33.preheader.i
98   br label %if.end.i
100 if.end.i:                                         ; preds = %if.then.i, %for.cond33.preheader.i
101   br i1 undef, label %for.inc27.us.5.i, label %for.end30.i
103 for.end30.i:                                      ; preds = %for.inc27.us.5.i, %if.end.i
104   br i1 undef, label %if.end36.i, label %if.then35.i
106 if.then35.i:                                      ; preds = %for.end30.i
107   unreachable
109 if.end36.i:                                       ; preds = %for.end30.i
110   %sub83.i = add nsw i32 undef, 1
111   br label %while.body.i188
113 for.cond182.preheader.i:                          ; preds = %for.end173.i
114   br i1 undef, label %for.inc220.us.i, label %while.body300.preheader.i
116 while.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
121 while.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* 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
129 while.end.i:                                      ; preds = %while.body85.i
130   br i1 undef, label %land.lhs.true.i, label %if.end117.i
132 land.lhs.true.i:                                  ; preds = %while.end.i
133   br i1 undef, label %land.lhs.true103.i, label %if.end117.i
135 land.lhs.true103.i:                               ; preds = %land.lhs.true.i
136   br i1 undef, label %if.then108.i, label %if.end117.i
138 if.then108.i:                                     ; preds = %land.lhs.true103.i
139   br label %if.end117.i
141 if.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
146 if.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
150 for.cond138.preheader.i:                          ; preds = %if.then122.i, %if.end117.i
151   br i1 undef, label %for.body143.lr.ph.i, label %for.end173.i
153 for.body143.lr.ph.i:                              ; preds = %for.cond138.preheader.i
154   br label %for.body143.i
156 for.body143.i:                                    ; preds = %for.body143.i, %for.body143.lr.ph.i
157   br i1 undef, label %for.end173.i, label %for.body143.i
159 for.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
164 for.inc220.us.i:                                  ; preds = %for.cond182.preheader.i
165   unreachable
167 while.body300.preheader.i:                        ; preds = %for.cond182.preheader.i
168   br i1 undef, label %for.end335.i, label %while.end2742.i
170 for.end335.i:                                     ; preds = %for.end2039.i, %while.body300.preheader.i
171   br label %for.body2021.i
173 for.body2021.i:                                   ; preds = %for.body2021.i, %for.end335.i
174   br i1 undef, label %for.body2021.i, label %for.end2039.i
176 for.end2039.i:                                    ; preds = %for.body2021.i
177   br label %for.end335.i
179 while.end2742.i:                                  ; preds = %while.body300.preheader.i
180   br i1 undef, label %if.then2748.i, label %for.body2778.i
182 if.then2748.i:                                    ; preds = %while.end2742.i
183   unreachable
185 for.body2778.i:                                   ; preds = %while.end2742.i
186   unreachable
188 for.inc27.us.5.i:                                 ; preds = %if.end.i
189   br label %for.end30.i
191 if.end85:                                         ; preds = %entry
192   ret void
195 declare void @fprintf(...) nounwind