Reapply of a22d1c2225543aa9ae7882f6b1a97ee7b2c95574. Using this PR for pre-merge CI. Instead of relying on any pass manager to schedule Polly's passes, add Polly's own pipeline manager which is seen as a monolithic pass in LLVM's pass manager. Polly's former passes are now phases of the new PhaseManager component. Relying on LLVM's pass manager (the legacy as well as the New Pass Manager) to manage Polly's phases never was a good fit that the PhaseManager resolves: * Polly passes were modifying analysis results, in particular RegionInfo and ScopInfo. This means that there was not just one unique and "definite" analysis result, the actual result depended on which analyses ran prior, and the pass manager was not allowed to throw away cached analyses or prior SCoP optimizations would have been forgotten. The LLVM pass manger's persistance of analysis results is not contractual but designed for caching. * Polly depends on a particular execution order of passes and regions (e.g. regression tests, invalidation of consecutive SCoPs). LLVM's pass manager does not guarantee any excecution order. * Polly does not completely preserve DominatorTree, RegionInfo, LoopInfo, or ScalarEvolution, but only as-needed for Polly's own uses. Because the ScopDetection object stores references to those analyses, it still had to lie to the pass manager that they would be preserved, or the pass manager would have released and recomputed the invalidated analysis objects that ScopDetection/ScopInfo was still referencing. To ensure that no non-Polly pass would see these not-completely-preserved analyses, all analyses still had to be thrown away after the ScopPassManager, respectively with a BarrierNoopPass in case of the LPM. * The NPM's PassInstrumentation wraps the IR unit into an `llvm::Any` object, but implementations such as PrintIRInstrumentation call llvm_unreachable on encountering an unknown IR unit, such as SCoPs, with no extension points to add support. Hence LLVM crashes when dumping IR between SCoP passes (such as `-print-before-changed` with Polly being active). The new PhaseManager uses some command line options that previously belonged to Polly's legacy passes, such as `-polly-print-detect` (so the option will continue to work). Hence the LPM support is incompatible with the new approach and support for it is removed.
95 lines
4.9 KiB
LLVM
95 lines
4.9 KiB
LLVM
; RUN: opt %loadNPMPolly -S '-passes=polly-custom<scops>' -polly-print-scops -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 | FileCheck %s -check-prefix=SCOPS
|
|
; RUN: opt %loadNPMPolly -S '-passes=polly<no-default-opts>' -polly-invariant-load-hoisting=true %s | FileCheck %s
|
|
;
|
|
; Check we generate valid code.
|
|
|
|
; SCOPS: Statements {
|
|
; SCOPS-NEXT: Stmt_if_then2457
|
|
; SCOPS-NEXT: Domain :=
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_if_then2457[] : p_0 = 1 };
|
|
; SCOPS-NEXT: Schedule :=
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_if_then2457[] -> [1] };
|
|
; SCOPS-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_if_then2457[] -> MemRef_sub2464[] };
|
|
; SCOPS-NEXT: Stmt_cond_false2468
|
|
; SCOPS-NEXT: Domain :=
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_cond_false2468[] : p_0 = 1 };
|
|
; SCOPS-NEXT: Schedule :=
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_cond_false2468[] -> [2] };
|
|
; SCOPS-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_cond_false2468[] -> MemRef_sub2464[] };
|
|
; SCOPS-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_cond_false2468[] -> MemRef_A[0] };
|
|
; SCOPS-NEXT: Stmt_if_else2493
|
|
; SCOPS-NEXT: Domain :=
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_if_else2493[] : p_0 >= 2 or p_0 = 0 };
|
|
; SCOPS-NEXT: Schedule :=
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_if_else2493[] -> [0] : p_0 >= 2 or p_0 = 0 };
|
|
; SCOPS-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
|
|
; SCOPS-NEXT: [p_0] -> { Stmt_if_else2493[] -> MemRef_B[0] };
|
|
; SCOPS-NEXT: }
|
|
|
|
; CHECK: polly.start
|
|
|
|
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-unknown-linux-gnu"
|
|
|
|
%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, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32 }
|
|
|
|
@enc_picture = external global ptr, align 8
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
define void @compute_colocated(ptr %listX, ptr %A, ptr %B) {
|
|
entry:
|
|
br label %for.body2414
|
|
|
|
for.body2414: ; preds = %for.inc2621, %entry
|
|
%indvars.iv902 = phi i64 [ %indvars.iv.next903, %for.inc2621 ], [ 0, %entry ]
|
|
br label %if.else2454
|
|
|
|
if.else2454: ; preds = %for.body2414
|
|
%cmp2455 = icmp eq i64 %indvars.iv902, 2
|
|
br i1 %cmp2455, label %if.then2457, label %if.else2493
|
|
|
|
if.then2457: ; preds = %if.else2454
|
|
%arrayidx2461 = getelementptr inbounds ptr, ptr %listX, i64 %indvars.iv902
|
|
%tmp1 = load ptr, ptr %arrayidx2461, align 8, !tbaa !1
|
|
%tmp2 = load ptr, ptr %tmp1, align 8, !tbaa !1
|
|
%poc2463 = getelementptr inbounds %struct.s, ptr %tmp2, i64 0, i32 1
|
|
%tmp3 = load i32, ptr %poc2463, align 4, !tbaa !5
|
|
%sub2464 = sub nsw i32 0, %tmp3
|
|
br label %cond.false2468
|
|
|
|
cond.false2468: ; preds = %if.then2457
|
|
%cmp2477 = icmp sgt i32 %sub2464, 127
|
|
store i1 %cmp2477, ptr %A
|
|
br label %for.inc2621
|
|
|
|
if.else2493: ; preds = %if.else2454
|
|
%arrayidx2497 = getelementptr inbounds ptr, ptr %listX, i64 %indvars.iv902
|
|
%tmp4 = load ptr, ptr %arrayidx2497, align 8, !tbaa !1
|
|
%tmp5 = load ptr, ptr %tmp4, align 8, !tbaa !1
|
|
%poc2499 = getelementptr inbounds %struct.s, ptr %tmp5, i64 0, i32 1
|
|
%tmp6 = load i32, ptr %poc2499, align 4, !tbaa !5
|
|
store i32 %tmp6, ptr %B
|
|
br label %for.inc2621
|
|
|
|
for.inc2621: ; preds = %if.else2493, %cond.false2468
|
|
%indvars.iv.next903 = add nuw nsw i64 %indvars.iv902, 2
|
|
br i1 undef, label %for.body2414, label %if.end2624
|
|
|
|
if.end2624: ; preds = %for.inc2621
|
|
ret void
|
|
}
|
|
|
|
!llvm.ident = !{!0}
|
|
|
|
!0 = !{!"clang version 3.9.0"}
|
|
!1 = !{!2, !2, i64 0}
|
|
!2 = !{!"any pointer", !3, i64 0}
|
|
!3 = !{!"omnipotent char", !4, i64 0}
|
|
!4 = !{!"Simple C/C++ TBAA"}
|
|
!5 = !{!6, !7, i64 4}
|
|
!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}
|
|
!7 = !{!"int", !3, i64 0}
|