1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00
llvm-mirror/test/Other/time-passes.ll
Fedor Sergeev 6a98598547 [New PM][PassTiming] implement -time-passes for the new pass manager
Enable time-passes functionality through PassInstrumentation callbacks
for passes and analyses.

TimePassesHandler class keeps all the callbacks, the timing data as it
is being collected as well as the stack of currently active timers.

Parts of the fix that might be somewhat unobvious:
  - mapping of passes into Timer (TimingData) can not be done per-instance.
    PassID name provided into the callback is common for all the pass invocations.
    Thus the only way to get a timing with reasonable granularity is to collect
    timing data per pass invocation, getting a new timer for each BeforePass.
    Hence the key for TimingData uses a pair of <StringRef/unsigned count> to
    uniquely identify a pass invocation.

  - consequently, this new-pass-manager implementation performs no aggregation
    of timing data, reporting timings for each pass invocation separately.
    In that it differs from legacy-pass-manager time-passes implementation that
    reports timing data aggregated per pass instance.

  - pass managers and adaptors are not tracked, similar to how pass managers are
    not tracked in legacy time-passes.

  - TimerStack tracks timers that are active, each BeforePass pushes the new timer
    on stack, each AfterPass pops active timer from stack and stops it.

Reviewers: chandlerc, philip.pfaffe
Differential Revision: https://reviews.llvm.org/D51276

llvm-svn: 343898
2018-10-05 22:32:01 +00:00

60 lines
2.4 KiB
LLVM

; RUN: opt < %s -disable-output -instcombine -instcombine -licm -time-passes 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-LEGACY
; RUN: opt < %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='instcombine,instcombine,loop(licm)' -time-passes 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 2>&1 | FileCheck %s --check-prefix=TIME --check-prefix=TIME-NEW -check-prefix=TIME-DOUBLE-LICM-NEW
; RUN: opt < %s -disable-output -passes='default<O2>' -time-passes 2>&1 | 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: 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
}