1; RUN: opt %loadPolly -basic-aa -polly-opt-isl -polly-vectorizer=polly < %s 2target 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 4%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] } 5%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 } 6 7@A = common global [1536 x [1536 x float]] zeroinitializer, align 16 8@B = common global [1536 x [1536 x float]] zeroinitializer, align 16 9@stdout = external global %struct._IO_FILE* 10@.str = private unnamed_addr constant [5 x i8] c"%lf \00", align 1 11@C = common global [1536 x [1536 x float]] zeroinitializer, align 16 12@.str1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1 13 14define void @init_array() nounwind uwtable { 15entry: 16 br label %for.cond 17 18for.cond: ; preds = %for.inc17, %entry 19 %i.0 = phi i32 [ 0, %entry ], [ %inc18, %for.inc17 ] 20 %cmp = icmp slt i32 %i.0, 1536 21 br i1 %cmp, label %for.body, label %for.end19 22 23for.body: ; preds = %for.cond 24 br label %for.cond1 25 26for.cond1: ; preds = %for.inc, %for.body 27 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ] 28 %cmp2 = icmp slt i32 %j.0, 1536 29 br i1 %cmp2, label %for.body3, label %for.end 30 31for.body3: ; preds = %for.cond1 32 %mul = mul nsw i32 %i.0, %j.0 33 %rem = srem i32 %mul, 1024 34 %add = add nsw i32 1, %rem 35 %conv = sitofp i32 %add to double 36 %div = fdiv double %conv, 2.000000e+00 37 %conv4 = fptrunc double %div to float 38 %idxprom = sext i32 %j.0 to i64 39 %idxprom5 = sext i32 %i.0 to i64 40 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @A, i32 0, i64 %idxprom5 41 %arrayidx6 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i32 0, i64 %idxprom 42 store float %conv4, float* %arrayidx6, align 4 43 %mul7 = mul nsw i32 %i.0, %j.0 44 %rem8 = srem i32 %mul7, 1024 45 %add9 = add nsw i32 1, %rem8 46 %conv10 = sitofp i32 %add9 to double 47 %div11 = fdiv double %conv10, 2.000000e+00 48 %conv12 = fptrunc double %div11 to float 49 %idxprom13 = sext i32 %j.0 to i64 50 %idxprom14 = sext i32 %i.0 to i64 51 %arrayidx15 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @B, i32 0, i64 %idxprom14 52 %arrayidx16 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx15, i32 0, i64 %idxprom13 53 store float %conv12, float* %arrayidx16, align 4 54 br label %for.inc 55 56for.inc: ; preds = %for.body3 57 %inc = add nsw i32 %j.0, 1 58 br label %for.cond1 59 60for.end: ; preds = %for.cond1 61 br label %for.inc17 62 63for.inc17: ; preds = %for.end 64 %inc18 = add nsw i32 %i.0, 1 65 br label %for.cond 66 67for.end19: ; preds = %for.cond 68 ret void 69} 70 71define void @print_array() nounwind uwtable { 72entry: 73 br label %for.cond 74 75for.cond: ; preds = %for.inc10, %entry 76 %i.0 = phi i32 [ 0, %entry ], [ %inc11, %for.inc10 ] 77 %cmp = icmp slt i32 %i.0, 1536 78 br i1 %cmp, label %for.body, label %for.end12 79 80for.body: ; preds = %for.cond 81 br label %for.cond1 82 83for.cond1: ; preds = %for.inc, %for.body 84 %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ] 85 %cmp2 = icmp slt i32 %j.0, 1536 86 br i1 %cmp2, label %for.body3, label %for.end 87 88for.body3: ; preds = %for.cond1 89 %0 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8 90 %idxprom = sext i32 %j.0 to i64 91 %idxprom4 = sext i32 %i.0 to i64 92 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i32 0, i64 %idxprom4 93 %arrayidx5 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i32 0, i64 %idxprom 94 %1 = load float, float* %arrayidx5, align 4 95 %conv = fpext float %1 to double 96 %call = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), double %conv) 97 %rem = srem i32 %j.0, 80 98 %cmp6 = icmp eq i32 %rem, 79 99 br i1 %cmp6, label %if.then, label %if.end 100 101if.then: ; preds = %for.body3 102 %2 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8 103 %call8 = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str1, i32 0, i32 0)) 104 br label %if.end 105 106if.end: ; preds = %if.then, %for.body3 107 br label %for.inc 108 109for.inc: ; preds = %if.end 110 %inc = add nsw i32 %j.0, 1 111 br label %for.cond1 112 113for.end: ; preds = %for.cond1 114 %3 = load %struct._IO_FILE*, %struct._IO_FILE** @stdout, align 8 115 %call9 = call i32 (%struct._IO_FILE*, i8*, ...) @fprintf(%struct._IO_FILE* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str1, i32 0, i32 0)) 116 br label %for.inc10 117 118for.inc10: ; preds = %for.end 119 %inc11 = add nsw i32 %i.0, 1 120 br label %for.cond 121 122for.end12: ; preds = %for.cond 123 ret void 124} 125 126declare i32 @fprintf(%struct._IO_FILE*, i8*, ...) 127 128define i32 @main() nounwind uwtable { 129entry: 130 call void @init_array() 131 br label %for.cond 132 133for.cond: ; preds = %for.inc28, %entry 134 %i.0 = phi i32 [ 0, %entry ], [ %inc29, %for.inc28 ] 135 %cmp = icmp slt i32 %i.0, 1536 136 br i1 %cmp, label %for.body, label %for.end30 137 138for.body: ; preds = %for.cond 139 br label %for.cond1 140 141for.cond1: ; preds = %for.inc25, %for.body 142 %j.0 = phi i32 [ 0, %for.body ], [ %inc26, %for.inc25 ] 143 %cmp2 = icmp slt i32 %j.0, 1536 144 br i1 %cmp2, label %for.body3, label %for.end27 145 146for.body3: ; preds = %for.cond1 147 %idxprom = sext i32 %j.0 to i64 148 %idxprom4 = sext i32 %i.0 to i64 149 %arrayidx = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i32 0, i64 %idxprom4 150 %arrayidx5 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx, i32 0, i64 %idxprom 151 store float 0.000000e+00, float* %arrayidx5, align 4 152 br label %for.cond6 153 154for.cond6: ; preds = %for.inc, %for.body3 155 %k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ] 156 %cmp7 = icmp slt i32 %k.0, 1536 157 br i1 %cmp7, label %for.body8, label %for.end 158 159for.body8: ; preds = %for.cond6 160 %idxprom9 = sext i32 %j.0 to i64 161 %idxprom10 = sext i32 %i.0 to i64 162 %arrayidx11 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i32 0, i64 %idxprom10 163 %arrayidx12 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx11, i32 0, i64 %idxprom9 164 %0 = load float, float* %arrayidx12, align 4 165 %idxprom13 = sext i32 %k.0 to i64 166 %idxprom14 = sext i32 %i.0 to i64 167 %arrayidx15 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @A, i32 0, i64 %idxprom14 168 %arrayidx16 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx15, i32 0, i64 %idxprom13 169 %1 = load float, float* %arrayidx16, align 4 170 %idxprom17 = sext i32 %j.0 to i64 171 %idxprom18 = sext i32 %k.0 to i64 172 %arrayidx19 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @B, i32 0, i64 %idxprom18 173 %arrayidx20 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx19, i32 0, i64 %idxprom17 174 %2 = load float, float* %arrayidx20, align 4 175 %mul = fmul float %1, %2 176 %add = fadd float %0, %mul 177 %idxprom21 = sext i32 %j.0 to i64 178 %idxprom22 = sext i32 %i.0 to i64 179 %arrayidx23 = getelementptr inbounds [1536 x [1536 x float]], [1536 x [1536 x float]]* @C, i32 0, i64 %idxprom22 180 %arrayidx24 = getelementptr inbounds [1536 x float], [1536 x float]* %arrayidx23, i32 0, i64 %idxprom21 181 store float %add, float* %arrayidx24, align 4 182 br label %for.inc 183 184for.inc: ; preds = %for.body8 185 %inc = add nsw i32 %k.0, 1 186 br label %for.cond6 187 188for.end: ; preds = %for.cond6 189 br label %for.inc25 190 191for.inc25: ; preds = %for.end 192 %inc26 = add nsw i32 %j.0, 1 193 br label %for.cond1 194 195for.end27: ; preds = %for.cond1 196 br label %for.inc28 197 198for.inc28: ; preds = %for.end27 199 %inc29 = add nsw i32 %i.0, 1 200 br label %for.cond 201 202for.end30: ; preds = %for.cond 203 ret i32 0 204} 205