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-8.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-perm-8.s > slp-perm-8.ll
6 ; ModuleID = 'slp-perm-8.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 define void @foo(i8* noalias %pInput, i8* noalias %pOutput) nounwind uwtable {
14 for.cond: ; preds = %for.inc, %entry
15 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
16 %tmp = mul i64 %indvar, 3
17 %tmp1 = add i64 %tmp, 2
18 %incdec.ptr32 = getelementptr i8* %pOutput, i64 %tmp1
19 %tmp2 = add i64 %tmp, 1
20 %incdec.ptr20 = getelementptr i8* %pOutput, i64 %tmp2
21 %pOutput.addr.0 = getelementptr i8* %pOutput, i64 %tmp
22 %incdec.ptr5 = getelementptr i8* %pInput, i64 %tmp1
23 %incdec.ptr = getelementptr i8* %pInput, i64 %tmp2
24 %pInput.addr.0 = getelementptr i8* %pInput, i64 %tmp
25 %exitcond = icmp ne i64 %indvar, 66
26 br i1 %exitcond, label %for.body, label %for.end
28 for.body: ; preds = %for.cond
29 %tmp3 = load i8* %pInput.addr.0, align 1
30 %tmp6 = load i8* %incdec.ptr, align 1
31 %tmp9 = load i8* %incdec.ptr5, align 1
32 %add = add i8 %tmp3, %tmp6
33 %add16 = add i8 %add, %tmp9
34 %add17 = add i8 %add16, 3
35 store i8 %add17, i8* %pOutput.addr.0, align 1
36 %add25 = add i8 %tmp3, %tmp6
37 %add28 = add i8 %add25, %tmp9
38 %add29 = add i8 %add28, 12
39 store i8 %add29, i8* %incdec.ptr20, align 1
40 %add37 = add i8 %tmp3, %tmp6
41 %add40 = add i8 %add37, %tmp9
42 %add41 = add i8 %add40, 1
43 store i8 %add41, i8* %incdec.ptr32, align 1
46 for.inc: ; preds = %for.body
47 %indvar.next = add i64 %indvar, 1
50 for.end: ; preds = %for.cond
54 define i32 @main(i32 %argc, i8** %argv) nounwind uwtable {
56 %input = alloca [200 x i8], align 16
57 %output = alloca [200 x i8], align 16
58 %check_results = alloca [200 x i8], align 16
59 call void @check_vect()
62 for.cond: ; preds = %for.inc, %entry
63 %indvar16 = phi i64 [ %indvar.next17, %for.inc ], [ 0, %entry ]
64 %i.0 = trunc i64 %indvar16 to i8
65 %arrayidx6 = getelementptr [200 x i8]* %output, i64 0, i64 %indvar16
66 %arrayidx = getelementptr [200 x i8]* %input, i64 0, i64 %indvar16
67 %cmp = icmp ult i8 %i.0, -56
68 br i1 %cmp, label %for.body, label %for.end
70 for.body: ; preds = %for.cond
71 store i8 %i.0, i8* %arrayidx, align 1
72 store i8 0, i8* %arrayidx6, align 1
73 br i1 false, label %if.then, label %if.end
75 if.then: ; preds = %for.body
78 if.end: ; preds = %for.body
81 for.inc: ; preds = %if.end
82 %indvar.next17 = add i64 %indvar16, 1
85 for.end: ; preds = %for.cond
88 for.cond15: ; preds = %for.inc51, %for.end
89 %indvar4 = phi i64 [ %indvar.next5, %for.inc51 ], [ 0, %for.end ]
90 %tmp = mul i64 %indvar4, 3
91 %tmp6 = add i64 %tmp, 2
92 %arrayidx50 = getelementptr [200 x i8]* %check_results, i64 0, i64 %tmp6
93 %tmp7 = mul i64 %indvar4, 9
94 %tmp8 = add i64 %tmp7, 4
95 %add43 = trunc i64 %tmp8 to i8
96 %tmp10 = add i64 %tmp, 1
97 %arrayidx39 = getelementptr [200 x i8]* %check_results, i64 0, i64 %tmp10
98 %tmp11 = add i64 %tmp7, 15
99 %add32 = trunc i64 %tmp11 to i8
100 %arrayidx28 = getelementptr [200 x i8]* %check_results, i64 0, i64 %tmp
101 %tmp13 = add i64 %tmp7, 6
102 %add = trunc i64 %tmp13 to i8
103 %exitcond = icmp ne i64 %indvar4, 66
104 br i1 %exitcond, label %for.body20, label %for.end54
106 for.body20: ; preds = %for.cond15
107 store i8 %add, i8* %arrayidx28, align 1
108 store i8 %add32, i8* %arrayidx39, align 1
109 store i8 %add43, i8* %arrayidx50, align 1
112 for.inc51: ; preds = %for.body20
113 %indvar.next5 = add i64 %indvar4, 1
116 for.end54: ; preds = %for.cond15
117 %arraydecay = getelementptr inbounds [200 x i8]* %input, i64 0, i64 0
118 %arraydecay55 = getelementptr inbounds [200 x i8]* %output, i64 0, i64 0
119 call void @foo(i8* %arraydecay, i8* %arraydecay55)
122 for.cond56: ; preds = %for.inc76, %for.end54
123 %indvar = phi i64 [ %indvar.next, %for.inc76 ], [ 0, %for.end54 ]
124 %i.2 = trunc i64 %indvar to i8
125 %arrayidx69 = getelementptr [200 x i8]* %check_results, i64 0, i64 %indvar
126 %arrayidx64 = getelementptr [200 x i8]* %output, i64 0, i64 %indvar
127 %cmp59 = icmp ult i8 %i.2, -58
128 br i1 %cmp59, label %for.body61, label %for.end79
130 for.body61: ; preds = %for.cond56
131 %tmp65 = load i8* %arrayidx64, align 1
132 %tmp70 = load i8* %arrayidx69, align 1
133 %cmp72 = icmp eq i8 %tmp65, %tmp70
134 br i1 %cmp72, label %if.end75, label %if.then74
136 if.then74: ; preds = %for.body61
137 call void @abort() noreturn nounwind
140 if.end75: ; preds = %for.body61
143 for.inc76: ; preds = %if.end75
144 %indvar.next = add i64 %indvar, 1
147 for.end79: ; preds = %for.cond56
151 define internal void @check_vect() nounwind uwtable noinline {
153 %a = alloca i32, align 4
154 %b = alloca i32, align 4
155 %c = alloca i32, align 4
156 %d = alloca i32, align 4
157 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
158 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
159 %tobool = icmp eq i32 %call1, 0
160 br i1 %tobool, label %if.then, label %lor.lhs.false
162 lor.lhs.false: ; preds = %entry
163 %tmp4 = load i32* %d, align 4
164 %and6 = and i32 %tmp4, 67108864
165 %cmp = icmp eq i32 %and6, 0
166 br i1 %cmp, label %if.then, label %if.end
168 if.then: ; preds = %entry, %lor.lhs.false
169 call void @exit(i32 0) noreturn nounwind
172 if.end: ; preds = %lor.lhs.false
173 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
177 declare void @abort() noreturn
179 declare void (i32)* @signal(i32, void (i32)*) nounwind
181 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
183 call void @exit(i32 0) noreturn nounwind
186 return: ; No predecessors!
190 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
192 %and = and i32 %__level, -2147483648
193 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
194 %cmp = icmp ult i32 %call, %__level
195 br i1 %cmp, label %if.then, label %if.end
197 if.then: ; preds = %entry
200 if.end: ; preds = %entry
201 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
202 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
203 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
204 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
205 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
206 store i32 %asmresult, i32* %__eax, align 4
207 store i32 %asmresult8, i32* %__ebx, align 4
208 store i32 %asmresult9, i32* %__ecx, align 4
209 store i32 %asmresult10, i32* %__edx, align 4
212 return: ; preds = %if.end, %if.then
213 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
217 declare void @exit(i32) noreturn
219 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
221 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
222 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
223 %tobool = icmp eq i32* %__sig, null
224 br i1 %tobool, label %if.end, label %if.then
226 if.then: ; preds = %entry
227 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
228 store i32 %asmresult1, i32* %__sig, align 4
231 if.end: ; preds = %entry, %if.then
235 !0 = metadata !{i32 -2147343071, i32 -2147343063}
236 !1 = metadata !{i32 -2147343194, i32 -2147343186}