1 ; RUN: opt %loadPolly -polly-detect-unprofitable -basicaa -polly-opt-isl %vector-opt < %s
2 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-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 %struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i64, i32, [20 x i8] }
6 %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
8 @A = common global [1536 x [1536 x float]] zeroinitializer, align 16
9 @B = common global [1536 x [1536 x float]] zeroinitializer, align 16
10 @stdout = external global %struct._IO_FILE*
11 @.str = private unnamed_addr constant [5 x i8] c"%lf \00", align 1
12 @C = common global [1536 x [1536 x float]] zeroinitializer, align 16
13 @.str1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
15 define void @init_array() nounwind uwtable {
19 for.cond: ; preds = %for.inc17, %entry
20 %i.0 = phi i32 [ 0, %entry ], [ %inc18, %for.inc17 ]
21 %cmp = icmp slt i32 %i.0, 1536
22 br i1 %cmp, label %for.body, label %for.end19
24 for.body: ; preds = %for.cond
27 for.cond1: ; preds = %for.inc, %for.body
28 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
29 %cmp2 = icmp slt i32 %j.0, 1536
30 br i1 %cmp2, label %for.body3, label %for.end
32 for.body3: ; preds = %for.cond1
33 %mul = mul nsw i32 %i.0, %j.0
34 %rem = srem i32 %mul, 1024
35 %add = add nsw i32 1, %rem
36 %conv = sitofp i32 %add to double
37 %div = fdiv double %conv, 2.000000e+00
38 %conv4 = fptrunc double %div to float
39 %idxprom = sext i32 %j.0 to i64
40 %idxprom5 = sext i32 %i.0 to i64
41 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @A, i32 0, i64 %idxprom5
42 %arrayidx6 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i32 0, i64 %idxprom
43 store float %conv4, float* %arrayidx6, align 4
44 %mul7 = mul nsw i32 %i.0, %j.0
45 %rem8 = srem i32 %mul7, 1024
46 %add9 = add nsw i32 1, %rem8
47 %conv10 = sitofp i32 %add9 to double
48 %div11 = fdiv double %conv10, 2.000000e+00
49 %conv12 = fptrunc double %div11 to float
50 %idxprom13 = sext i32 %j.0 to i64
51 %idxprom14 = sext i32 %i.0 to i64
52 %arrayidx15 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @B, i32 0, i64 %idxprom14
53 %arrayidx16 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx15, i32 0, i64 %idxprom13
54 store float %conv12, float* %arrayidx16, align 4
57 for.inc: ; preds = %for.body3
58 %inc = add nsw i32 %j.0, 1
61 for.end: ; preds = %for.cond1
64 for.inc17: ; preds = %for.end
65 %inc18 = add nsw i32 %i.0, 1
68 for.end19: ; preds = %for.cond
72 define void @print_array() nounwind uwtable {
76 for.cond: ; preds = %for.inc10, %entry
77 %i.0 = phi i32 [ 0, %entry ], [ %inc11, %for.inc10 ]
78 %cmp = icmp slt i32 %i.0, 1536
79 br i1 %cmp, label %for.body, label %for.end12
81 for.body: ; preds = %for.cond
84 for.cond1: ; preds = %for.inc, %for.body
85 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
86 %cmp2 = icmp slt i32 %j.0, 1536
87 br i1 %cmp2, label %for.body3, label %for.end
89 for.body3: ; preds = %for.cond1
90 %0 = load %struct._IO_FILE** @stdout, align 8
91 %idxprom = sext i32 %j.0 to i64
92 %idxprom4 = sext i32 %i.0 to i64
93 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i32 0, i64 %idxprom4
94 %arrayidx5 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i32 0, i64 %idxprom
95 %1 = load float* %arrayidx5, align 4
96 %conv = fpext float %1 to double
97 %call = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %0, i8* getelementptr inbounds ([5 x i8]* @.str, i32 0, i32 0), double %conv)
98 %rem = srem i32 %j.0, 80
99 %cmp6 = icmp eq i32 %rem, 79
100 br i1 %cmp6, label %if.then, label %if.end
102 if.then: ; preds = %for.body3
103 %2 = load %struct._IO_FILE** @stdout, align 8
104 %call8 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %2, i8* getelementptr inbounds ([2 x i8]* @.str1, i32 0, i32 0))
107 if.end: ; preds = %if.then, %for.body3
110 for.inc: ; preds = %if.end
111 %inc = add nsw i32 %j.0, 1
114 for.end: ; preds = %for.cond1
115 %3 = load %struct._IO_FILE** @stdout, align 8
116 %call9 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %3, i8* getelementptr inbounds ([2 x i8]* @.str1, i32 0, i32 0))
119 for.inc10: ; preds = %for.end
120 %inc11 = add nsw i32 %i.0, 1
123 for.end12: ; preds = %for.cond
127 declare i32 @fprintf(%struct._IO_FILE*, i8*, ...)
129 define i32 @main() nounwind uwtable {
131 call void @init_array()
134 for.cond: ; preds = %for.inc28, %entry
135 %i.0 = phi i32 [ 0, %entry ], [ %inc29, %for.inc28 ]
136 %cmp = icmp slt i32 %i.0, 1536
137 br i1 %cmp, label %for.body, label %for.end30
139 for.body: ; preds = %for.cond
142 for.cond1: ; preds = %for.inc25, %for.body
143 %j.0 = phi i32 [ 0, %for.body ], [ %inc26, %for.inc25 ]
144 %cmp2 = icmp slt i32 %j.0, 1536
145 br i1 %cmp2, label %for.body3, label %for.end27
147 for.body3: ; preds = %for.cond1
148 %idxprom = sext i32 %j.0 to i64
149 %idxprom4 = sext i32 %i.0 to i64
150 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i32 0, i64 %idxprom4
151 %arrayidx5 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i32 0, i64 %idxprom
152 store float 0.000000e+00, float* %arrayidx5, align 4
155 for.cond6: ; preds = %for.inc, %for.body3
156 %k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
157 %cmp7 = icmp slt i32 %k.0, 1536
158 br i1 %cmp7, label %for.body8, label %for.end
160 for.body8: ; preds = %for.cond6
161 %idxprom9 = sext i32 %j.0 to i64
162 %idxprom10 = sext i32 %i.0 to i64
163 %arrayidx11 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i32 0, i64 %idxprom10
164 %arrayidx12 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx11, i32 0, i64 %idxprom9
165 %0 = load float* %arrayidx12, align 4
166 %idxprom13 = sext i32 %k.0 to i64
167 %idxprom14 = sext i32 %i.0 to i64
168 %arrayidx15 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @A, i32 0, i64 %idxprom14
169 %arrayidx16 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx15, i32 0, i64 %idxprom13
170 %1 = load float* %arrayidx16, align 4
171 %idxprom17 = sext i32 %j.0 to i64
172 %idxprom18 = sext i32 %k.0 to i64
173 %arrayidx19 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @B, i32 0, i64 %idxprom18
174 %arrayidx20 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx19, i32 0, i64 %idxprom17
175 %2 = load float* %arrayidx20, align 4
176 %mul = fmul float %1, %2
177 %add = fadd float %0, %mul
178 %idxprom21 = sext i32 %j.0 to i64
179 %idxprom22 = sext i32 %i.0 to i64
180 %arrayidx23 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i32 0, i64 %idxprom22
181 %arrayidx24 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx23, i32 0, i64 %idxprom21
182 store float %add, float* %arrayidx24, align 4
185 for.inc: ; preds = %for.body8
186 %inc = add nsw i32 %k.0, 1
189 for.end: ; preds = %for.cond6
192 for.inc25: ; preds = %for.end
193 %inc26 = add nsw i32 %j.0, 1
196 for.end27: ; preds = %for.cond1
199 for.inc28: ; preds = %for.end27
200 %inc29 = add nsw i32 %i.0, 1
203 for.end30: ; preds = %for.cond