1 ; RUN: opt %loadPolly -polly-print-ast -disable-output < %s | FileCheck %s
8 ;void single_do_loop_scev_replace() {
11 ; __sync_synchronize();
20 ; __sync_synchronize();
26 ; single_do_loop_scev_replace();
28 ; fprintf(stdout, "Output %d\n", A[0]);
30 ; if (A[2 * N - 2] == N - 1)
36 target 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"
38 %struct._IO_FILE = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
39 %struct._IO_marker = type { ptr, ptr, i32 }
41 @A = common global [40 x i32] zeroinitializer, align 4 ; <ptr> [#uses=3]
42 @stdout = external global ptr ; <ptr> [#uses=1]
43 @.str = private constant [11 x i8] c"Output %d\0A\00" ; <ptr> [#uses=1]
45 define void @single_do_loop_scev_replace() nounwind {
50 do.body: ; preds = %do.cond, %entry
51 %indvar = phi i64 [ %indvar.next, %do.cond ], [ 0, %entry ] ; <i64> [#uses=3]
52 %tmp = mul i64 %indvar, 2 ; <i64> [#uses=1]
53 %arrayidx = getelementptr [40 x i32], ptr @A, i64 0, i64 %tmp ; <ptr> [#uses=1]
54 %i.0 = trunc i64 %indvar to i32 ; <i32> [#uses=1]
57 do.cond: ; preds = %do.body
58 store i32 %i.0, ptr %arrayidx
59 %indvar.next = add i64 %indvar, 1 ; <i64> [#uses=2]
60 %exitcond = icmp ne i64 %indvar.next, 20 ; <i1> [#uses=1]
61 br i1 %exitcond, label %do.body, label %do.end
63 do.end: ; preds = %do.cond
68 define i32 @main() nounwind {
70 call void @single_do_loop_scev_replace()
71 %tmp = load ptr, ptr @stdout ; <ptr> [#uses=1]
72 %tmp1 = load i32, ptr @A ; <i32> [#uses=1]
73 %call = call i32 (ptr, ptr, ...) @fprintf(ptr %tmp, ptr @.str, i32 %tmp1) ; <i32> [#uses=0]
74 %tmp2 = load i32, ptr getelementptr inbounds ([40 x i32], ptr @A, i32 0, i64 38) ; <i32> [#uses=1]
75 %cmp = icmp eq i32 %tmp2, 19 ; <i1> [#uses=1]
76 br i1 %cmp, label %if.then, label %if.else
78 if.then: ; preds = %entry
81 if.else: ; preds = %entry
84 return: ; preds = %if.else, %if.then
85 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.else ] ; <i32> [#uses=1]
89 declare i32 @fprintf(ptr, ptr, ...)
91 ; CHECK: for (int c0 = 0; c0 <= 19; c0 += 1)
92 ; CHECK: Stmt_do_cond(c0);