1 ; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=print<polly-function-scops>' \
2 ; RUN: -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 | FileCheck %s
3 ; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb -passes=polly-codegen \
4 ; RUN: -polly-invariant-load-hoisting=true -disable-output < %s
6 ; The loop for.body is a scop with invariant load hoisting, but does not
7 ; terminate predictably for ScalarEvolution. The scalar %1 therefore is not
8 ; synthesizable using SCEVExpander. We therefore must have Stmt_for_end_loopexit
9 ; to catch the induction variable at loop exit. We also check for not crashing
10 ; at codegen because SCEVExpander would use the original induction variable in
13 %struct.bit_stream_struc.3.43.51.71.83.91.99.107.154 = type { ptr, i32, ptr, ptr, i32, i64, i32, i32 }
14 %struct._IO_FILE.1.41.49.69.81.89.97.105.153 = type { i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, i16, i8, [1 x i8], ptr, i64, ptr, ptr, ptr, ptr, i64, i32, [20 x i8] }
15 %struct._IO_marker.0.40.48.68.80.88.96.104.152 = type { ptr, ptr, i32 }
17 define i32 @copy_buffer(ptr nocapture %bs) {
19 %buf_byte_idx5.phi.trans.insert = getelementptr inbounds %struct.bit_stream_struc.3.43.51.71.83.91.99.107.154, ptr %bs, i64 0, i32 6
20 br i1 undef, label %for.body, label %cleanup
23 %indvars.iv28 = phi i64 [ %indvars.iv.next29, %for.body ], [ 0, %entry ]
24 %indvars.iv.next29 = add nuw nsw i64 %indvars.iv28, 1
25 %0 = load i32, ptr %buf_byte_idx5.phi.trans.insert, align 8
26 %cmp6 = icmp sgt i32 0, %0
27 br i1 %cmp6, label %for.body, label %for.end.loopexit
30 %var1 = trunc i64 %indvars.iv.next29 to i32
34 %retval.0 = phi i32 [ 0, %entry ], [ %var1, %for.end.loopexit ]
39 ; CHECK: Invariant Accesses: {
40 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
41 ; CHECK-NEXT: [p_0_loaded_from_bs] -> { Stmt_for_body[i0] -> MemRef_bs[11] };
42 ; CHECK-NEXT: Execution Context: [p_0_loaded_from_bs] -> { : }
45 ; CHECK-NEXT: Stmt_for_body
46 ; CHECK-NEXT: Domain :=
47 ; CHECK-NEXT: [p_0_loaded_from_bs] -> { Stmt_for_body[0] : p_0_loaded_from_bs >= 0 };
48 ; CHECK-NEXT: Schedule :=
49 ; CHECK-NEXT: [p_0_loaded_from_bs] -> { Stmt_for_body[i0] -> [0, 0] };
50 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
51 ; CHECK-NEXT: [p_0_loaded_from_bs] -> { Stmt_for_body[i0] -> MemRef_indvars_iv_next29[] };
52 ; CHECK-NEXT: Stmt_for_end_loopexit
53 ; CHECK-NEXT: Domain :=
54 ; CHECK-NEXT: [p_0_loaded_from_bs] -> { Stmt_for_end_loopexit[] : p_0_loaded_from_bs >= 0 };
55 ; CHECK-NEXT: Schedule :=
56 ; CHECK-NEXT: [p_0_loaded_from_bs] -> { Stmt_for_end_loopexit[] -> [1, 0] };
57 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
58 ; CHECK-NEXT: [p_0_loaded_from_bs] -> { Stmt_for_end_loopexit[] -> MemRef_indvars_iv_next29[] };
59 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
60 ; CHECK-NEXT: [p_0_loaded_from_bs] -> { Stmt_for_end_loopexit[] -> MemRef_var1[] };