Add compile command to each testcase
[gcc-vect-testsuite.git] / no-scevccp-outer-6-global.ll
blobc6df9d7826c943e3f07140e9318c9aba1885265b
1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 no-scevccp-outer-6-global.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-scevccp-outer-6-global.s > no-scevccp-outer-6-global.ll
6 ; ModuleID = 'no-scevccp-outer-6-global.s'
7 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
8 target triple = "x86_64-unknown-linux-gnu"
10 @a = common global [40 x i32] zeroinitializer, align 16
12 define i32 @foo(i32* noalias %b, i32 %k) nounwind uwtable noinline {
13 entry:
14   br label %for.cond
16 for.cond:                                         ; preds = %for.inc15, %entry
17   %indvar = phi i64 [ %indvar.next, %for.inc15 ], [ 0, %entry ]
18   %arrayidx14 = getelementptr [40 x i32]* @a, i64 0, i64 %indvar
19   %arrayidx = getelementptr i32* %b, i64 %indvar
20   %exitcond1 = icmp ne i64 %indvar, 40
21   br i1 %exitcond1, label %for.body, label %for.end18
23 for.body:                                         ; preds = %for.cond
24   %tmp3 = load i32* %arrayidx, align 4
25   br label %for.cond4
27 for.cond4:                                        ; preds = %for.inc, %for.body
28   %tmp4 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
29   %exitcond = icmp ne i32 %tmp4, 40
30   br i1 %exitcond, label %for.body7, label %for.end
32 for.body7:                                        ; preds = %for.cond4
33   br label %for.inc
35 for.inc:                                          ; preds = %for.body7
36   %inc = add nsw i32 %tmp4, 1
37   br label %for.cond4
39 for.end:                                          ; preds = %for.cond4
40   %tmp = add i32 %tmp3, 780
41   store i32 %tmp, i32* %arrayidx14, align 4
42   br label %for.inc15
44 for.inc15:                                        ; preds = %for.end
45   %indvar.next = add i64 %indvar, 1
46   br label %for.cond
48 for.end18:                                        ; preds = %for.cond
49   %idxprom20 = sext i32 %k to i64
50   %arrayidx21 = getelementptr inbounds [40 x i32]* @a, i64 0, i64 %idxprom20
51   %tmp22 = load i32* %arrayidx21, align 4
52   ret i32 %tmp22
55 define i32 @main() nounwind uwtable {
56 entry:
57   %b = alloca [40 x i32], align 16
58   %a = alloca [40 x i32], align 16
59   call void @check_vect()
60   br label %for.cond
62 for.cond:                                         ; preds = %for.inc, %entry
63   %indvar6 = phi i64 [ %indvar.next7, %for.inc ], [ 0, %entry ]
64   %arrayidx = getelementptr [40 x i32]* %b, i64 0, i64 %indvar6
65   %tmp9 = add i64 %indvar6, 2
66   %add = trunc i64 %tmp9 to i32
67   %exitcond8 = icmp ne i64 %indvar6, 40
68   br i1 %exitcond8, label %for.body, label %for.end
70 for.body:                                         ; preds = %for.cond
71   store i32 %add, i32* %arrayidx, align 4
72   br label %for.inc
74 for.inc:                                          ; preds = %for.body
75   %indvar.next7 = add i64 %indvar6, 1
76   br label %for.cond
78 for.end:                                          ; preds = %for.cond
79   br label %for.cond4
81 for.cond4:                                        ; preds = %for.inc12, %for.end
82   %indvar2 = phi i64 [ %indvar.next3, %for.inc12 ], [ 0, %for.end ]
83   %arrayidx11 = getelementptr [40 x i32]* %a, i64 0, i64 %indvar2
84   %i.1 = trunc i64 %indvar2 to i32
85   %exitcond4 = icmp ne i64 %indvar2, 40
86   br i1 %exitcond4, label %for.body7, label %for.end15
88 for.body7:                                        ; preds = %for.cond4
89   %arraydecay = getelementptr inbounds [40 x i32]* %b, i64 0, i64 0
90   %call = call i32 @foo(i32* %arraydecay, i32 %i.1)
91   store i32 %call, i32* %arrayidx11, align 4
92   br label %for.inc12
94 for.inc12:                                        ; preds = %for.body7
95   %indvar.next3 = add i64 %indvar2, 1
96   br label %for.cond4
98 for.end15:                                        ; preds = %for.cond4
99   br label %for.cond16
101 for.cond16:                                       ; preds = %for.inc41, %for.end15
102   %indvar = phi i64 [ %indvar.next, %for.inc41 ], [ 0, %for.end15 ]
103   %arrayidx37 = getelementptr [40 x i32]* %a, i64 0, i64 %indvar
104   %arrayidx22 = getelementptr [40 x i32]* %b, i64 0, i64 %indvar
105   %i.2 = trunc i64 %indvar to i32
106   %cmp18 = icmp slt i32 %i.2, 40
107   br i1 %cmp18, label %for.body19, label %for.end44
109 for.body19:                                       ; preds = %for.cond16
110   %tmp23 = load i32* %arrayidx22, align 4
111   br label %for.cond24
113 for.cond24:                                       ; preds = %for.inc31, %for.body19
114   %tmp12 = phi i32 [ 0, %for.body19 ], [ %inc33, %for.inc31 ]
115   %exitcond = icmp ne i32 %tmp12, 40
116   br i1 %exitcond, label %for.body27, label %for.end34
118 for.body27:                                       ; preds = %for.cond24
119   br label %for.inc31
121 for.inc31:                                        ; preds = %for.body27
122   %inc33 = add nsw i32 %tmp12, 1
123   br label %for.cond24
125 for.end34:                                        ; preds = %for.cond24
126   %tmp = add i32 %tmp23, 780
127   %tmp38 = load i32* %arrayidx37, align 4
128   %cmp40 = icmp eq i32 %tmp38, %tmp
129   br i1 %cmp40, label %if.end, label %if.then
131 if.then:                                          ; preds = %for.end34
132   call void @abort() noreturn nounwind
133   unreachable
135 if.end:                                           ; preds = %for.end34
136   br label %for.inc41
138 for.inc41:                                        ; preds = %if.end
139   %indvar.next = add i64 %indvar, 1
140   br label %for.cond16
142 for.end44:                                        ; preds = %for.cond16
143   ret i32 0
146 define internal void @check_vect() nounwind uwtable noinline {
147 entry:
148   %a = alloca i32, align 4
149   %b = alloca i32, align 4
150   %c = alloca i32, align 4
151   %d = alloca i32, align 4
152   %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
153   %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
154   %tobool = icmp eq i32 %call1, 0
155   br i1 %tobool, label %if.then, label %lor.lhs.false
157 lor.lhs.false:                                    ; preds = %entry
158   %tmp4 = load i32* %d, align 4
159   %and6 = and i32 %tmp4, 67108864
160   %cmp = icmp eq i32 %and6, 0
161   br i1 %cmp, label %if.then, label %if.end
163 if.then:                                          ; preds = %entry, %lor.lhs.false
164   call void @exit(i32 0) noreturn nounwind
165   unreachable
167 if.end:                                           ; preds = %lor.lhs.false
168   %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
169   ret void
172 declare void @abort() noreturn
174 declare void (i32)* @signal(i32, void (i32)*) nounwind
176 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
177 entry:
178   call void @exit(i32 0) noreturn nounwind
179   unreachable
181 return:                                           ; No predecessors!
182   ret void
185 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
186 entry:
187   %and = and i32 %__level, -2147483648
188   %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
189   %cmp = icmp ult i32 %call, %__level
190   br i1 %cmp, label %if.then, label %if.end
192 if.then:                                          ; preds = %entry
193   br label %return
195 if.end:                                           ; preds = %entry
196   %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
197   %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
198   %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
199   %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
200   %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
201   store i32 %asmresult, i32* %__eax, align 4
202   store i32 %asmresult8, i32* %__ebx, align 4
203   store i32 %asmresult9, i32* %__ecx, align 4
204   store i32 %asmresult10, i32* %__edx, align 4
205   br label %return
207 return:                                           ; preds = %if.end, %if.then
208   %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
209   ret i32 %retval.0
212 declare void @exit(i32) noreturn
214 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
215 entry:
216   %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
217   %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
218   %tobool = icmp eq i32* %__sig, null
219   br i1 %tobool, label %if.end, label %if.then
221 if.then:                                          ; preds = %entry
222   %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
223   store i32 %asmresult1, i32* %__sig, align 4
224   br label %if.end
226 if.end:                                           ; preds = %entry, %if.then
227   ret i32 %asmresult
230 !0 = metadata !{i32 -2147343334, i32 -2147343326} 
231 !1 = metadata !{i32 -2147343457, i32 -2147343449} 
232 ; CHECK: define