1 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-ast -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-codegen-isl -S < %s | FileCheck %s -check-prefix=CODEGEN
3 ; RUN: opt %loadPolly -polly-detect-unprofitable -polly-no-early-exit -polly-codegen-isl -loops -analyze < %s | FileCheck %s -check-prefix=LOOPS
4 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 target triple = "x86_64-pc-linux-gnu"
7 @A = common global [1024 x i32] zeroinitializer
9 define void @bar(i64 %n) {
11 %n_plus_one = add i64 %n, 1
16 %i = phi i64 [ 0, %start ], [ %i.next, %loop.backedge ]
17 %scevgep = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %i
18 %exitcond = icmp ne i64 %i, %n_plus_one
19 br i1 %exitcond, label %loop.body, label %ret
22 store i32 1, i32* %scevgep
23 br label %loop.backedge
26 %i.next = add nsw i64 %i, 1
34 ; CHECK: for (int c0 = 0; c0 <= n; c0 += 1)
35 ; CHECK: Stmt_loop_body(c0)
37 ; CODEGEN: polly.start:
38 ; CODEGEN: br label %polly.loop_if
40 ; CODEGEN: polly.loop_exit:
41 ; CODEGEN: br label %polly.merge_new_and_old
43 ; CODEGEN: polly.loop_if:
44 ; CODEGEN: %polly.loop_guard = icmp sle i64 0, %n
45 ; CODEGEN: br i1 %polly.loop_guard, label %polly.loop_preheader, label %polly.loop_exit
47 ; CODEGEN: polly.loop_header:
48 ; CODEGEN: %polly.indvar = phi i64 [ 0, %polly.loop_preheader ], [ %polly.indvar_next, %polly.stmt.loop.body ]
49 ; CODEGEN: br label %polly.stmt.loop.body
51 ; CODEGEN: polly.stmt.loop.body:
52 ; CODEGEN: [[PTR:%[a-zA-Z0-9_\.]+]] = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %polly.indvar
53 ; CODEGEN: store i32 1, i32* [[PTR]]
54 ; CODEGEN: %polly.indvar_next = add nsw i64 %polly.indvar, 1
55 ; CODEGEN: %polly.adjust_ub = sub i64 %n, 1
56 ; CODEGEN: %polly.loop_cond = icmp sle i64 %polly.indvar, %polly.adjust_ub
57 ; CODEGEN: br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit
59 ; CODEGEN: polly.loop_preheader:
60 ; CODEGEN: br label %polly.loop_header
62 ; LOOPS: Loop at depth 1 containing: %loop.header<header><exiting>,%loop.body,%loop.backedge<latch>
63 ; LOOPS: Loop at depth 1 containing: %polly.loop_header<header>,%polly.stmt.loop.body<latch><exiting>