1 ; RUN: opt %loadPolly -polly-ast -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s -check-prefix=CODEGEN
3 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"
5 @A = common global [1024 x i32] zeroinitializer
7 define void @bar(i64 %n) {
13 %i = phi i64 [ 0, %start ], [ %i.next, %loop.backedge ]
14 %scevgep = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %i
15 %exitcond = icmp ne i64 %i, %n
16 br i1 %exitcond, label %loop.body, label %ret
19 store i32 1, i32* %scevgep
20 br label %loop.backedge
23 %i.next = add nsw i64 %i, 1
31 ; CHECK: for (int c0 = 0; c0 < n; c0 += 1)
32 ; CHECK: Stmt_loop_body(c0)
34 ; CODEGEN: polly.start:
35 ; CODEGEN: br label %polly.loop_if
37 ; CODEGEN: polly.loop_exit:
38 ; CODEGEN: br label %polly.merge_new_and_old
40 ; CODEGEN: polly.loop_if:
41 ; CODEGEN: %polly.loop_guard = icmp slt i64 0, %n
42 ; CODEGEN: br i1 %polly.loop_guard, label %polly.loop_preheader, label %polly.loop_exit
44 ; CODEGEN: polly.loop_header:
45 ; CODEGEN: %polly.indvar = phi i64 [ 0, %polly.loop_preheader ], [ %polly.indvar_next, %polly.stmt.loop.body ]
46 ; CODEGEN: br label %polly.stmt.loop.body
48 ; CODEGEN: polly.stmt.loop.body:
49 ; CODEGEN: [[PTR:%[a-zA-Z0-9_\.]+]] = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %polly.indvar
50 ; CODEGEN: store i32 1, i32* [[PTR]]
51 ; CODEGEN: %polly.indvar_next = add nsw i64 %polly.indvar, 1
52 ; CODEGEN: %polly.loop_cond = icmp slt i64 %polly.indvar_next, %n
53 ; CODEGEN: br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit
55 ; CODEGEN: polly.loop_preheader:
56 ; CODEGEN: br label %polly.loop_header