1*35f70200SMichael Kruse;RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed+withconst -polly-codegen < %s -S | FileCheck -check-prefix=WITHCONST %s 2*35f70200SMichael Kruse;RUN: opt %loadPolly -polly-import-jscop -polly-import-jscop-postfix=transformed+withoutconst -polly-codegen < %s -S | FileCheck -check-prefix=WITHOUTCONST %s 3*35f70200SMichael Kruse; 4*35f70200SMichael Kruse;float A[1040]; 5*35f70200SMichael Kruse; 6*35f70200SMichael Kruse;int codegen_simple_md() { 7*35f70200SMichael Kruse; for (int i = 0; i < 32; ++i) 8*35f70200SMichael Kruse; for (int j = 0; j < 32; ++j) 9*35f70200SMichael Kruse; A[32*i+j] = 100; 10*35f70200SMichael Kruse;} 11*35f70200SMichael Krusetarget datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128" 12*35f70200SMichael Kruse 13*35f70200SMichael Kruse@A = common global [1040 x float] zeroinitializer, align 4 14*35f70200SMichael Kruse 15*35f70200SMichael Krusedefine void @codegen_simple_md() nounwind { 16*35f70200SMichael Kruseentry: 17*35f70200SMichael Kruse br label %for.cond 18*35f70200SMichael Kruse 19*35f70200SMichael Krusefor.cond: ; preds = %for.inc4, %entry 20*35f70200SMichael Kruse %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc4 ] 21*35f70200SMichael Kruse %exitcond1 = icmp ne i32 %i.0, 32 22*35f70200SMichael Kruse br i1 %exitcond1, label %for.body, label %for.end6 23*35f70200SMichael Kruse 24*35f70200SMichael Krusefor.body: ; preds = %for.cond 25*35f70200SMichael Kruse br label %for.cond1 26*35f70200SMichael Kruse 27*35f70200SMichael Krusefor.cond1: ; preds = %for.inc, %for.body 28*35f70200SMichael Kruse %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ] 29*35f70200SMichael Kruse %exitcond = icmp ne i32 %j.0, 32 30*35f70200SMichael Kruse br i1 %exitcond, label %for.body3, label %for.end 31*35f70200SMichael Kruse 32*35f70200SMichael Krusefor.body3: ; preds = %for.cond1 33*35f70200SMichael Kruse %mul = shl nsw i32 %i.0, 5 34*35f70200SMichael Kruse %add = add nsw i32 %mul, %j.0 35*35f70200SMichael Kruse %arrayidx = getelementptr inbounds [1040 x float], [1040 x float]* @A, i32 0, i32 %add 36*35f70200SMichael Kruse store float 100.0, float* %arrayidx, align 4 37*35f70200SMichael Kruse br label %for.inc 38*35f70200SMichael Kruse 39*35f70200SMichael Krusefor.inc: ; preds = %for.body3 40*35f70200SMichael Kruse %inc = add nsw i32 %j.0, 1 41*35f70200SMichael Kruse br label %for.cond1 42*35f70200SMichael Kruse 43*35f70200SMichael Krusefor.end: ; preds = %for.cond1 44*35f70200SMichael Kruse br label %for.inc4 45*35f70200SMichael Kruse 46*35f70200SMichael Krusefor.inc4: ; preds = %for.end 47*35f70200SMichael Kruse %inc5 = add nsw i32 %i.0, 1 48*35f70200SMichael Kruse br label %for.cond 49*35f70200SMichael Kruse 50*35f70200SMichael Krusefor.end6: ; preds = %for.cond 51*35f70200SMichael Kruse ret void 52*35f70200SMichael Kruse} 53*35f70200SMichael Kruse 54*35f70200SMichael Kruse; WITHCONST: %[[IVOut:polly.indvar[0-9]*]] = phi i64 [ 0, %polly.loop_preheader{{[0-9]*}} ], [ %polly.indvar_next{{[0-9]*}}, %polly.{{[._a-zA-Z0-9]*}} ] 55*35f70200SMichael Kruse; WITHCONST: %[[IVIn:polly.indvar[0-9]*]] = phi i64 [ 0, %polly.loop_preheader{{[0-9]*}} ], [ %polly.indvar_next{{[0-9]*}}, %polly.{{[._a-zA-Z0-9]*}} ] 56*35f70200SMichael Kruse; WITHCONST: %[[MUL1:[._a-zA-Z0-9]+]] = mul nsw i64 16, %[[IVOut]] 57*35f70200SMichael Kruse; WITHCONST: %[[MUL2:[._a-zA-Z0-9]+]] = mul nsw i64 2, %[[IVIn]] 58*35f70200SMichael Kruse; WITHCONST: %[[SUM1:[._a-zA-Z0-9]+]] = add nsw i64 %[[MUL1]], %[[MUL2]] 59*35f70200SMichael Kruse; WITHCONST: %[[SUM2:[._a-zA-Z0-9]+]] = add nsw i64 %[[SUM1]], 5 60*35f70200SMichael Kruse; WITHCONST: %[[ACC:[._a-zA-Z0-9]*]] = getelementptr float, float* getelementptr inbounds ([1040 x float], [1040 x float]* @A, i{{(32|64)}} 0, i{{(32|64)}} 0), i64 %[[SUM2]] 61*35f70200SMichael Kruse; WITHCONST: store float 1.000000e+02, float* %[[ACC]] 62*35f70200SMichael Kruse 63*35f70200SMichael Kruse; WITHOUTCONST: %[[IVOut:polly.indvar[0-9]*]] = phi i64 [ 0, %polly.loop_preheader{{[0-9]*}} ], [ %polly.indvar_next{{[0-9]*}}, %polly.{{[._a-zA-Z0-9]*}} ] 64*35f70200SMichael Kruse; WITHOUTCONST: %[[IVIn:polly.indvar[0-9]*]] = phi i64 [ 0, %polly.loop_preheader{{[0-9]*}} ], [ %polly.indvar_next{{[0-9]*}}, %polly.{{[._a-zA-Z0-9]*}} ] 65*35f70200SMichael Kruse; WITHOUTCONST: %[[MUL1:[._a-zA-Z0-9]+]] = mul nsw i64 16, %[[IVOut]] 66*35f70200SMichael Kruse; WITHOUTCONST: %[[MUL2:[._a-zA-Z0-9]+]] = mul nsw i64 2, %[[IVIn]] 67*35f70200SMichael Kruse; WITHOUTCONST: %[[SUM1:[._a-zA-Z0-9]+]] = add nsw i64 %[[MUL1]], %[[MUL2]] 68*35f70200SMichael Kruse; WITHOUTCONST: %[[ACC:[._a-zA-Z0-9]*]] = getelementptr float, float* getelementptr inbounds ([1040 x float], [1040 x float]* @A, i{{(32|64)}} 0, i{{(32|64)}} 0), i64 %[[SUM1]] 69*35f70200SMichael Kruse; WITHOUTCONST: store float 1.000000e+02, float* %[[ACC]] 70