From 7ab58d8bb8d930f6e734b093ad4617317a5c7542 Mon Sep 17 00:00:00 2001
Date: Wed, 18 Jul 2012 16:38:02 +0800
Subject: [PATCH 2/7] Add testcases to test polly-loopnesttree pass
---
test/LoopNestTree/matmul.c | 52 ++++++++++
test/LoopNestTree/matmul.ll | 207 ++++++++++++++++++++++++++++++++++++++
test/LoopNestTree/simatax.c | 36 +++++++
test/LoopNestTree/simatax.ll | 184 +++++++++++++++++++++++++++++++++
test/LoopNestTree/simple_loop.c | 20 ++++
test/LoopNestTree/simple_loop.ll | 67 ++++++++++++
6 files changed, 566 insertions(+), 0 deletions(-)
create mode 100755 test/LoopNestTree/matmul.c
create mode 100755 test/LoopNestTree/matmul.ll
create mode 100755 test/LoopNestTree/simatax.c
create mode 100755 test/LoopNestTree/simatax.ll
create mode 100755 test/LoopNestTree/simple_loop.c
create mode 100644 test/LoopNestTree/simple_loop.ll
diff --git a/test/LoopNestTree/matmul.c b/test/LoopNestTree/matmul.c
new file mode 100755
index 0000000..d53db35
--- /dev/null
+++ b/test/LoopNestTree/matmul.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+
+#define TEST
+#define N 1536
+float A[N][N];
+float B[N][N];
+float C[N][N];
+
+void init_array()
+{
+ int i, j;
+
+ for (i=0; i<N; i++) {
+ for (j=0; j<N; j++) {
+ A[i][j] = (1+(i*j)%1024)/2.0;
+ B[i][j] = (1+(i*j)%1024)/2.0;
+ }
+ }
+}
+
+void print_array()
+{
+ int i, j;
+
+ for (i=0; i<N; i++) {
+ for (j=0; j<N; j++) {
+ fprintf(stdout, "%lf ", C[i][j]);
+ if (j%80 == 79) fprintf(stdout, "\n");
+ }
+ fprintf(stdout, "\n");
+ }
+}
+
+int main()
+{
+ int i, j, k;
+ double t_start, t_end;
+ init_array();
+
+ for(i=0; i<N; i++) {
+ for(j=0; j<N; j++) {
+ C[i][j] = 0;
+ for(k=0; k<N; k++)
+ C[i][j] = C[i][j] + A[i][k] * B[k][j];
+ }
+ }
+
+#ifdef TEST
+ print_array();
+#endif
+ return 0;
+}
diff --git a/test/LoopNestTree/matmul.ll b/test/LoopNestTree/matmul.ll
new file mode 100755
index 0000000..7c7e630
--- /dev/null
+++ b/test/LoopNestTree/matmul.ll
@@ -0,0 +1,207 @@
+; RUN: opt %loadPolly %defaultOpts -polly-loopnesttree -analyze %s | FileCheck %s
+; ModuleID = 'matmul.s'
+target 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"
+target triple = "i386-pc-linux-gnu"
+
+%struct._IO_FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct._IO_FILE*, i32, i32, i32, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i8*, i8*, i32, i32, [40 x i8] }
+%struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, i32 }
+
+@A = common global [1536 x [1536 x float]] zeroinitializer, align 4
+@B = common global [1536 x [1536 x float]] zeroinitializer, align 4
+@stdout = external global %struct._IO_FILE*
+@.str = private unnamed_addr constant [5 x i8] c"%lf \00", align 1
+@C = common global [1536 x [1536 x float]] zeroinitializer, align 4
+@.str1 = private unnamed_addr constant [2 x i8] c"\0A\00", align 1
+
+define void @init_array() nounwind {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc14, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc15, %for.inc14 ]
+ %exitcond1 = icmp ne i32 %i.0, 1536
+ br i1 %exitcond1, label %for.body, label %for.end16
+
+for.body: ; preds = %for.cond
+ br label %for.cond1
+
+for.cond1: ; preds = %for.inc, %for.body
+ %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
+ %exitcond = icmp ne i32 %j.0, 1536
+ br i1 %exitcond, label %for.body3, label %for.end
+
+for.body3: ; preds = %for.cond1
+ %mul = mul nsw i32 %i.0, %j.0
+ %rem = srem i32 %mul, 1024
+ %add = add nsw i32 1, %rem
+ %conv = sitofp i32 %add to double
+ %div = fdiv double %conv, 2.000000e+00
+ %conv4 = fptrunc double %div to float
+ %arrayidx = getelementptr inbounds [1536 x [1536 x float]]* @A, i32 0, i32 %i.0
+ %arrayidx5 = getelementptr inbounds [1536 x float]* %arrayidx, i32 0, i32 %j.0
+ store float %conv4, float* %arrayidx5, align 4
+ %mul6 = mul nsw i32 %i.0, %j.0
+ %rem7 = srem i32 %mul6, 1024
+ %add8 = add nsw i32 1, %rem7
+ %conv9 = sitofp i32 %add8 to double
+ %div10 = fdiv double %conv9, 2.000000e+00
+ %conv11 = fptrunc double %div10 to float
+ %arrayidx12 = getelementptr inbounds [1536 x [1536 x float]]* @B, i32 0, i32 %i.0
+ %arrayidx13 = getelementptr inbounds [1536 x float]* %arrayidx12, i32 0, i32 %j.0
+ store float %conv11, float* %arrayidx13, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body3
+ %inc = add nsw i32 %j.0, 1
+ br label %for.cond1
+
+for.end: ; preds = %for.cond1
+ br label %for.inc14
+
+for.inc14: ; preds = %for.end
+ %inc15 = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end16: ; preds = %for.cond
+ ret void
+}
+
+define void @print_array() nounwind {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc9, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc10, %for.inc9 ]
+ %exitcond1 = icmp ne i32 %i.0, 1536
+ br i1 %exitcond1, label %for.body, label %for.end11
+
+for.body: ; preds = %for.cond
+ br label %for.cond1
+
+for.cond1: ; preds = %for.inc, %for.body
+ %j.0 = phi i32 [ 0, %for.body ], [ %inc, %for.inc ]
+ %exitcond = icmp ne i32 %j.0, 1536
+ br i1 %exitcond, label %for.body3, label %for.end
+
+for.body3: ; preds = %for.cond1
+ %0 = load %struct._IO_FILE** @stdout, align 4
+ %arrayidx = getelementptr inbounds [1536 x [1536 x float]]* @C, i32 0, i32 %i.0
+ %arrayidx4 = getelementptr inbounds [1536 x float]* %arrayidx, i32 0, i32 %j.0
+ %1 = load float* %arrayidx4, align 4
+ %conv = fpext float %1 to double
+ %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)
+ %rem = srem i32 %j.0, 80
+ %cmp5 = icmp eq i32 %rem, 79
+ br i1 %cmp5, label %if.then, label %if.end
+
+if.then: ; preds = %for.body3
+ %2 = load %struct._IO_FILE** @stdout, align 4
+ %call7 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %2, i8* getelementptr inbounds ([2 x i8]* @.str1, i32 0, i32 0))
+ br label %if.end
+
+if.end: ; preds = %if.then, %for.body3
+ br label %for.inc
+
+for.inc: ; preds = %if.end
+ %inc = add nsw i32 %j.0, 1
+ br label %for.cond1
+
+for.end: ; preds = %for.cond1
+ %3 = load %struct._IO_FILE** @stdout, align 4
+ %call8 = call i32 (%struct._IO_FILE*, i8*, ...)* @fprintf(%struct._IO_FILE* %3, i8* getelementptr inbounds ([2 x i8]* @.str1, i32 0, i32 0))
+ br label %for.inc9
+
+for.inc9: ; preds = %for.end
+ %inc10 = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end11: ; preds = %for.cond
+ ret void
+}
+
+declare i32 @fprintf(%struct._IO_FILE*, i8*, ...)
+
+define i32 @main() nounwind {
+entry:
+ call void @init_array()
+ br label %for.cond
+
+for.cond: ; preds = %for.inc19, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc20, %for.inc19 ]
+ %exitcond2 = icmp ne i32 %i.0, 1536
+ br i1 %exitcond2, label %for.body, label %for.end21
+
+for.body: ; preds = %for.cond
+ br label %for.cond1
+
+for.cond1: ; preds = %for.inc16, %for.body
+ %j.0 = phi i32 [ 0, %for.body ], [ %inc17, %for.inc16 ]
+ %exitcond1 = icmp ne i32 %j.0, 1536
+ br i1 %exitcond1, label %for.body3, label %for.end18
+
+for.body3: ; preds = %for.cond1
+ %arrayidx = getelementptr inbounds [1536 x [1536 x float]]* @C, i32 0, i32 %i.0
+ %arrayidx4 = getelementptr inbounds [1536 x float]* %arrayidx, i32 0, i32 %j.0
+ store float 0.000000e+00, float* %arrayidx4, align 4
+ br label %for.cond5
+
+for.cond5: ; preds = %for.inc, %for.body3
+ %k.0 = phi i32 [ 0, %for.body3 ], [ %inc, %for.inc ]
+ %exitcond = icmp ne i32 %k.0, 1536
+ br i1 %exitcond, label %for.body7, label %for.end
+
+for.body7: ; preds = %for.cond5
+ %arrayidx8 = getelementptr inbounds [1536 x [1536 x float]]* @C, i32 0, i32 %i.0
+ %arrayidx9 = getelementptr inbounds [1536 x float]* %arrayidx8, i32 0, i32 %j.0
+ %0 = load float* %arrayidx9, align 4
+ %arrayidx10 = getelementptr inbounds [1536 x [1536 x float]]* @A, i32 0, i32 %i.0
+ %arrayidx11 = getelementptr inbounds [1536 x float]* %arrayidx10, i32 0, i32 %k.0
+ %1 = load float* %arrayidx11, align 4
+ %arrayidx12 = getelementptr inbounds [1536 x [1536 x float]]* @B, i32 0, i32 %k.0
+ %arrayidx13 = getelementptr inbounds [1536 x float]* %arrayidx12, i32 0, i32 %j.0
+ %2 = load float* %arrayidx13, align 4
+ %mul = fmul float %1, %2
+ %add = fadd float %0, %mul
+ %arrayidx14 = getelementptr inbounds [1536 x [1536 x float]]* @C, i32 0, i32 %i.0
+ %arrayidx15 = getelementptr inbounds [1536 x float]* %arrayidx14, i32 0, i32 %j.0
+ store float %add, float* %arrayidx15, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body7
+ %inc = add nsw i32 %k.0, 1
+ br label %for.cond5
+
+for.end: ; preds = %for.cond5
+ br label %for.inc16
+
+for.inc16: ; preds = %for.end
+ %inc17 = add nsw i32 %j.0, 1
+ br label %for.cond1
+
+for.end18: ; preds = %for.cond1
+ br label %for.inc19
+
+for.inc19: ; preds = %for.end18
+ %inc20 = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end21: ; preds = %for.cond
+ call void @print_array()
+ ret i32 0
+}
+
+;CHECK: Printing analysis 'Polly - Analysis the Loop Nest Tree' for region: 'for.cond => for.end21' in function 'main':
+;CHECK: Loop Nest Tree:
+;CHECK: -----------------------------
+;CHECK: for
+;CHECK: for
+;CHECK: Stmt_for_body3
+;CHECK: for
+;CHECK: Stmt_for_body7
+;CHECK: -----------------------------
+;CHECK: End of Loop Nest Tree.
+;CHECK: Innermost Loop(s):
+;CHECK: *****************************
+;CHECK: Stmt_for_body7
+;CHECK: *****************************
+;CHECK: End of Innermost Loop(s).
diff --git a/test/LoopNestTree/simatax.c b/test/LoopNestTree/simatax.c
new file mode 100755
index 0000000..9f5da6e
--- /dev/null
+++ b/test/LoopNestTree/simatax.c
@@ -0,0 +1,36 @@
+#include <math.h>
+
+#define nx 1024
+#define ny 1024
+
+#define DATA_TYPE double
+
+double A[1024][1024], x[1024], y[1024], tmp[1024];
+
+void init_array() {
+ int i, j;
+
+ for (i = 0; i < ny; i++)
+ x[i] = i * M_PI;
+ for (i = 0; i < nx; i++)
+ for (j = 0; j < ny; j++)
+ A[i][j] = ((DATA_TYPE) i*(j+1)) / nx;
+}
+
+int main() {
+ init_array();
+ int i, j;
+
+ for (i = 0; i < nx; i++)
+ y[i] = 0;
+ for (i = 0; i < nx; i++){
+ tmp[i] = 0;
+ for (j = 0; j < ny; j++)
+ tmp[i] = tmp[i] + A[i][j] * x[j];
+ for (j = 0; j < ny; j++)
+ y[j] = y[j] + A[i][j] * tmp[i];
+ }
+
+ return 0;
+
+}
\ No newline at end of file
diff --git a/test/LoopNestTree/simatax.ll b/test/LoopNestTree/simatax.ll
new file mode 100755
index 0000000..9da51d4
--- /dev/null
+++ b/test/LoopNestTree/simatax.ll
@@ -0,0 +1,184 @@
+; RUN: opt %loadPolly %defaultOpts -polly-loopnesttree -analyze %s | FileCheck %s
+; ModuleID = 'simatax.s'
+target 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"
+target triple = "i386-pc-linux-gnu"
+
+@x = common global [1024 x double] zeroinitializer, align 4
+@A = common global [1024 x [1024 x double]] zeroinitializer, align 4
+@y = common global [1024 x double] zeroinitializer, align 4
+@tmp = common global [1024 x double] zeroinitializer, align 4
+
+define void @init_array() nounwind {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %exitcond2 = icmp ne i32 %i.0, 1024
+ br i1 %exitcond2, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %conv = sitofp i32 %i.0 to double
+ %mul = fmul double %conv, 0x400921FB54442D18
+ %arrayidx = getelementptr inbounds [1024 x double]* @x, i32 0, i32 %i.0
+ store double %mul, double* %arrayidx, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond1
+
+for.cond1: ; preds = %for.inc17, %for.end
+ %i.1 = phi i32 [ 0, %for.end ], [ %inc18, %for.inc17 ]
+ %exitcond1 = icmp ne i32 %i.1, 1024
+ br i1 %exitcond1, label %for.body4, label %for.end19
+
+for.body4: ; preds = %for.cond1
+ br label %for.cond5
+
+for.cond5: ; preds = %for.inc14, %for.body4
+ %j.0 = phi i32 [ 0, %for.body4 ], [ %inc15, %for.inc14 ]
+ %exitcond = icmp ne i32 %j.0, 1024
+ br i1 %exitcond, label %for.body8, label %for.end16
+
+for.body8: ; preds = %for.cond5
+ %conv9 = sitofp i32 %i.1 to double
+ %add = add nsw i32 %j.0, 1
+ %conv10 = sitofp i32 %add to double
+ %mul11 = fmul double %conv9, %conv10
+ %div = fdiv double %mul11, 1.024000e+03
+ %arrayidx12 = getelementptr inbounds [1024 x [1024 x double]]* @A, i32 0, i32 %i.1
+ %arrayidx13 = getelementptr inbounds [1024 x double]* %arrayidx12, i32 0, i32 %j.0
+ store double %div, double* %arrayidx13, align 4
+ br label %for.inc14
+
+for.inc14: ; preds = %for.body8
+ %inc15 = add nsw i32 %j.0, 1
+ br label %for.cond5
+
+for.end16: ; preds = %for.cond5
+ br label %for.inc17
+
+for.inc17: ; preds = %for.end16
+ %inc18 = add nsw i32 %i.1, 1
+ br label %for.cond1
+
+for.end19: ; preds = %for.cond1
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ call void @init_array()
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %exitcond3 = icmp ne i32 %i.0, 1024
+ br i1 %exitcond3, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds [1024 x double]* @y, i32 0, i32 %i.0
+ store double 0.000000e+00, double* %arrayidx, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ br label %for.cond1
+
+for.cond1: ; preds = %for.inc29, %for.end
+ %i.1 = phi i32 [ 0, %for.end ], [ %inc30, %for.inc29 ]
+ %exitcond2 = icmp ne i32 %i.1, 1024
+ br i1 %exitcond2, label %for.body3, label %for.end31
+
+for.body3: ; preds = %for.cond1
+ %arrayidx4 = getelementptr inbounds [1024 x double]* @tmp, i32 0, i32 %i.1
+ store double 0.000000e+00, double* %arrayidx4, align 4
+ br label %for.cond5
+
+for.cond5: ; preds = %for.inc13, %for.body3
+ %j.0 = phi i32 [ 0, %for.body3 ], [ %inc14, %for.inc13 ]
+ %exitcond = icmp ne i32 %j.0, 1024
+ br i1 %exitcond, label %for.body7, label %for.end15
+
+for.body7: ; preds = %for.cond5
+ %arrayidx8 = getelementptr inbounds [1024 x double]* @tmp, i32 0, i32 %i.1
+ %0 = load double* %arrayidx8, align 4
+ %arrayidx9 = getelementptr inbounds [1024 x [1024 x double]]* @A, i32 0, i32 %i.1
+ %arrayidx10 = getelementptr inbounds [1024 x double]* %arrayidx9, i32 0, i32 %j.0
+ %1 = load double* %arrayidx10, align 4
+ %arrayidx11 = getelementptr inbounds [1024 x double]* @x, i32 0, i32 %j.0
+ %2 = load double* %arrayidx11, align 4
+ %mul = fmul double %1, %2
+ %add = fadd double %0, %mul
+ %arrayidx12 = getelementptr inbounds [1024 x double]* @tmp, i32 0, i32 %i.1
+ store double %add, double* %arrayidx12, align 4
+ br label %for.inc13
+
+for.inc13: ; preds = %for.body7
+ %inc14 = add nsw i32 %j.0, 1
+ br label %for.cond5
+
+for.end15: ; preds = %for.cond5
+ br label %for.cond16
+
+for.cond16: ; preds = %for.inc26, %for.end15
+ %j.1 = phi i32 [ 0, %for.end15 ], [ %inc27, %for.inc26 ]
+ %exitcond1 = icmp ne i32 %j.1, 1024
+ br i1 %exitcond1, label %for.body18, label %for.end28
+
+for.body18: ; preds = %for.cond16
+ %arrayidx19 = getelementptr inbounds [1024 x double]* @y, i32 0, i32 %j.1
+ %3 = load double* %arrayidx19, align 4
+ %arrayidx20 = getelementptr inbounds [1024 x [1024 x double]]* @A, i32 0, i32 %i.1
+ %arrayidx21 = getelementptr inbounds [1024 x double]* %arrayidx20, i32 0, i32 %j.1
+ %4 = load double* %arrayidx21, align 4
+ %arrayidx22 = getelementptr inbounds [1024 x double]* @tmp, i32 0, i32 %i.1
+ %5 = load double* %arrayidx22, align 4
+ %mul23 = fmul double %4, %5
+ %add24 = fadd double %3, %mul23
+ %arrayidx25 = getelementptr inbounds [1024 x double]* @y, i32 0, i32 %j.1
+ store double %add24, double* %arrayidx25, align 4
+ br label %for.inc26
+
+for.inc26: ; preds = %for.body18
+ %inc27 = add nsw i32 %j.1, 1
+ br label %for.cond16
+
+for.end28: ; preds = %for.cond16
+ br label %for.inc29
+
+for.inc29: ; preds = %for.end28
+ %inc30 = add nsw i32 %i.1, 1
+ br label %for.cond1
+
+for.end31: ; preds = %for.cond1
+ ret i32 0
+}
+
+;CHECK: Printing analysis 'Polly - Analysis the Loop Nest Tree' for region: 'for.cond => for.end31' in function 'main':
+;CHECK: Loop Nest Tree:
+;CHECK: -----------------------------
+;CHECK: for
+;CHECK: Stmt_for_body
+;CHECK: for
+;CHECK: Stmt_for_body3
+;CHECK: for
+;CHECK: Stmt_for_body7
+;CHECK: for
+;CHECK: Stmt_for_body18
+;CHECK: -----------------------------
+;CHECK: End of Loop Nest Tree.
+;CHECK: Innermost Loop(s):
+;CHECK: *****************************
+;CHECK: Stmt_for_body
+;CHECK: Stmt_for_body7
+;CHECK: Stmt_for_body18
+;CHECK: *****************************
+;CHECK: End of Innermost Loop(s).
\ No newline at end of file
diff --git a/test/LoopNestTree/simple_loop.c b/test/LoopNestTree/simple_loop.c
new file mode 100755
index 0000000..0e5905e
--- /dev/null
+++ b/test/LoopNestTree/simple_loop.c
@@ -0,0 +1,20 @@
+#define N 100
+int A[N];
+
+void init_array() {
+ int i=0;
+ for(i=0; i<N; i++) {
+ A[i] = i;
+ }
+}
+
+
+int main() {
+ int i = 0;
+
+ init_array();
+ for (i=0; i<N;i++) {
+ A[i] = A[i] + i;
+ }
+return 0;
+}
diff --git a/test/LoopNestTree/simple_loop.ll b/test/LoopNestTree/simple_loop.ll
new file mode 100644
index 0000000..06274a8
--- /dev/null
+++ b/test/LoopNestTree/simple_loop.ll
@@ -0,0 +1,67 @@
+; RUN: opt %loadPolly %defaultOpts -polly-loopnesttree -analyze %s | FileCheck %s
+; ModuleID = 'simple_loop.s'
+target 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"
+target triple = "i386-pc-linux-gnu"
+
+@A = common global [100 x i32] zeroinitializer, align 4
+
+define void @init_array() nounwind {
+entry:
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %exitcond = icmp ne i32 %i.0, 100
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds [100 x i32]* @A, i32 0, i32 %i.0
+ store i32 %i.0, i32* %arrayidx, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}
+
+define i32 @main() nounwind {
+entry:
+ call void @init_array()
+ br label %for.cond
+
+for.cond: ; preds = %for.inc, %entry
+ %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
+ %exitcond = icmp ne i32 %i.0, 100
+ br i1 %exitcond, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %arrayidx = getelementptr inbounds [100 x i32]* @A, i32 0, i32 %i.0
+ %0 = load i32* %arrayidx, align 4
+ %add = add nsw i32 %0, %i.0
+ %arrayidx1 = getelementptr inbounds [100 x i32]* @A, i32 0, i32 %i.0
+ store i32 %add, i32* %arrayidx1, align 4
+ br label %for.inc
+
+for.inc: ; preds = %for.body
+ %inc = add nsw i32 %i.0, 1
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret i32 0
+}
+
+;CHECK: Printing analysis 'Polly - Analysis the Loop Nest Tree' for region: 'for.cond => for.end' in function 'main':
+;CHECK: Loop Nest Tree:
+;CHECK: -----------------------------
+;CHECK: for
+;CHECK: Stmt_for_body
+;CHECK: -----------------------------
+;CHECK: End of Loop Nest Tree.
+;CHECK: Innermost Loop(s):
+;CHECK: *****************************
+;CHECK: Stmt_for_body
+;CHECK: *****************************
+;CHECK: End of Innermost Loop(s).
--
1.7.5.1