1*e1f056f6Srahulana-quic;RUN: opt %loadNPMPolly '-passes=polly-import-jscop,polly-codegen' -polly-import-jscop-postfix=transformed+withconst < %s -S | FileCheck -check-prefix=WITHCONST %s 2*e1f056f6Srahulana-quic;RUN: opt %loadNPMPolly '-passes=polly-import-jscop,polly-codegen' -polly-import-jscop-postfix=transformed+withoutconst < %s -S | FileCheck -check-prefix=WITHOUTCONST %s 335f70200SMichael Kruse; 435f70200SMichael Kruse;float A[1040]; 535f70200SMichael Kruse; 635f70200SMichael Kruse;int codegen_simple_md() { 735f70200SMichael Kruse; for (int i = 0; i < 32; ++i) 835f70200SMichael Kruse; for (int j = 0; j < 32; ++j) 935f70200SMichael Kruse; A[32*i+j] = 100; 1035f70200SMichael Kruse;} 1135f70200SMichael 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" 1235f70200SMichael Kruse 1335f70200SMichael Kruse@A = common global [1040 x float] zeroinitializer, align 4 1435f70200SMichael Kruse 1535f70200SMichael Krusedefine void @codegen_simple_md() nounwind { 1635f70200SMichael Kruseentry: 1735f70200SMichael Kruse br label %for.cond 1835f70200SMichael Kruse 1935f70200SMichael Krusefor.cond: ; preds = %for.inc4, %entry 2035f70200SMichael Kruse %i.0 = phi i32 [ 0, %entry ], [ %inc5, %for.inc4 ] 2135f70200SMichael Kruse %exitcond1 = icmp ne i32 %i.0, 32 2235f70200SMichael Kruse br i1 %exitcond1, label %for.body, label %for.end6 2335f70200SMichael Kruse 2435f70200SMichael Krusefor.body: ; preds = %for.cond 2535f70200SMichael Kruse br label %for.cond1 2635f70200SMichael Kruse 2735f70200SMichael Krusefor.cond1: ; preds = %for.inc, %for.body 2835f70200SMichael Kruse %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ] 2935f70200SMichael Kruse %exitcond = icmp ne i32 %j.0, 32 3035f70200SMichael Kruse br i1 %exitcond, label %for.body3, label %for.end 3135f70200SMichael Kruse 3235f70200SMichael Krusefor.body3: ; preds = %for.cond1 3335f70200SMichael Kruse %mul = shl nsw i32 %i.0, 5 3435f70200SMichael Kruse %add = add nsw i32 %mul, %j.0 3555cb5796SNikita Popov %arrayidx = getelementptr inbounds [1040 x float], ptr @A, i32 0, i32 %add 3655cb5796SNikita Popov store float 100.0, ptr %arrayidx, align 4 3735f70200SMichael Kruse br label %for.inc 3835f70200SMichael Kruse 3935f70200SMichael Krusefor.inc: ; preds = %for.body3 4035f70200SMichael Kruse %inc = add nsw i32 %j.0, 1 4135f70200SMichael Kruse br label %for.cond1 4235f70200SMichael Kruse 4335f70200SMichael Krusefor.end: ; preds = %for.cond1 4435f70200SMichael Kruse br label %for.inc4 4535f70200SMichael Kruse 4635f70200SMichael Krusefor.inc4: ; preds = %for.end 4735f70200SMichael Kruse %inc5 = add nsw i32 %i.0, 1 4835f70200SMichael Kruse br label %for.cond 4935f70200SMichael Kruse 5035f70200SMichael Krusefor.end6: ; preds = %for.cond 5135f70200SMichael Kruse ret void 5235f70200SMichael Kruse} 5335f70200SMichael Kruse 5435f70200SMichael 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]*}} ] 5535f70200SMichael 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]*}} ] 5635f70200SMichael Kruse; WITHCONST: %[[MUL1:[._a-zA-Z0-9]+]] = mul nsw i64 16, %[[IVOut]] 5735f70200SMichael Kruse; WITHCONST: %[[MUL2:[._a-zA-Z0-9]+]] = mul nsw i64 2, %[[IVIn]] 5835f70200SMichael Kruse; WITHCONST: %[[SUM1:[._a-zA-Z0-9]+]] = add nsw i64 %[[MUL1]], %[[MUL2]] 5935f70200SMichael Kruse; WITHCONST: %[[SUM2:[._a-zA-Z0-9]+]] = add nsw i64 %[[SUM1]], 5 6055cb5796SNikita Popov; WITHCONST: %[[ACC:[._a-zA-Z0-9]*]] = getelementptr float, ptr @A, i64 %[[SUM2]] 6155cb5796SNikita Popov; WITHCONST: store float 1.000000e+02, ptr %[[ACC]] 6235f70200SMichael Kruse 6335f70200SMichael 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]*}} ] 6435f70200SMichael 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]*}} ] 6535f70200SMichael Kruse; WITHOUTCONST: %[[MUL1:[._a-zA-Z0-9]+]] = mul nsw i64 16, %[[IVOut]] 6635f70200SMichael Kruse; WITHOUTCONST: %[[MUL2:[._a-zA-Z0-9]+]] = mul nsw i64 2, %[[IVIn]] 6735f70200SMichael Kruse; WITHOUTCONST: %[[SUM1:[._a-zA-Z0-9]+]] = add nsw i64 %[[MUL1]], %[[MUL2]] 6855cb5796SNikita Popov; WITHOUTCONST: %[[ACC:[._a-zA-Z0-9]*]] = getelementptr float, ptr @A, i64 %[[SUM1]] 6955cb5796SNikita Popov; WITHOUTCONST: store float 1.000000e+02, ptr %[[ACC]] 70