1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Other/time-passes.ll
Yuanfang Chen c9bcfeec6a [Time-report] Add a flag -ftime-report={per-pass,per-pass-run} to control the pass timing aggregation
Currently, -ftime-report + new pass manager emits one line of report for each
pass run. This potentially causes huge output text especially with regular LTO
or large single file (Obeserved in private tests and was reported in D51276).
The behaviour of -ftime-report + legacy pass manager is
emitting one line of report for each pass object which has relatively reasonable
text output size. This patch adds a flag `-ftime-report=` to control time report
aggregation for new pass manager.

The flag is for new pass manager only. Using it with legacy pass manager gives
an error. It is a driver and cc1 flag. `per-pass` is the new default so
`-ftime-report` is aliased to `-ftime-report=per-pass`. Before this patch,
functionality-wise `-ftime-report` is aliased to `-ftime-report=per-pass-run`.

* Adds an boolean variable TimePassesHandler::PerRun to control per-pass vs per-pass-run.
* Adds a new clang CodeGen flag CodeGenOptions::TimePassesPerRun to work with the existing CodeGenOptions::TimePasses.
* Remove FrontendOptions::ShowTimers, its uses are replaced by the existing CodeGenOptions::TimePasses.
* Remove FrontendTimesIsEnabled (It was introduced in D45619 which was largely reverted.)

Differential Revision: https://reviews.llvm.org/D92436
2020-12-08 10:13:19 -08:00

94 lines
4.3 KiB
LLVM

; RUN: opt -enable-new-pm=0 < %s -disable-output -instcombine -instcombine -licm -time-passes 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-LEGACY
; RUN: opt -enable-new-pm=0 < %s -disable-output -instcombine -instcombine -licm -licm -time-passes 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-LEGACY --check-prefix=TIME-DOUBLE-LICM-LEGACY
; RUN: opt < %s -disable-output -passes='default<O2>' -time-passes 2>&1 | FileCheck %s --check-prefix=TIME
;
; For new pass manager, check that -time-passes-per-run emit one report for each pass run.
; RUN: opt < %s -disable-output -passes='instcombine,instcombine,loop(licm)' -time-passes-per-run 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-NEW
; RUN: opt < %s -disable-output -passes='instcombine,loop(licm),instcombine,loop(licm)' -time-passes-per-run 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-NEW -check-prefix=TIME-DOUBLE-LICM-NEW
;
; For new pass manager, check that -time-passes emit one report for each pass.
; RUN: opt < %s -disable-output -passes='instcombine,instcombine,loop(licm)' -time-passes 2>&1 | FileCheck %s --check-prefixes=TIME,TIME-NEW-PER-PASS
; RUN: opt < %s -disable-output -passes='instcombine,loop(licm),instcombine,loop(licm)' -time-passes 2>&1 | FileCheck %s --check-prefixes=TIME,TIME-NEW-PER-PASS
;
; The following 4 test runs verify -info-output-file interaction (default goes to stderr, '-' goes to stdout).
; RUN: opt -enable-new-pm=0 < %s -disable-output -O2 -time-passes -info-output-file='-' 2>/dev/null | FileCheck %s --check-prefix=TIME
; RUN: opt < %s -disable-output -passes='default<O2>' -time-passes -info-output-file='-' 2>/dev/null | FileCheck %s --check-prefix=TIME
;
; RUN: rm -f %t; opt < %s -disable-output -O2 -time-passes -info-output-file=%t
; RUN: cat %t | FileCheck %s --check-prefix=TIME
;
; RUN: rm -f %t; opt < %s -disable-output -passes='default<O2>' -time-passes -info-output-file=%t
; RUN: cat %t | FileCheck %s --check-prefix=TIME
;
; TIME: Pass execution timing report
; TIME: Total Execution Time:
; TIME: Name
; TIME-LEGACY-DAG: Combine redundant instructions{{$}}
; TIME-LEGACY-DAG: Combine redundant instructions #2
; TIME-LEGACY-DAG: Loop Invariant Code Motion{{$}}
; TIME-DOUBLE-LICM-LEGACY-DAG: Loop Invariant Code Motion #2
; TIME-LEGACY-DAG: Scalar Evolution Analysis
; TIME-LEGACY-DAG: Loop-Closed SSA Form Pass
; TIME-LEGACY-DAG: LCSSA Verifier
; TIME-LEGACY-DAG: Canonicalize natural loops
; TIME-LEGACY-DAG: Natural Loop Information
; TIME-LEGACY-DAG: Dominator Tree Construction
; TIME-LEGACY-DAG: Module Verifier
; TIME-LEGACY-DAG: Target Library Information
; TIME-NEW-DAG: InstCombinePass #1
; TIME-NEW-DAG: InstCombinePass #2
; TIME-NEW-DAG: InstCombinePass #3
; TIME-NEW-DAG: InstCombinePass #4
; TIME-NEW-DAG: LICMPass #1
; TIME-NEW-DAG: LICMPass #2
; TIME-NEW-DAG: LICMPass #3
; TIME-DOUBLE-LICM-NEW-DAG: LICMPass #4
; TIME-DOUBLE-LICM-NEW-DAG: LICMPass #5
; TIME-DOUBLE-LICM-NEW-DAG: LICMPass #6
; TIME-NEW-DAG: LCSSAPass
; TIME-NEW-DAG: LoopSimplifyPass
; TIME-NEW-DAG: ScalarEvolutionAnalysis
; TIME-NEW-DAG: LoopAnalysis
; TIME-NEW-DAG: VerifierPass
; TIME-NEW-DAG: DominatorTreeAnalysis
; TIME-NEW-DAG: TargetLibraryAnalysis
; TIME-NEW-PER-PASS-DAG: InstCombinePass
; TIME-NEW-PER-PASS-DAG: LICMPass
; TIME-NEW-PER-PASS-DAG: LCSSAPass
; TIME-NEW-PER-PASS-DAG: LoopSimplifyPass
; TIME-NEW-PER-PASS-DAG: ScalarEvolutionAnalysis
; TIME-NEW-PER-PASS-DAG: LoopAnalysis
; TIME-NEW-PER-PASS-DAG: VerifierPass
; TIME-NEW-PER-PASS-DAG: DominatorTreeAnalysis
; TIME-NEW-PER-PASS-DAG: TargetLibraryAnalysis
; TIME-NEW-PER-PASS-NOT: InstCombinePass #
; TIME-NEW-PER-PASS-NOT: LICMPass #
; TIME-NEW-PER-PASS-NOT: LCSSAPass #
; TIME-NEW-PER-PASS-NOT: LoopSimplifyPass #
; TIME-NEW-PER-PASS-NOT: ScalarEvolutionAnalysis #
; TIME-NEW-PER-PASS-NOT: LoopAnalysis #
; TIME-NEW-PER-PASS-NOT: VerifierPass #
; TIME-NEW-PER-PASS-NOT: DominatorTreeAnalysis #
; TIME-NEW-PER-PASS-NOT: TargetLibraryAnalysis #
; TIME: Total{{$}}
define i32 @foo() {
%res = add i32 5, 4
br label %loop1
loop1:
br i1 false, label %loop1, label %end
end:
ret i32 %res
}
define void @bar_with_loops() {
br label %loop1
loop1:
br i1 false, label %loop1, label %loop2
loop2:
br i1 true, label %loop2, label %end
end:
ret void
}