1 ; RUN: opt %loadPolly -basic-aa -polly-print-ast -disable-output < %s | FileCheck %s
8 ;void loop_with_condition_ineq() {
11 ; __sync_synchronize();
12 ; for (i = 0; i < N; i++) {
19 ; __sync_synchronize();
25 ; memset(A, 0, sizeof(int) * N);
26 ; memset(B, 0, sizeof(int) * N);
28 ; loop_with_condition_ineq();
30 ; for (i = 0; i < N; i++)
34 ; for (i = 0; i < N; i++)
35 ; if (i != N / 2 && A[i] != 1)
37 ; else if (i == N && A[i] != 2)
42 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"
44 @A = common global [1024 x i32] zeroinitializer, align 16 ; <ptr> [#uses=4]
45 @B = common global [1024 x i32] zeroinitializer, align 16 ; <ptr> [#uses=4]
47 define void @loop_with_condition_ineq() nounwind {
53 %indvar = phi i64 [ %indvar.next, %bb7 ], [ 0, %bb0 ] ; <i64> [#uses=5]
54 %scevgep = getelementptr [1024 x i32], ptr @A, i64 0, i64 %indvar ; <ptr> [#uses=2]
55 %scevgep1 = getelementptr [1024 x i32], ptr @B, i64 0, i64 %indvar ; <ptr> [#uses=1]
56 %i.0 = trunc i64 %indvar to i32 ; <i32> [#uses=1]
57 %exitcond = icmp ne i64 %indvar, 1024 ; <i1> [#uses=1]
58 br i1 %exitcond, label %bb2, label %bb8
61 %var3 = icmp ne i32 %i.0, 512 ; <i1> [#uses=1]
62 br i1 %var3, label %bb4, label %bb5
65 store i32 1, ptr %scevgep
69 store i32 2, ptr %scevgep
73 store i32 3, ptr %scevgep1
77 %indvar.next = add i64 %indvar, 1 ; <i64> [#uses=1]
85 define i32 @main() nounwind {
87 call void @llvm.memset.p0.i64(ptr @A, i8 0, i64 4096, i32 1, i1 false)
88 call void @llvm.memset.p0.i64(ptr @B, i8 0, i64 4096, i32 1, i1 false)
89 call void @loop_with_condition_ineq()
92 ; <label>:1 ; preds = %8, %0
93 %indvar1 = phi i64 [ %indvar.next2, %8 ], [ 0, %0 ] ; <i64> [#uses=3]
94 %scevgep3 = getelementptr [1024 x i32], ptr @B, i64 0, i64 %indvar1 ; <ptr> [#uses=1]
95 %i.0 = trunc i64 %indvar1 to i32 ; <i32> [#uses=1]
96 %2 = icmp slt i32 %i.0, 1024 ; <i1> [#uses=1]
97 br i1 %2, label %3, label %9
99 ; <label>:3 ; preds = %1
100 %4 = load i32, ptr %scevgep3 ; <i32> [#uses=1]
101 %5 = icmp ne i32 %4, 3 ; <i1> [#uses=1]
102 br i1 %5, label %6, label %7
104 ; <label>:6 ; preds = %3
107 ; <label>:7 ; preds = %3
110 ; <label>:8 ; preds = %7
111 %indvar.next2 = add i64 %indvar1, 1 ; <i64> [#uses=1]
114 ; <label>:9 ; preds = %1
117 ; <label>:10 ; preds = %26, %9
118 %indvar = phi i64 [ %indvar.next, %26 ], [ 0, %9 ] ; <i64> [#uses=3]
119 %scevgep = getelementptr [1024 x i32], ptr @A, i64 0, i64 %indvar ; <ptr> [#uses=2]
120 %i.1 = trunc i64 %indvar to i32 ; <i32> [#uses=3]
121 %11 = icmp slt i32 %i.1, 1024 ; <i1> [#uses=1]
122 br i1 %11, label %12, label %27
124 ; <label>:12 ; preds = %10
125 %13 = icmp ne i32 %i.1, 512 ; <i1> [#uses=1]
126 br i1 %13, label %14, label %18
128 ; <label>:14 ; preds = %12
129 %15 = load i32, ptr %scevgep ; <i32> [#uses=1]
130 %16 = icmp ne i32 %15, 1 ; <i1> [#uses=1]
131 br i1 %16, label %17, label %18
133 ; <label>:17 ; preds = %14
136 ; <label>:18 ; preds = %14, %12
137 %19 = icmp eq i32 %i.1, 1024 ; <i1> [#uses=1]
138 br i1 %19, label %20, label %24
140 ; <label>:20 ; preds = %18
141 %21 = load i32, ptr %scevgep ; <i32> [#uses=1]
142 %22 = icmp ne i32 %21, 2 ; <i1> [#uses=1]
143 br i1 %22, label %23, label %24
145 ; <label>:23 ; preds = %20
148 ; <label>:24 ; preds = %20, %18
151 ; <label>:25 ; preds = %24
154 ; <label>:26 ; preds = %25
155 %indvar.next = add i64 %indvar, 1 ; <i64> [#uses=1]
158 ; <label>:27 ; preds = %10
161 ; <label>:28 ; preds = %27, %23, %17, %6
162 %.0 = phi i32 [ 1, %6 ], [ 1, %17 ], [ 1, %23 ], [ 0, %27 ] ; <i32> [#uses=1]
166 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i32, i1) nounwind
168 ; CHECK: for (int c0 = 0; c0 <= 1023; c0 += 1) {
169 ; CHECK: if (c0 == 512) {
170 ; CHECK: Stmt_bb5(512);
172 ; CHECK: Stmt_bb4(c0);
173 ; CHECK: Stmt_bb6(c0);