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-57.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-vfa-vect-57.s > no-vfa-vect-57.ll
6 ; ModuleID = 'no-vfa-vect-57.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(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 %arrayidx16 = getelementptr float* %pa, i64 %indvar
83 %tmp = add i64 %indvar, 1
84 %arrayidx11 = getelementptr [256 x float]* %c, i64 0, i64 %tmp
85 %arrayidx = getelementptr [256 x float]* %b, i64 0, i64 %tmp
86 %exitcond = icmp ne i64 %indvar, 128
87 br i1 %exitcond, label %for.body, label %for.end
89 for.body: ; preds = %for.cond
90 %tmp6 = load float* %arrayidx, align 4
91 %tmp12 = load float* %arrayidx11, align 4
92 %mul = fmul float %tmp6, %tmp12
93 store float %mul, float* %arrayidx16, align 4
96 for.inc: ; preds = %for.body
97 %indvar.next = add i64 %indvar, 1
100 for.end: ; preds = %for.cond
101 call void @bar(float* %pa, float* %arraydecay, float* %arraydecay1)
105 define i32 @main() nounwind uwtable {
107 %a = alloca [256 x float], align 16
108 call void @check_vect()
109 %arraydecay = getelementptr inbounds [256 x float]* %a, i64 0, i64 0
110 %call = call i32 @main1(float* %arraydecay)
114 define internal void @check_vect() nounwind uwtable noinline {
116 %a = alloca i32, align 4
117 %b = alloca i32, align 4
118 %c = alloca i32, align 4
119 %d = alloca i32, align 4
120 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
121 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
122 %tobool = icmp eq i32 %call1, 0
123 br i1 %tobool, label %if.then, label %lor.lhs.false
125 lor.lhs.false: ; preds = %entry
126 %tmp4 = load i32* %d, align 4
127 %and6 = and i32 %tmp4, 67108864
128 %cmp = icmp eq i32 %and6, 0
129 br i1 %cmp, label %if.then, label %if.end
131 if.then: ; preds = %entry, %lor.lhs.false
132 call void @exit(i32 0) noreturn nounwind
135 if.end: ; preds = %lor.lhs.false
136 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
140 declare void (i32)* @signal(i32, void (i32)*) nounwind
142 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
144 call void @exit(i32 0) noreturn nounwind
147 return: ; No predecessors!
151 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
153 %and = and i32 %__level, -2147483648
154 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
155 %cmp = icmp ult i32 %call, %__level
156 br i1 %cmp, label %if.then, label %if.end
158 if.then: ; preds = %entry
161 if.end: ; preds = %entry
162 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
163 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
164 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
165 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
166 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
167 store i32 %asmresult, i32* %__eax, align 4
168 store i32 %asmresult8, i32* %__ebx, align 4
169 store i32 %asmresult9, i32* %__ecx, align 4
170 store i32 %asmresult10, i32* %__edx, align 4
173 return: ; preds = %if.end, %if.then
174 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
178 declare void @exit(i32) noreturn
180 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
182 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
183 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
184 %tobool = icmp eq i32* %__sig, null
185 br i1 %tobool, label %if.end, label %if.then
187 if.then: ; preds = %entry
188 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
189 store i32 %asmresult1, i32* %__sig, align 4
192 if.end: ; preds = %entry, %if.then
196 !0 = metadata !{i32 -2147307809, i32 -2147307801}
197 !1 = metadata !{i32 -2147307932, i32 -2147307924}