1; RUN: opt -basic-aa %loadPolly -polly-scops -analyze < %s | FileCheck %s 2; 3; CHECK: Stmt_for_body 4; CHECK: Reduction Type: NONE 5; CHECK: MemRef_sum_04 6; CHECK: Reduction Type: NONE 7; CHECK: MemRef_sum_12 8; CHECK: Stmt_for_inc 9; CHECK: Reduction Type: + 10; CHECK: MemRef_sum_12 11; CHECK: Reduction Type: NONE 12; CHECK: MemRef_A 13; CHECK: Reduction Type: + 14; CHECK: MemRef_sum_12 15; CHECK: Stmt_for_inc5 16; CHECK: Reduction Type: NONE 17; CHECK: MemRef_sum_12 18; CHECK: Reduction Type: NONE 19; CHECK: MemRef_sum_04 20; 21; int f(int * __restrict__ A) { 22; int i, j, sum = 1; 23; for (i = 0; i < 100; i++) { 24; sum *= 7; 25; for (j = 0; j < 100; j++) { 26; sum += A[i+j]; 27; } 28; } 29; return sum; 30; } 31target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 32 33define i32 @f(i32* noalias %A) { 34entry: 35 %sum.04.reg2mem = alloca i32 36 %sum.12.reg2mem = alloca i32 37 br label %entry.split 38 39entry.split: ; preds = %entry 40 store i32 0, i32* %sum.04.reg2mem 41 br label %for.body 42 43for.body: ; preds = %for.inc5, %entry.split 44 %indvars.iv23 = phi i64 [ 0, %entry.split ], [ %3, %for.inc5 ] 45 %sum.04.reload = load i32, i32* %sum.04.reg2mem 46 %mul = mul nsw i32 %sum.04.reload, 7 47 store i32 %mul, i32* %sum.12.reg2mem 48 br label %for.inc 49 50for.inc: ; preds = %for.inc, %for.body 51 %indvars.iv1 = phi i64 [ 0, %for.body ], [ %1, %for.inc ] 52 %sum.12.reload = load i32, i32* %sum.12.reg2mem 53 %0 = add i64 %indvars.iv23, %indvars.iv1 54 %arrayidx = getelementptr i32, i32* %A, i64 %0 55 %tmp5 = load i32, i32* %arrayidx, align 4 56 %add4 = add nsw i32 %tmp5, %sum.12.reload 57 %1 = add nuw nsw i64 %indvars.iv1, 1 58 %exitcond1 = icmp eq i64 %1, 100 59 store i32 %add4, i32* %sum.12.reg2mem 60 br i1 %exitcond1, label %for.inc5, label %for.inc 61 62for.inc5: ; preds = %for.inc 63 %2 = load i32, i32* %sum.12.reg2mem 64 %3 = add nuw nsw i64 %indvars.iv23, 1 65 %exitcond2 = icmp eq i64 %3, 100 66 store i32 %2, i32* %sum.04.reg2mem 67 br i1 %exitcond2, label %for.end7, label %for.body 68 69for.end7: ; preds = %for.inc5 70 %4 = load i32, i32* %sum.04.reg2mem 71 ret i32 %4 72} 73