1 ; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2 ; RUN: opt %loadPolly -polly-codegen -S < %s | FileCheck %s --check-prefix=IR
4 ; Check that we do not crash and generate valid IR.
6 ; CHECK: Assumed Context:
7 ; CHECK-NEXT: [count1, dobreak, count2] -> { : }
8 ; CHECK-NEXT: Invalid Context:
9 ; CHECK-NEXT: [count1, dobreak, count2] -> { : (count1 > 0 and dobreak > 0) or count1 <= 0 or (count1 > 0 and dobreak <= 0 and count2 > 0) }
11 ; CHECK: Stmt_loop_enter
12 ; CHECK-NEXT: Domain :=
13 ; CHECK-NEXT: [count1, dobreak, count2] -> { Stmt_loop_enter[] : count1 > 0 };
15 ; CHECK: Stmt_loop_break
16 ; CHECK-NEXT: Domain :=
17 ; CHECK-NEXT: [count1, dobreak, count2] -> { Stmt_loop_break[] : count1 > 0 and dobreak > 0 };
19 ; CHECK: Stmt_loop_finish
20 ; CHECK-NEXT: Domain :=
21 ; CHECK-NEXT: [count1, dobreak, count2] -> { Stmt_loop_finish[] : count1 > 0 and dobreak <= 0 and count2 > 0 };
23 ; CHECK: Stmt_loop_skip
24 ; CHECK-NEXT: Domain :=
25 ; CHECK-NEXT: [count1, dobreak, count2] -> { Stmt_loop_skip[] : count1 <= 0 };
27 ; IR: polly.merge_new_and_old:
28 ; IR-NEXT: %phi.ph.merge = phi float [ %phi.ph.final_reload, %polly.exiting ], [ %phi.ph, %return.region_exiting ]
29 ; IR-NEXT: br label %return
32 ; IR-NEXT: %phi = phi float [ %phi.ph.merge, %polly.merge_new_and_old ]
36 define void @func(i64 %count1, i64 %count2, i32 %dobreak, float* %A) {
38 %fadd = fadd float undef, undef
42 %cmp6 = icmp sgt i64 %count1, 0
43 br i1 %cmp6, label %loop_enter, label %loop_skip
47 store float 1.0, float* %A
51 %indvars.iv63 = phi i64 [ %indvars.iv.next64, %loop_continue ], [ 0, %loop_enter ]
52 %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
53 %add8 = add i64 undef, undef
54 %cmp_break = icmp sge i32 %dobreak, 1
55 br i1 %cmp_break, label %loop_break, label %loop_continue
58 %cmp9 = icmp eq i64 %indvars.iv.next64, %count2
59 br i1 %cmp9, label %loop_finish, label %loop_header
63 store float 2.0, float* %A
64 br label %loop_break_error
67 %cmp_loop_break = fcmp oeq float %fadd, 2.
68 br i1 %cmp_loop_break, label %loop_break_g, label %return
76 store float 3.0, float* %A
77 br label %loop_finish_error
85 store float 4.0, float* %A
86 br label %loop_skip_error
94 %phi = phi float [ 0.0, %loop_finish_error ], [ 0.0, %loop_break_error ], [ 2.0, %loop_break_g ], [ 3.0, %loop_skip_error ]
95 store float 1.0, float* %A