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 Os-vect-95.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer Os-vect-95.s > Os-vect-95.ll
6 ; ModuleID = 'Os-vect-95.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.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 @main.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* %pd, float* %pa, float* %pb, float* %pc) nounwind uwtable {
17 for.cond: ; preds = %for.inc, %entry
18 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
19 %arrayidx18 = getelementptr float* %pd, i64 %indvar
20 %arrayidx12 = getelementptr float* %pc, i64 %indvar
21 %arrayidx7 = getelementptr float* %pb, i64 %indvar
22 %arrayidx = getelementptr float* %pa, i64 %indvar
23 %i.0 = trunc i64 %indvar to i32
24 %cmp = icmp slt i32 %i.0, 256
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 %tmp13 = load float* %arrayidx12, align 4
31 %mul = fmul float %tmp8, %tmp13
32 %cmp14 = fcmp une float %tmp3, %mul
33 br i1 %cmp14, label %if.then, label %if.end
35 if.then: ; preds = %for.body
36 call void @abort() noreturn nounwind
39 if.end: ; preds = %for.body
40 %tmp19 = load float* %arrayidx18, align 4
41 %cmp20 = fcmp une float %tmp19, 5.000000e+00
42 br i1 %cmp20, label %if.then22, label %if.end23
44 if.then22: ; preds = %if.end
45 call void @abort() noreturn nounwind
48 if.end23: ; preds = %if.end
51 for.inc: ; preds = %if.end23
52 %indvar.next = add i64 %indvar, 1
55 for.end: ; preds = %for.cond
59 declare void @abort() noreturn
61 define i32 @main1(i32 %n, float* noalias %pd, float* noalias %pa, float* noalias %pb, float* noalias %pc) nounwind uwtable {
63 %tmp = icmp sgt i32 %n, 0
64 %smax = select i1 %tmp, i32 %n, i32 0
65 %tmp1 = zext i32 %smax to i64
68 for.cond: ; preds = %for.inc, %entry
69 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
70 %arrayidx17 = getelementptr float* %pd, i64 %indvar
71 %arrayidx13 = getelementptr float* %pa, i64 %indvar
72 %arrayidx8 = getelementptr float* %pc, i64 %indvar
73 %arrayidx = getelementptr float* %pb, i64 %indvar
74 %exitcond = icmp ne i64 %indvar, %tmp1
75 br i1 %exitcond, label %for.body, label %for.end
77 for.body: ; preds = %for.cond
78 %tmp4 = load float* %arrayidx, align 4
79 %tmp9 = load float* %arrayidx8, align 4
80 %mul = fmul float %tmp4, %tmp9
81 store float %mul, float* %arrayidx13, align 4
82 store float 5.000000e+00, float* %arrayidx17, align 4
85 for.inc: ; preds = %for.body
86 %indvar.next = add i64 %indvar, 1
89 for.end: ; preds = %for.cond
90 call void @bar(float* %pd, float* %pa, float* %pb, float* %pc)
94 define i32 @main() nounwind uwtable {
96 %a = alloca [256 x float], align 16
97 %d = alloca [257 x float], align 16
98 %b = alloca [256 x float], align 16
99 %c = alloca [256 x float], align 16
100 %tmp = bitcast [256 x float]* %b to i8*
101 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([256 x float]* @main.b to i8*), i64 1024, i32 16, i1 false)
102 %tmp2 = bitcast [256 x float]* %c to i8*
103 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp2, i8* bitcast ([256 x float]* @main.c to i8*), i64 1024, i32 16, i1 false)
104 call void @check_vect()
105 %arrayidx = getelementptr inbounds [257 x float]* %d, i64 0, i64 1
106 %arraydecay = getelementptr inbounds [256 x float]* %a, i64 0, i64 0
107 %arraydecay3 = getelementptr inbounds [256 x float]* %b, i64 0, i64 0
108 %arraydecay4 = getelementptr inbounds [256 x float]* %c, i64 0, i64 0
109 %call = call i32 @main1(i32 256, float* %arrayidx, float* %arraydecay, float* %arraydecay3, float* %arraydecay4)
110 %arrayidx5 = getelementptr inbounds [257 x float]* %d, i64 0, i64 1
111 %arraydecay6 = getelementptr inbounds [256 x float]* %a, i64 0, i64 0
112 %arraydecay7 = getelementptr inbounds [256 x float]* %b, i64 0, i64 0
113 %arraydecay8 = getelementptr inbounds [256 x float]* %c, i64 0, i64 0
114 %call9 = call i32 @main1(i32 254, float* %arrayidx5, float* %arraydecay6, float* %arraydecay7, float* %arraydecay8)
118 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
120 define internal void @check_vect() nounwind uwtable noinline {
122 %a = alloca i32, align 4
123 %b = alloca i32, align 4
124 %c = alloca i32, align 4
125 %d = alloca i32, align 4
126 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
127 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
128 %tobool = icmp eq i32 %call1, 0
129 br i1 %tobool, label %if.then, label %lor.lhs.false
131 lor.lhs.false: ; preds = %entry
132 %tmp4 = load i32* %d, align 4
133 %and6 = and i32 %tmp4, 67108864
134 %cmp = icmp eq i32 %and6, 0
135 br i1 %cmp, label %if.then, label %if.end
137 if.then: ; preds = %entry, %lor.lhs.false
138 call void @exit(i32 0) noreturn nounwind
141 if.end: ; preds = %lor.lhs.false
142 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
146 declare void (i32)* @signal(i32, void (i32)*) nounwind
148 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
150 call void @exit(i32 0) noreturn nounwind
153 return: ; No predecessors!
157 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
159 %and = and i32 %__level, -2147483648
160 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
161 %cmp = icmp ult i32 %call, %__level
162 br i1 %cmp, label %if.then, label %if.end
164 if.then: ; preds = %entry
167 if.end: ; preds = %entry
168 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
169 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
170 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
171 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
172 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
173 store i32 %asmresult, i32* %__eax, align 4
174 store i32 %asmresult8, i32* %__ebx, align 4
175 store i32 %asmresult9, i32* %__ecx, align 4
176 store i32 %asmresult10, i32* %__edx, align 4
179 return: ; preds = %if.end, %if.then
180 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
184 declare void @exit(i32) noreturn
186 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
188 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
189 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
190 %tobool = icmp eq i32* %__sig, null
191 br i1 %tobool, label %if.end, label %if.then
193 if.then: ; preds = %entry
194 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
195 store i32 %asmresult1, i32* %__sig, align 4
198 if.end: ; preds = %entry, %if.then
202 !0 = metadata !{i32 -2147343033, i32 -2147343025}
203 !1 = metadata !{i32 -2147343156, i32 -2147343148}