1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Transforms/LoopRotate/pr35210.ll
Alina Sbirlea 1542bebc55 [LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it.
Summary:
Add a flag to the FunctionToLoopAdaptor that allows enabling MemorySSA only for the loop pass managers that are known to preserve it.

If an LPM is known to have only loop transforms that *all* preserve MemorySSA, then use MemorySSA if `EnableMSSALoopDependency` is set.
If an LPM has loop passes that do not preserve MemorySSA, then the flag passed is `false`, regardless of the value of `EnableMSSALoopDependency`.

When using a custom loop pass pipeline via `passes=...`, use keyword `loop` vs `loop-mssa` to use MemorySSA in that LPM. If a loop that does not preserve MemorySSA is added while using the `loop-mssa` keyword, that's an error.

Add the new `loop-mssa` keyword to a few tests where a difference occurs when enabling MemorySSA.

Reviewers: chandlerc

Subscribers: mehdi_amini, Prazek, george.burgess.iv, sanjoy.google, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66376

llvm-svn: 369548
2019-08-21 17:00:57 +00:00

128 lines
5.5 KiB
LLVM

;RUN: opt %s -passes='adce,loop(rotate),adce' -S -debug-pass-manager -debug-only=loop-rotate 2>&1 | FileCheck %s
;RUN: opt %s -passes='adce,loop-mssa(rotate),adce' -S -debug-pass-manager -debug-only=loop-rotate -verify-memoryssa 2>&1 | FileCheck %s --check-prefix=MSSA
;REQUIRES: asserts
; This test is to make sure we invalidate the post dominator pass after loop rotate simplifies the loop latch.
; The adce passes are here to make sure post dominator analysis is required.
; CHECK: Starting llvm::Function pass manager run.
; CHECK-NEXT: Running pass: ADCEPass on f
; CHECK-NEXT: Running analysis: PostDominatorTreeAnalysis on f
; CHECK-NEXT: Running pass: FunctionToLoopPassAdaptor{{.*}} on f
; CHECK-NEXT: Starting llvm::Function pass manager run.
; CHECK-NEXT: Running pass: LoopSimplifyPass on f
; CHECK-NEXT: Running analysis: LoopAnalysis on f
; CHECK-NEXT: Running analysis: DominatorTreeAnalysis on f
; CHECK-NEXT: Running analysis: AssumptionAnalysis on f
; CHECK-NEXT: Running pass: LCSSAPass on f
; CHECK-NEXT: Finished llvm::Function pass manager run.
; CHECK-NEXT: Running analysis: AAManager on f
; CHECK-NEXT: Running analysis: TargetLibraryAnalysis on f
; CHECK-NEXT: Running analysis: ScalarEvolutionAnalysis on f
; CHECK-NEXT: Running analysis: TargetIRAnalysis on f
; CHECK-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
; CHECK-NEXT: Starting Loop pass manager run.
; CHECK-NEXT: Running analysis: PassInstrumentationAnalysis on bb
; CHECK-NEXT: Running pass: LoopRotatePass on Loop at depth 1 containing: %bb<header><exiting>,%bb4<latch>
; CHECK-NEXT: Folding loop latch bb4 into bb
; CHECK-NEXT: Invalidating all non-preserved analyses for: bb
; CHECK-NEXT: Finished Loop pass manager run.
; CHECK-NEXT: Invalidating all non-preserved analyses for: f
; CHECK-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
; CHECK-NEXT: Running pass: ADCEPass on f
; CHECK-NEXT: Running analysis: PostDominatorTreeAnalysis on f
; CHECK-NEXT: Finished llvm::Function pass manager run.
; MSSA: Starting llvm::Function pass manager run.
; MSSA-NEXT: Running pass: ADCEPass on f
; MSSA-NEXT: Running analysis: PostDominatorTreeAnalysis on f
; MSSA-NEXT: Running pass: FunctionToLoopPassAdaptor{{.*}} on f
; MSSA-NEXT: Starting llvm::Function pass manager run.
; MSSA-NEXT: Running pass: LoopSimplifyPass on f
; MSSA-NEXT: Running analysis: LoopAnalysis on f
; MSSA-NEXT: Running analysis: DominatorTreeAnalysis on f
; MSSA-NEXT: Running analysis: AssumptionAnalysis on f
; MSSA-NEXT: Running pass: LCSSAPass on f
; MSSA-NEXT: Finished llvm::Function pass manager run.
; MSSA-NEXT: Running analysis: MemorySSAAnalysis on f
; MSSA-NEXT: Running analysis: AAManager on f
; MSSA-NEXT: Running analysis: TargetLibraryAnalysis on f
; MSSA-NEXT: Running analysis: ScalarEvolutionAnalysis on f
; MSSA-NEXT: Running analysis: TargetIRAnalysis on f
; MSSA-NEXT: Running analysis: InnerAnalysisManagerProxy{{.*}} on f
; MSSA-NEXT: Starting Loop pass manager run.
; MSSA-NEXT: Running analysis: PassInstrumentationAnalysis on bb
; MSSA-NEXT: Running pass: LoopRotatePass on Loop at depth 1 containing: %bb<header><exiting>,%bb4<latch>
; MSSA-NEXT: Folding loop latch bb4 into bb
; MSSA-NEXT: Invalidating all non-preserved analyses for: bb
; MSSA-NEXT: Finished Loop pass manager run.
; MSSA-NEXT: Invalidating all non-preserved analyses for: f
; MSSA-NEXT: Invalidating analysis: PostDominatorTreeAnalysis on f
; MSSA-NEXT: Running pass: ADCEPass on f
; MSSA-NEXT: Running analysis: PostDominatorTreeAnalysis on f
; MSSA-NEXT: Finished llvm::Function pass manager run.
; CHECK-LABEL: define i8 @f() {
; CHECK-NEXT : entry:
; CHECK-NEXT : br label %bb
; CHECK-NEXT :
; CHECK-NEXT : bb: ; preds = %bb, %entry
; CHECK-NEXT : %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb ]
; CHECK-NEXT : %tmp5 = icmp eq i8 %mode.0, 1
; CHECK-NEXT : %indvar.next = add i8 %mode.0, 1
; CHECK-NEXT : br i1 %tmp5, label %bb5, label %bb
; CHECK-NEXT :
; CHECK-NEXT : bb5: ; preds = %bb
; CHECK-NEXT : tail call void @raise_exception() #0
; CHECK-NEXT : unreachable
; CHECK-NEXT : }
; CHECK-NEXT :
; CHECK-NEXT : ; Function Attrs: noreturn
; CHECK-NEXT : declare void @raise_exception() #0
; CHECK-NEXT :
; CHECK-NEXT : attributes #0 = { noreturn }
; MSSA-LABEL: define i8 @f() {
; MSSA-NEXT : entry:
; MSSA-NEXT : br label %bb
; MSSA-NEXT :
; MSSA-NEXT : bb: ; preds = %bb, %entry
; MSSA-NEXT : %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb ]
; MSSA-NEXT : %tmp5 = icmp eq i8 %mode.0, 1
; MSSA-NEXT : %indvar.next = add i8 %mode.0, 1
; MSSA-NEXT : br i1 %tmp5, label %bb5, label %bb
; MSSA-NEXT :
; MSSA-NEXT : bb5: ; preds = %bb
; MSSA-NEXT : tail call void @raise_exception() #0
; MSSA-NEXT : unreachable
; MSSA-NEXT : }
; MSSA-NEXT :
; MSSA-NEXT : ; Function Attrs: noreturn
; MSSA-NEXT : declare void @raise_exception() #0
; MSSA-NEXT :
; MSSA-NEXT : attributes #0 = { noreturn }
define i8 @f() {
entry:
br label %bb
bb: ; preds = %bb4, %entry
%mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ]
%tmp5 = icmp eq i8 %mode.0, 1
br i1 %tmp5, label %bb5, label %bb4
bb4: ; preds = %bb2
%indvar.next = add i8 %mode.0, 1
br label %bb
bb5: ; preds = %bb2
tail call void @raise_exception() #0
unreachable
}
; Function Attrs: noreturn
declare void @raise_exception() #0
attributes #0 = { noreturn }