; RUN: opt %loadPolly -basic-aa -polly-ast -analyze < %s | FileCheck %s ; RUN: opt %loadPolly -basic-aa -polly-codegen -loops -analyze < %s | FileCheck %s -check-prefix=LOOPS ;#include ;#define N 1024 ;int A[N]; ;int B[N]; ; ;void loop_with_condition() { ; int i; ; ; __sync_synchronize(); ; for (i = 0; i < N; i++) { ; if (i <= N / 2) { ; if (i > 20) ; A[i] = 1; ; else ; A[i] = 2; ; } ; B[i] = 3; ; } ; __sync_synchronize(); ;} ; ;int main () { ; int i; ; ; memset(A, 0, sizeof(int) * N); ; memset(B, 0, sizeof(int) * N); ; ; loop_with_condition(); ; ; for (i = 0; i < N; i++) ; if (B[i] != 3) ; return 1; ; ; for (i = 0; i < N; i++) ; if (i <= N / 2 && i > 20 && A[i] != 1) ; return 1; ; else if (i > N / 2) { ; if (i <= 20 && A[i] != 2) ; return 1; ; if (i > 20 && A[i] != 0) ; return 1; ; } ; return 0; ;} 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" @A = common global [1024 x i32] zeroinitializer, align 16 ; <[1024 x i32]*> [#uses=4] @B = common global [1024 x i32] zeroinitializer, align 16 ; <[1024 x i32]*> [#uses=4] define void @loop_with_condition() nounwind { bb0: fence seq_cst br label %bb1 bb1: %indvar = phi i64 [ %indvar.next, %bb10 ], [ 0, %bb0 ] ; [#uses=5] %scevgep = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %indvar ; [#uses=2] %scevgep1 = getelementptr [1024 x i32], [1024 x i32]* @B, i64 0, i64 %indvar ; [#uses=1] %i.0 = trunc i64 %indvar to i32 ; [#uses=2] %exitcond = icmp ne i64 %indvar, 1024 ; [#uses=1] br i1 %exitcond, label %bb2, label %bb11 bb2: %var3 = icmp sle i32 %i.0, 512 ; [#uses=1] br i1 %var3, label %bb4, label %bb9 bb4: %var5 = icmp sgt i32 %i.0, 20 ; [#uses=1] br i1 %var5, label %bb6, label %bb7 bb6: store i32 1, i32* %scevgep br label %bb8 bb7: store i32 2, i32* %scevgep br label %bb8 bb8: br label %bb9 bb9: store i32 3, i32* %scevgep1 br label %bb10 bb10: %indvar.next = add i64 %indvar, 1 ; [#uses=1] br label %bb1 bb11: fence seq_cst ret void } define i32 @main() nounwind { ;