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-vfa-vect-61.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-vfa-vect-61.s > no-vfa-vect-61.ll
6 ; ModuleID = 'no-vfa-vect-61.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 @foo.b = internal unnamed_addr constant [256 x float] [float 0.000000e+00, float 3.000000e+00, float 6.000000e+00, float 9.000000e+00, float 1.200000e+01, float 1.500000e+01, float 1.800000e+01, float 2.100000e+01, float 2.400000e+01, float 2.700000e+01, float 3.000000e+01, float 3.300000e+01, float 3.600000e+01, float 3.900000e+01, float 4.200000e+01, float 4.500000e+01, float 4.800000e+01, float 5.100000e+01, float 5.400000e+01, float 5.700000e+01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00], align 16
11 @foo.c = internal unnamed_addr constant [256 x float] [float 0.000000e+00, float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00, float 9.000000e+00, float 1.000000e+01, float 1.100000e+01, float 1.200000e+01, float 1.300000e+01, float 1.400000e+01, float 1.500000e+01, float 1.600000e+01, float 1.700000e+01, float 1.800000e+01, float 1.900000e+01, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float 0.000000e+00], align 16
13 define void @bar(float* %pa, float* %pb, float* %pc) nounwind uwtable noinline {
17 for.cond: ; preds = %for.inc, %entry
18 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
19 %tmp = add i64 %indvar, 1
20 %arrayidx13 = getelementptr float* %pc, i64 %tmp
21 %arrayidx7 = getelementptr float* %pb, i64 %tmp
22 %arrayidx = getelementptr float* %pa, i64 %indvar
23 %i.0 = trunc i64 %indvar to i32
24 %cmp = icmp slt i32 %i.0, 128
25 br i1 %cmp, label %for.body, label %for.end
27 for.body: ; preds = %for.cond
28 %tmp3 = load float* %arrayidx, align 4
29 %tmp8 = load float* %arrayidx7, align 4
30 %tmp14 = load float* %arrayidx13, align 4
31 %mul = fmul float %tmp8, %tmp14
32 %cmp15 = fcmp une float %tmp3, %mul
33 br i1 %cmp15, label %if.then, label %if.end
35 if.then: ; preds = %for.body
36 call void @abort() noreturn nounwind
39 if.end: ; preds = %for.body
42 for.inc: ; preds = %if.end
43 %indvar.next = add i64 %indvar, 1
46 for.end: ; preds = %for.cond
50 declare void @abort() noreturn
52 define void @foo(float* %pb, float* %pc) nounwind uwtable noinline {
54 %b = alloca [256 x float], align 16
55 %c = alloca [256 x float], align 16
56 %tmp = bitcast [256 x float]* %b to i8*
57 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([256 x float]* @foo.b to i8*), i64 1024, i32 16, i1 false)
58 %tmp2 = bitcast [256 x float]* %c to i8*
59 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp2, i8* bitcast ([256 x float]* @foo.c to i8*), i64 1024, i32 16, i1 false)
60 %tmp1 = bitcast float* %pb to i8*
61 %tmp3 = bitcast [256 x float]* %b to i8*
62 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp1, i8* %tmp3, i64 1024, i32 1, i1 false)
63 %tmp4 = bitcast float* %pc to i8*
64 %tmp5 = bitcast [256 x float]* %c to i8*
65 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp4, i8* %tmp5, i64 1024, i32 1, i1 false)
69 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
71 define i32 @main1(i32 %n, float* %pa) nounwind uwtable noinline {
73 %b = alloca [256 x float], align 16
74 %c = alloca [256 x float], align 16
75 %arraydecay = getelementptr inbounds [256 x float]* %b, i64 0, i64 0
76 %arraydecay1 = getelementptr inbounds [256 x float]* %c, i64 0, i64 0
77 call void @foo(float* %arraydecay, float* %arraydecay1)
80 for.cond: ; preds = %for.inc, %entry
81 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
82 %arrayidx17 = getelementptr float* %pa, i64 %indvar
83 %tmp = add i64 %indvar, 1
84 %arrayidx12 = getelementptr [256 x float]* %c, i64 0, i64 %tmp
85 %arrayidx = getelementptr [256 x float]* %b, i64 0, i64 %tmp
86 %i.0 = trunc i64 %indvar to i32
88 %cmp = icmp slt i32 %i.0, %div
89 br i1 %cmp, label %for.body, label %for.end
91 for.body: ; preds = %for.cond
92 %tmp7 = load float* %arrayidx, align 4
93 %tmp13 = load float* %arrayidx12, align 4
94 %mul = fmul float %tmp7, %tmp13
95 store float %mul, float* %arrayidx17, align 4
98 for.inc: ; preds = %for.body
99 %indvar.next = add i64 %indvar, 1
102 for.end: ; preds = %for.cond
103 call void @bar(float* %pa, float* %arraydecay, float* %arraydecay1)
107 define i32 @main() nounwind uwtable {
109 %a = alloca [256 x float], align 16
110 call void @check_vect()
111 %arraydecay = getelementptr inbounds [256 x float]* %a, i64 0, i64 0
112 %call = call i32 @main1(i32 256, float* %arraydecay)
116 define internal void @check_vect() nounwind uwtable noinline {
118 %a = alloca i32, align 4
119 %b = alloca i32, align 4
120 %c = alloca i32, align 4
121 %d = alloca i32, align 4
122 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
123 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
124 %tobool = icmp eq i32 %call1, 0
125 br i1 %tobool, label %if.then, label %lor.lhs.false
127 lor.lhs.false: ; preds = %entry
128 %tmp4 = load i32* %d, align 4
129 %and6 = and i32 %tmp4, 67108864
130 %cmp = icmp eq i32 %and6, 0
131 br i1 %cmp, label %if.then, label %if.end
133 if.then: ; preds = %entry, %lor.lhs.false
134 call void @exit(i32 0) noreturn nounwind
137 if.end: ; preds = %lor.lhs.false
138 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
142 declare void (i32)* @signal(i32, void (i32)*) nounwind
144 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
146 call void @exit(i32 0) noreturn nounwind
149 return: ; No predecessors!
153 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
155 %and = and i32 %__level, -2147483648
156 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
157 %cmp = icmp ult i32 %call, %__level
158 br i1 %cmp, label %if.then, label %if.end
160 if.then: ; preds = %entry
163 if.end: ; preds = %entry
164 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
165 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
166 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
167 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
168 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
169 store i32 %asmresult, i32* %__eax, align 4
170 store i32 %asmresult8, i32* %__ebx, align 4
171 store i32 %asmresult9, i32* %__ecx, align 4
172 store i32 %asmresult10, i32* %__edx, align 4
175 return: ; preds = %if.end, %if.then
176 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
180 declare void @exit(i32) noreturn
182 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
184 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
185 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
186 %tobool = icmp eq i32* %__sig, null
187 br i1 %tobool, label %if.end, label %if.then
189 if.then: ; preds = %entry
190 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
191 store i32 %asmresult1, i32* %__sig, align 4
194 if.end: ; preds = %entry, %if.then
198 !0 = metadata !{i32 -2147307785, i32 -2147307777}
199 !1 = metadata !{i32 -2147307908, i32 -2147307900}