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 slp-perm-1.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-perm-1.s > slp-perm-1.ll
6 ; ModuleID = 'slp-perm-1.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 @main.check_results = internal unnamed_addr constant [16 x i32] [i32 1470, i32 395, i32 28271, i32 5958, i32 1655, i32 111653, i32 10446, i32 2915, i32 195035, i32 14934, i32 4175, i32 278417, i32 19422, i32 5435, i32 361799, i32 0], align 16
12 define void @foo(i32* noalias %pInput, i32* noalias %pOutput) nounwind uwtable {
16 for.cond: ; preds = %for.inc, %entry
17 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
18 %tmp = mul i64 %indvar, 3
19 %tmp1 = add i64 %tmp, 2
20 %incdec.ptr26 = getelementptr i32* %pOutput, i64 %tmp1
21 %tmp3 = add i64 %tmp, 1
22 %incdec.ptr16 = getelementptr i32* %pOutput, i64 %tmp3
23 %pOutput.addr.0 = getelementptr i32* %pOutput, i64 %tmp
24 %incdec.ptr4 = getelementptr i32* %pInput, i64 %tmp1
25 %incdec.ptr = getelementptr i32* %pInput, i64 %tmp3
26 %pInput.addr.0 = getelementptr i32* %pInput, i64 %tmp
27 %exitcond = icmp ne i64 %indvar, 5
28 br i1 %exitcond, label %for.body, label %for.end
30 for.body: ; preds = %for.cond
31 %tmp2 = load i32* %pInput.addr.0, align 4
32 %tmp5 = load i32* %incdec.ptr, align 4
33 %tmp8 = load i32* %incdec.ptr4, align 4
34 %mul = mul i32 %tmp2, 100
35 %mul11 = mul i32 %tmp5, 1322
36 %add = add i32 %mul, %mul11
37 %mul13 = mul i32 %tmp8, 74
38 %add14 = add i32 %add, %mul13
39 store i32 %add14, i32* %pOutput.addr.0, align 4
40 %mul18 = mul i32 %tmp2, 216
41 %mul20 = mul i32 %tmp5, 13
42 %add21 = add i32 %mul18, %mul20
43 %mul23 = mul i32 %tmp8, 191
44 %add24 = add i32 %add21, %mul23
45 store i32 %add24, i32* %incdec.ptr16, align 4
46 %mul28 = mul i32 %tmp2, 23
47 %mul30 = mul i32 %tmp5, 27271
48 %add31 = add i32 %mul28, %mul30
49 %mul33 = mul i32 %tmp8, 500
50 %add34 = add i32 %add31, %mul33
51 store i32 %add34, i32* %incdec.ptr26, align 4
54 for.inc: ; preds = %for.body
55 %indvar.next = add i64 %indvar, 1
58 for.end: ; preds = %for.cond
62 define i32 @main(i32 %argc, i8** %argv) nounwind uwtable {
64 %input = alloca [16 x i32], align 16
65 %output = alloca [16 x i32], align 16
66 %check_results = alloca [16 x i32], align 16
67 %tmp = bitcast [16 x i32]* %check_results to i8*
68 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([16 x i32]* @main.check_results to i8*), i64 64, i32 16, i1 false)
69 call void @check_vect()
72 for.cond: ; preds = %for.inc, %entry
73 %indvar2 = phi i64 [ %indvar.next3, %for.inc ], [ 0, %entry ]
74 %i.0 = trunc i64 %indvar2 to i32
75 %arrayidx6 = getelementptr [16 x i32]* %output, i64 0, i64 %indvar2
76 %arrayidx = getelementptr [16 x i32]* %input, i64 0, i64 %indvar2
77 %exitcond = icmp ne i64 %indvar2, 16
78 br i1 %exitcond, label %for.body, label %for.end
80 for.body: ; preds = %for.cond
81 store i32 %i.0, i32* %arrayidx, align 4
82 store i32 0, i32* %arrayidx6, align 4
83 call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0
86 for.inc: ; preds = %for.body
87 %indvar.next3 = add i64 %indvar2, 1
90 for.end: ; preds = %for.cond
91 %arraydecay = getelementptr inbounds [16 x i32]* %input, i64 0, i64 0
92 %arraydecay8 = getelementptr inbounds [16 x i32]* %output, i64 0, i64 0
93 call void @foo(i32* %arraydecay, i32* %arraydecay8)
96 for.cond9: ; preds = %for.inc22, %for.end
97 %indvar = phi i64 [ %indvar.next, %for.inc22 ], [ 0, %for.end ]
98 %arrayidx19 = getelementptr [16 x i32]* %check_results, i64 0, i64 %indvar
99 %arrayidx15 = getelementptr [16 x i32]* %output, i64 0, i64 %indvar
100 %i.1 = trunc i64 %indvar to i32
101 %cmp11 = icmp ult i32 %i.1, 16
102 br i1 %cmp11, label %for.body12, label %for.end25
104 for.body12: ; preds = %for.cond9
105 %tmp16 = load i32* %arrayidx15, align 4
106 %tmp20 = load i32* %arrayidx19, align 4
107 %cmp21 = icmp eq i32 %tmp16, %tmp20
108 br i1 %cmp21, label %if.end, label %if.then
110 if.then: ; preds = %for.body12
111 call void @abort() noreturn nounwind
114 if.end: ; preds = %for.body12
115 call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !1
118 for.inc22: ; preds = %if.end
119 %indvar.next = add i64 %indvar, 1
122 for.end25: ; preds = %for.cond9
126 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
128 define internal void @check_vect() nounwind uwtable noinline {
130 %a = alloca i32, align 4
131 %b = alloca i32, align 4
132 %c = alloca i32, align 4
133 %d = alloca i32, align 4
134 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
135 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
136 %tobool = icmp eq i32 %call1, 0
137 br i1 %tobool, label %if.then, label %lor.lhs.false
139 lor.lhs.false: ; preds = %entry
140 %tmp4 = load i32* %d, align 4
141 %and6 = and i32 %tmp4, 67108864
142 %cmp = icmp eq i32 %and6, 0
143 br i1 %cmp, label %if.then, label %if.end
145 if.then: ; preds = %entry, %lor.lhs.false
146 call void @exit(i32 0) noreturn nounwind
149 if.end: ; preds = %lor.lhs.false
150 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
154 declare void @abort() noreturn
156 declare void (i32)* @signal(i32, void (i32)*) nounwind
158 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
160 call void @exit(i32 0) noreturn nounwind
163 return: ; No predecessors!
167 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
169 %and = and i32 %__level, -2147483648
170 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
171 %cmp = icmp ult i32 %call, %__level
172 br i1 %cmp, label %if.then, label %if.end
174 if.then: ; preds = %entry
177 if.end: ; preds = %entry
178 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !2
179 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
180 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
181 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
182 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
183 store i32 %asmresult, i32* %__eax, align 4
184 store i32 %asmresult8, i32* %__ebx, align 4
185 store i32 %asmresult9, i32* %__ecx, align 4
186 store i32 %asmresult10, i32* %__edx, align 4
189 return: ; preds = %if.end, %if.then
190 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
194 declare void @exit(i32) noreturn
196 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
198 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !3
199 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
200 %tobool = icmp eq i32* %__sig, null
201 br i1 %tobool, label %if.end, label %if.then
203 if.then: ; preds = %entry
204 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
205 store i32 %asmresult1, i32* %__sig, align 4
208 if.end: ; preds = %entry, %if.then
212 !0 = metadata !{i32 964}
213 !1 = metadata !{i32 1108}
214 !2 = metadata !{i32 -2147342940, i32 -2147342932}
215 !3 = metadata !{i32 -2147343063, i32 -2147343055}