1; RUN: opt %loadPolly -S -polly-scops -analyze \ 2; RUN: -polly-invariant-load-hoisting=true %s \ 3; RUN: | FileCheck %s -check-prefix=SCOPS 4; RUN: opt %loadPolly -S -polly-codegen -polly-invariant-load-hoisting=true %s | FileCheck %s 5; 6; Check we generate valid code. 7 8; SCOPS: Statements { 9; SCOPS-NEXT: Stmt_if_then2457 10; SCOPS-NEXT: Domain := 11; SCOPS-NEXT: [p_0] -> { Stmt_if_then2457[] : p_0 = 1 }; 12; SCOPS-NEXT: Schedule := 13; SCOPS-NEXT: [p_0] -> { Stmt_if_then2457[] -> [1] }; 14; SCOPS-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 15; SCOPS-NEXT: [p_0] -> { Stmt_if_then2457[] -> MemRef_sub2464[] }; 16; SCOPS-NEXT: Stmt_cond_false2468 17; SCOPS-NEXT: Domain := 18; SCOPS-NEXT: [p_0] -> { Stmt_cond_false2468[] : p_0 = 1 }; 19; SCOPS-NEXT: Schedule := 20; SCOPS-NEXT: [p_0] -> { Stmt_cond_false2468[] -> [2] }; 21; SCOPS-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 22; SCOPS-NEXT: [p_0] -> { Stmt_cond_false2468[] -> MemRef_sub2464[] }; 23; SCOPS-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] 24; SCOPS-NEXT: [p_0] -> { Stmt_cond_false2468[] -> MemRef_A[0] }; 25; SCOPS-NEXT: Stmt_if_else2493 26; SCOPS-NEXT: Domain := 27; SCOPS-NEXT: [p_0] -> { Stmt_if_else2493[] : p_0 >= 2 or p_0 = 0 }; 28; SCOPS-NEXT: Schedule := 29; SCOPS-NEXT: [p_0] -> { Stmt_if_else2493[] -> [0] : p_0 >= 2 or p_0 = 0 }; 30; SCOPS-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] 31; SCOPS-NEXT: [p_0] -> { Stmt_if_else2493[] -> MemRef_B[0] }; 32; SCOPS-NEXT: } 33 34; CHECK: polly.start 35 36target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 37target triple = "x86_64-unknown-linux-gnu" 38 39%struct.s = type { i32, i32, i32, i32, i32, i32, [6 x [33 x i64]], [6 x [33 x i64]], [6 x [33 x i64]], [6 x [33 x i64]], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16**, i16*, i16*, i16**, i16**, i16***, i8*, i16***, i64***, i64***, i16****, i8**, i8**, %struct.s*, %struct.s*, %struct.s*, i32, i32, i32, i32, i32, i32, i32 } 40 41@enc_picture = external global %struct.s*, align 8 42 43; Function Attrs: nounwind uwtable 44define void @compute_colocated(%struct.s*** %listX, i1* %A, i32* %B) #0 { 45entry: 46 br label %for.body2414 47 48for.body2414: ; preds = %for.inc2621, %entry 49 %indvars.iv902 = phi i64 [ %indvars.iv.next903, %for.inc2621 ], [ 0, %entry ] 50 br label %if.else2454 51 52if.else2454: ; preds = %for.body2414 53 %cmp2455 = icmp eq i64 %indvars.iv902, 2 54 br i1 %cmp2455, label %if.then2457, label %if.else2493 55 56if.then2457: ; preds = %if.else2454 57 %arrayidx2461 = getelementptr inbounds %struct.s**, %struct.s*** %listX, i64 %indvars.iv902 58 %tmp1 = load %struct.s**, %struct.s*** %arrayidx2461, align 8, !tbaa !1 59 %arrayidx2462 = getelementptr inbounds %struct.s*, %struct.s** %tmp1, i64 0 60 %tmp2 = load %struct.s*, %struct.s** %arrayidx2462, align 8, !tbaa !1 61 %poc2463 = getelementptr inbounds %struct.s, %struct.s* %tmp2, i64 0, i32 1 62 %tmp3 = load i32, i32* %poc2463, align 4, !tbaa !5 63 %sub2464 = sub nsw i32 0, %tmp3 64 br label %cond.false2468 65 66cond.false2468: ; preds = %if.then2457 67 %cmp2477 = icmp sgt i32 %sub2464, 127 68 store i1 %cmp2477, i1* %A 69 br label %for.inc2621 70 71if.else2493: ; preds = %if.else2454 72 %arrayidx2497 = getelementptr inbounds %struct.s**, %struct.s*** %listX, i64 %indvars.iv902 73 %tmp4 = load %struct.s**, %struct.s*** %arrayidx2497, align 8, !tbaa !1 74 %arrayidx2498 = getelementptr inbounds %struct.s*, %struct.s** %tmp4, i64 0 75 %tmp5 = load %struct.s*, %struct.s** %arrayidx2498, align 8, !tbaa !1 76 %poc2499 = getelementptr inbounds %struct.s, %struct.s* %tmp5, i64 0, i32 1 77 %tmp6 = load i32, i32* %poc2499, align 4, !tbaa !5 78 store i32 %tmp6, i32* %B 79 br label %for.inc2621 80 81for.inc2621: ; preds = %if.else2493, %cond.false2468 82 %indvars.iv.next903 = add nuw nsw i64 %indvars.iv902, 2 83 br i1 undef, label %for.body2414, label %if.end2624 84 85if.end2624: ; preds = %for.inc2621 86 ret void 87} 88 89attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 90 91!llvm.ident = !{!0} 92 93!0 = !{!"clang version 3.9.0"} 94!1 = !{!2, !2, i64 0} 95!2 = !{!"any pointer", !3, i64 0} 96!3 = !{!"omnipotent char", !4, i64 0} 97!4 = !{!"Simple C/C++ TBAA"} 98!5 = !{!6, !7, i64 4} 99!6 = !{!"storable_picture", !3, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !3, i64 24, !3, i64 1608, !3, i64 3192, !3, i64 4776, !7, i64 6360, !7, i64 6364, !7, i64 6368, !7, i64 6372, !7, i64 6376, !7, i64 6380, !7, i64 6384, !7, i64 6388, !7, i64 6392, !7, i64 6396, !7, i64 6400, !7, i64 6404, !7, i64 6408, !7, i64 6412, !7, i64 6416, !2, i64 6424, !2, i64 6432, !2, i64 6440, !2, i64 6448, !2, i64 6456, !2, i64 6464, !2, i64 6472, !2, i64 6480, !2, i64 6488, !2, i64 6496, !2, i64 6504, !2, i64 6512, !2, i64 6520, !2, i64 6528, !2, i64 6536, !2, i64 6544, !7, i64 6552, !7, i64 6556, !7, i64 6560, !7, i64 6564, !7, i64 6568, !7, i64 6572, !7, i64 6576} 100!7 = !{!"int", !3, i64 0} 101