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 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"
4 target triple = "x86_64-pc-linux-gnu"
6 @A = common global [1024 x i32] zeroinitializer
8 define void @bar(i64 %n) {
14 %i = phi i64 [ 0, %start ], [ %i.next, %loop.backedge ]
15 %scevgep = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %i
16 %exitcond = icmp ne i64 %i, %n
17 br i1 %exitcond, label %loop.body, label %ret
20 store i32 1, i32* %scevgep
21 br label %loop.backedge
24 %i.next = add nsw i64 %i, 1
32 ; CHECK: for (int c0 = 0; c0 < n; c0 += 1)
33 ; CHECK: Stmt_loop_body(c0)
35 ; CODEGEN: polly.start:
36 ; CODEGEN: br label %polly.loop_if
38 ; CODEGEN: polly.loop_exit:
39 ; CODEGEN: br label %polly.merge_new_and_old
41 ; CODEGEN: polly.loop_if:
42 ; CODEGEN: %polly.loop_guard = icmp slt i64 0, %n
43 ; CODEGEN: br i1 %polly.loop_guard, label %polly.loop_preheader, label %polly.loop_exit
45 ; CODEGEN: polly.loop_header:
46 ; CODEGEN: %polly.indvar = phi i64 [ 0, %polly.loop_preheader ], [ %polly.indvar_next, %polly.stmt.loop.body ]
47 ; CODEGEN: br label %polly.stmt.loop.body
49 ; CODEGEN: polly.stmt.loop.body:
50 ; CODEGEN: [[PTR:%[a-zA-Z0-9_\.]+]] = getelementptr [1024 x i32], [1024 x i32]* @A, i64 0, i64 %polly.indvar
51 ; CODEGEN: store i32 1, i32* [[PTR]]
52 ; CODEGEN: %polly.indvar_next = add nsw i64 %polly.indvar, 1
53 ; CODEGEN: %polly.adjust_ub = sub i64 %n, 1
54 ; CODEGEN: %polly.loop_cond = icmp slt i64 %polly.indvar, %polly.adjust_ub
55 ; CODEGEN: br i1 %polly.loop_cond, label %polly.loop_header, label %polly.loop_exit
57 ; CODEGEN: polly.loop_preheader:
58 ; CODEGEN: br label %polly.loop_header