2017-01-24 08:57:39 +08:00
|
|
|
; Basic test for the new LTO pipeline.
|
|
|
|
; For now the only difference is between -O1 and everything else, so
|
|
|
|
; -O2, -O3, -Os, -Oz are the same.
|
|
|
|
|
|
|
|
; RUN: opt -disable-verify -debug-pass-manager \
|
|
|
|
; RUN: -passes='lto<O1>' -S %s 2>&1 \
|
2017-07-28 00:54:15 +08:00
|
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O1
|
2017-01-24 08:57:39 +08:00
|
|
|
; RUN: opt -disable-verify -debug-pass-manager \
|
|
|
|
; RUN: -passes='lto<O2>' -S %s 2>&1 \
|
|
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2
|
|
|
|
; RUN: opt -disable-verify -debug-pass-manager \
|
|
|
|
; RUN: -passes='lto<O3>' -S %s 2>&1 \
|
2018-01-25 20:06:32 +08:00
|
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2 \
|
|
|
|
; RUN: --check-prefix=CHECK-O3
|
2017-01-24 08:57:39 +08:00
|
|
|
; RUN: opt -disable-verify -debug-pass-manager \
|
|
|
|
; RUN: -passes='lto<Os>' -S %s 2>&1 \
|
|
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2
|
|
|
|
; RUN: opt -disable-verify -debug-pass-manager \
|
|
|
|
; RUN: -passes='lto<Oz>' -S %s 2>&1 \
|
|
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2
|
[PM] Enable registration of out-of-tree passes with PassBuilder
Summary:
This patch adds a callback registration API to the PassBuilder,
enabling registering out-of-tree passes with it.
Through the Callback API, callers may register callbacks with the
various stages at which passes are added into pass managers, including
parsing of a pass pipeline as well as at extension points within the
default -O pipelines.
Registering utilities like `require<>` and `invalidate<>` needs to be
handled manually by the caller, but a helper is provided.
Additionally, adding passes at pipeline extension points is exposed
through the opt tool. This patch adds a `-passes-ep-X` commandline
option for every extension point X, which opt parses into pipelines
inserted into that extension point.
Reviewers: chandlerc
Reviewed By: chandlerc
Subscribers: lksbhm, grosser, davide, mehdi_amini, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D33464
llvm-svn: 307532
2017-07-10 18:57:55 +08:00
|
|
|
; RUN: opt -disable-verify -debug-pass-manager \
|
|
|
|
; RUN: -passes='lto<O3>' -S %s -passes-ep-peephole='no-op-function' 2>&1 \
|
|
|
|
; RUN: | FileCheck %s --check-prefix=CHECK-O --check-prefix=CHECK-O2 \
|
2018-01-25 20:06:32 +08:00
|
|
|
; RUN: --check-prefix=CHECK-O3 --check-prefix=CHECK-EP-Peephole
|
2017-01-24 08:57:39 +08:00
|
|
|
|
2020-07-29 08:08:24 +08:00
|
|
|
; CHECK-O: Starting llvm::Module pass manager run.
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O-NEXT: Starting llvm::Module pass manager run.
|
|
|
|
; CHECK-O-NEXT: Running pass: GlobalDCEPass
|
|
|
|
; CHECK-O-NEXT: Running pass: ForceFunctionAttrsPass
|
|
|
|
; CHECK-O-NEXT: Running pass: InferFunctionAttrsPass
|
Change TargetLibraryInfo analysis passes to always require Function
Summary:
This is the first change to enable the TLI to be built per-function so
that -fno-builtin* handling can be migrated to use function attributes.
See discussion on D61634 for background. This is an enabler for fixing
handling of these options for LTO, for example.
This change should not affect behavior, as the provided function is not
yet used to build a specifically per-function TLI, but rather enables
that migration.
Most of the changes were very mechanical, e.g. passing a Function to the
legacy analysis pass's getTLI interface, or in Module level cases,
adding a callback. This is similar to the way the per-function TTI
analysis works.
There was one place where we were looking for builtins but not in the
context of a specific function. See FindCXAAtExit in
lib/Transforms/IPO/GlobalOpt.cpp. I'm somewhat concerned my workaround
could provide the wrong behavior in some corner cases. Suggestions
welcome.
Reviewers: chandlerc, hfinkel
Subscribers: arsenm, dschuff, jvesely, nhaehnle, mehdi_amini, javed.absar, sbc100, jgravelle-google, eraman, aheejin, steven_wu, george.burgess.iv, dexonsmith, jfb, asbirlea, gchatelet, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66428
llvm-svn: 371284
2019-09-07 11:09:36 +08:00
|
|
|
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}Module
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O-NEXT: Running analysis: TargetLibraryAnalysis
|
Recommit r317351 : Add CallSiteSplitting pass
This recommit r317351 after fixing a buildbot failure.
Original commit message:
Summary:
This change add a pass which tries to split a call-site to pass
more constrained arguments if its argument is predicated in the control flow
so that we can expose better context to the later passes (e.g, inliner, jump
threading, or IPA-CP based function cloning, etc.).
As of now we support two cases :
1) If a call site is dominated by an OR condition and if any of its arguments
are predicated on this OR condition, try to split the condition with more
constrained arguments. For example, in the code below, we try to split the
call site since we can predicate the argument (ptr) based on the OR condition.
Split from :
if (!ptr || c)
callee(ptr);
to :
if (!ptr)
callee(null ptr) // set the known constant value
else if (c)
callee(nonnull ptr) // set non-null attribute in the argument
2) We can also split a call-site based on constant incoming values of a PHI
For example,
from :
BB0:
%c = icmp eq i32 %i1, %i2
br i1 %c, label %BB2, label %BB1
BB1:
br label %BB2
BB2:
%p = phi i32 [ 0, %BB0 ], [ 1, %BB1 ]
call void @bar(i32 %p)
to
BB0:
%c = icmp eq i32 %i1, %i2
br i1 %c, label %BB2-split0, label %BB1
BB1:
br label %BB2-split1
BB2-split0:
call void @bar(i32 0)
br label %BB2
BB2-split1:
call void @bar(i32 1)
br label %BB2
BB2:
%p = phi i32 [ 0, %BB2-split0 ], [ 1, %BB2-split1 ]
llvm-svn: 317362
2017-11-04 04:41:16 +08:00
|
|
|
; CHECK-O2-NEXT: Starting llvm::Function pass manager run.
|
|
|
|
; CHECK-O2-NEXT: Running pass: CallSiteSplittingPass on foo
|
|
|
|
; CHECK-O2-NEXT: Running analysis: TargetLibraryAnalysis on foo
|
2018-02-14 21:59:12 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: TargetIRAnalysis on foo
|
2018-11-14 18:04:30 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: DominatorTreeAnalysis on foo
|
Recommit r317351 : Add CallSiteSplitting pass
This recommit r317351 after fixing a buildbot failure.
Original commit message:
Summary:
This change add a pass which tries to split a call-site to pass
more constrained arguments if its argument is predicated in the control flow
so that we can expose better context to the later passes (e.g, inliner, jump
threading, or IPA-CP based function cloning, etc.).
As of now we support two cases :
1) If a call site is dominated by an OR condition and if any of its arguments
are predicated on this OR condition, try to split the condition with more
constrained arguments. For example, in the code below, we try to split the
call site since we can predicate the argument (ptr) based on the OR condition.
Split from :
if (!ptr || c)
callee(ptr);
to :
if (!ptr)
callee(null ptr) // set the known constant value
else if (c)
callee(nonnull ptr) // set non-null attribute in the argument
2) We can also split a call-site based on constant incoming values of a PHI
For example,
from :
BB0:
%c = icmp eq i32 %i1, %i2
br i1 %c, label %BB2, label %BB1
BB1:
br label %BB2
BB2:
%p = phi i32 [ 0, %BB0 ], [ 1, %BB1 ]
call void @bar(i32 %p)
to
BB0:
%c = icmp eq i32 %i1, %i2
br i1 %c, label %BB2-split0, label %BB1
BB1:
br label %BB2-split1
BB2-split0:
call void @bar(i32 0)
br label %BB2
BB2-split1:
call void @bar(i32 1)
br label %BB2
BB2:
%p = phi i32 [ 0, %BB2-split0 ], [ 1, %BB2-split1 ]
llvm-svn: 317362
2017-11-04 04:41:16 +08:00
|
|
|
; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: PGOIndirectCallPromotion
|
2017-08-09 04:57:33 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: ProfileSummaryAnalysis
|
2017-07-28 00:54:15 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: OptimizationRemarkEmitterAnalysis
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: IPSCCPPass
|
2018-11-14 18:04:30 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: AssumptionAnalysis on foo
|
2017-10-25 21:40:08 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: CalledValuePropagationPass
|
2017-07-28 01:45:02 +08:00
|
|
|
; CHECK-O-NEXT: Running analysis: InnerAnalysisManagerProxy<{{.*}}SCC
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O-NEXT: Running analysis: LazyCallGraphAnalysis
|
Change TargetLibraryInfo analysis passes to always require Function
Summary:
This is the first change to enable the TLI to be built per-function so
that -fno-builtin* handling can be migrated to use function attributes.
See discussion on D61634 for background. This is an enabler for fixing
handling of these options for LTO, for example.
This change should not affect behavior, as the provided function is not
yet used to build a specifically per-function TLI, but rather enables
that migration.
Most of the changes were very mechanical, e.g. passing a Function to the
legacy analysis pass's getTLI interface, or in Module level cases,
adding a callback. This is similar to the way the per-function TTI
analysis works.
There was one place where we were looking for builtins but not in the
context of a specific function. See FindCXAAtExit in
lib/Transforms/IPO/GlobalOpt.cpp. I'm somewhat concerned my workaround
could provide the wrong behavior in some corner cases. Suggestions
welcome.
Reviewers: chandlerc, hfinkel
Subscribers: arsenm, dschuff, jvesely, nhaehnle, mehdi_amini, javed.absar, sbc100, jgravelle-google, eraman, aheejin, steven_wu, george.burgess.iv, dexonsmith, jfb, asbirlea, gchatelet, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66428
llvm-svn: 371284
2019-09-07 11:09:36 +08:00
|
|
|
; CHECK-O1-NEXT: Running analysis: TargetLibraryAnalysis
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O-NEXT: Running analysis: FunctionAnalysisManagerCGSCCProxy
|
2017-01-24 09:45:53 +08:00
|
|
|
; CHECK-O-NEXT: Running analysis: OuterAnalysisManagerProxy<{{.*}}LazyCallGraph{{.*}}>
|
2020-07-29 08:08:24 +08:00
|
|
|
; CHECK-O-NEXT: Running pass: PostOrderFunctionAttrsPass
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O-NEXT: Running analysis: AAManager
|
|
|
|
; CHECK-O-NEXT: Running pass: ReversePostOrderFunctionAttrsPass
|
|
|
|
; CHECK-O-NEXT: Running analysis: CallGraphAnalysis
|
|
|
|
; CHECK-O-NEXT: Running pass: GlobalSplitPass
|
|
|
|
; CHECK-O-NEXT: Running pass: WholeProgramDevirtPass
|
2018-07-19 22:51:32 +08:00
|
|
|
; CHECK-O1-NEXT: Running pass: LowerTypeTestsPass
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: GlobalOptPass
|
2020-07-29 08:08:24 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: PromotePass
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: ConstantMergePass
|
|
|
|
; CHECK-O2-NEXT: Running pass: DeadArgumentEliminationPass
|
[PM] Enable registration of out-of-tree passes with PassBuilder
Summary:
This patch adds a callback registration API to the PassBuilder,
enabling registering out-of-tree passes with it.
Through the Callback API, callers may register callbacks with the
various stages at which passes are added into pass managers, including
parsing of a pass pipeline as well as at extension points within the
default -O pipelines.
Registering utilities like `require<>` and `invalidate<>` needs to be
handled manually by the caller, but a helper is provided.
Additionally, adding passes at pipeline extension points is exposed
through the opt tool. This patch adds a `-passes-ep-X` commandline
option for every extension point X, which opt parses into pipelines
inserted into that extension point.
Reviewers: chandlerc
Reviewed By: chandlerc
Subscribers: lksbhm, grosser, davide, mehdi_amini, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D33464
llvm-svn: 307532
2017-07-10 18:57:55 +08:00
|
|
|
; CHECK-O2-NEXT: Starting llvm::Function pass manager run.
|
2018-01-25 20:06:32 +08:00
|
|
|
; CHECK-O3-NEXT: Running pass: AggressiveInstCombinePass
|
[PM] Enable registration of out-of-tree passes with PassBuilder
Summary:
This patch adds a callback registration API to the PassBuilder,
enabling registering out-of-tree passes with it.
Through the Callback API, callers may register callbacks with the
various stages at which passes are added into pass managers, including
parsing of a pass pipeline as well as at extension points within the
default -O pipelines.
Registering utilities like `require<>` and `invalidate<>` needs to be
handled manually by the caller, but a helper is provided.
Additionally, adding passes at pipeline extension points is exposed
through the opt tool. This patch adds a `-passes-ep-X` commandline
option for every extension point X, which opt parses into pipelines
inserted into that extension point.
Reviewers: chandlerc
Reviewed By: chandlerc
Subscribers: lksbhm, grosser, davide, mehdi_amini, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D33464
llvm-svn: 307532
2017-07-10 18:57:55 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: InstCombinePass
|
2019-04-16 00:49:00 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: OuterAnalysisManagerProxy
|
[PM] Enable registration of out-of-tree passes with PassBuilder
Summary:
This patch adds a callback registration API to the PassBuilder,
enabling registering out-of-tree passes with it.
Through the Callback API, callers may register callbacks with the
various stages at which passes are added into pass managers, including
parsing of a pass pipeline as well as at extension points within the
default -O pipelines.
Registering utilities like `require<>` and `invalidate<>` needs to be
handled manually by the caller, but a helper is provided.
Additionally, adding passes at pipeline extension points is exposed
through the opt tool. This patch adds a `-passes-ep-X` commandline
option for every extension point X, which opt parses into pipelines
inserted into that extension point.
Reviewers: chandlerc
Reviewed By: chandlerc
Subscribers: lksbhm, grosser, davide, mehdi_amini, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D33464
llvm-svn: 307532
2017-07-10 18:57:55 +08:00
|
|
|
; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
|
|
|
|
; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
|
2020-04-29 04:25:15 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: ModuleInlinerWrapperPass
|
|
|
|
; CHECK-O2-NEXT: Running analysis: InlineAdvisorAnalysis
|
|
|
|
; CHECK-O2-NEXT: Starting llvm::Module pass manager run.
|
|
|
|
; CHECK-O2-NEXT: Starting CGSCC pass manager run.
|
|
|
|
; CHECK-O2-NEXT: Running pass: InlinerPass
|
|
|
|
; CHECK-O2-NEXT: Finished CGSCC pass manager run.
|
|
|
|
; CHECK-O2-NEXT: Finished llvm::Module pass manager run.
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: GlobalOptPass
|
|
|
|
; CHECK-O2-NEXT: Running pass: GlobalDCEPass
|
|
|
|
; CHECK-O2-NEXT: Starting llvm::Function pass manager run.
|
|
|
|
; CHECK-O2-NEXT: Running pass: InstCombinePass
|
[PM] Enable registration of out-of-tree passes with PassBuilder
Summary:
This patch adds a callback registration API to the PassBuilder,
enabling registering out-of-tree passes with it.
Through the Callback API, callers may register callbacks with the
various stages at which passes are added into pass managers, including
parsing of a pass pipeline as well as at extension points within the
default -O pipelines.
Registering utilities like `require<>` and `invalidate<>` needs to be
handled manually by the caller, but a helper is provided.
Additionally, adding passes at pipeline extension points is exposed
through the opt tool. This patch adds a `-passes-ep-X` commandline
option for every extension point X, which opt parses into pipelines
inserted into that extension point.
Reviewers: chandlerc
Reviewed By: chandlerc
Subscribers: lksbhm, grosser, davide, mehdi_amini, llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D33464
llvm-svn: 307532
2017-07-10 18:57:55 +08:00
|
|
|
; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: JumpThreadingPass
|
|
|
|
; CHECK-O2-NEXT: Running analysis: LazyValueAnalysis
|
|
|
|
; CHECK-O2-NEXT: Running pass: SROA on foo
|
2019-03-21 03:08:18 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: TailCallElimPass on foo
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Finished llvm::Function pass manager run.
|
2020-07-29 08:08:24 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: PostOrderFunctionAttrsPass
|
|
|
|
; CHECK-O2-NEXT: Running pass: GVN on foo
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: MemoryDependenceAnalysis
|
2018-07-31 22:19:29 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: PhiValuesAnalysis
|
2020-07-29 08:08:24 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: MemCpyOptPass on foo
|
|
|
|
; CHECK-O2-NEXT: Running pass: DSEPass on foo
|
|
|
|
; CHECK-O2-NEXT: Running pass: InstCombinePass on foo
|
|
|
|
; CHECK-O2-NEXT: Running pass: SimplifyCFGPass on foo
|
|
|
|
; CHECK-O2-NEXT: Running pass: SCCPPass on foo
|
|
|
|
; CHECK-O2-NEXT: Running pass: InstCombinePass on foo
|
|
|
|
; CHECK-O2-NEXT: Running pass: BDCEPass on foo
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running analysis: DemandedBitsAnalysis
|
2020-07-29 08:08:24 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: InstCombinePass
|
|
|
|
; CHECK-EP-Peephole-NEXT: Running pass: NoOpFunctionPass
|
|
|
|
; CHECK-O2-NEXT: Running pass: JumpThreadingPass
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: CrossDSOCFIPass
|
2018-07-19 22:51:32 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: LowerTypeTestsPass
|
Restore "[WPD/LowerTypeTests] Delay lowering/removal of type tests until after ICP"
This restores commit 80d0a137a5aba6998fadb764f1e11cb901aae233, and the
follow on fix in 873c0d0786dcf22f4af39f65df824917f70f2170, with a new
fix for test failures after a 2-stage clang bootstrap, and a more robust
fix for the Chromium build failure that an earlier version partially
fixed. See also discussion on D75201.
Reviewers: evgeny777
Subscribers: mehdi_amini, Prazek, hiraditya, steven_wu, dexonsmith, arphaman, davidxl, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D73242
2020-03-18 02:08:35 +08:00
|
|
|
; CHECK-O-NEXT: Running pass: LowerTypeTestsPass
|
2020-07-29 08:08:24 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: SimplifyCFGPass
|
2017-01-24 08:57:39 +08:00
|
|
|
; CHECK-O2-NEXT: Running pass: EliminateAvailableExternallyPass
|
|
|
|
; CHECK-O2-NEXT: Running pass: GlobalDCEPass
|
|
|
|
; CHECK-O-NEXT: Finished llvm::Module pass manager run.
|
|
|
|
; CHECK-O-NEXT: Running pass: PrintModulePass
|
|
|
|
|
|
|
|
; Make sure we get the IR back out without changes when we print the module.
|
|
|
|
; CHECK-O-LABEL: define void @foo(i32 %n) local_unnamed_addr {
|
|
|
|
; CHECK-O-NEXT: entry:
|
|
|
|
; CHECK-O-NEXT: br label %loop
|
|
|
|
; CHECK-O: loop:
|
|
|
|
; CHECK-O-NEXT: %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
|
|
|
|
; CHECK-O-NEXT: %iv.next = add i32 %iv, 1
|
|
|
|
; CHECK-O-NEXT: tail call void @bar()
|
|
|
|
; CHECK-O-NEXT: %cmp = icmp eq i32 %iv, %n
|
|
|
|
; CHECK-O-NEXT: br i1 %cmp, label %exit, label %loop
|
|
|
|
; CHECK-O: exit:
|
|
|
|
; CHECK-O-NEXT: ret void
|
|
|
|
; CHECK-O-NEXT: }
|
|
|
|
;
|
|
|
|
; CHECK-O-NEXT: Finished llvm::Module pass manager run.
|
|
|
|
|
|
|
|
declare void @bar() local_unnamed_addr
|
|
|
|
|
|
|
|
define void @foo(i32 %n) local_unnamed_addr {
|
|
|
|
entry:
|
|
|
|
br label %loop
|
|
|
|
loop:
|
|
|
|
%iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]
|
|
|
|
%iv.next = add i32 %iv, 1
|
|
|
|
tail call void @bar()
|
|
|
|
%cmp = icmp eq i32 %iv, %n
|
|
|
|
br i1 %cmp, label %exit, label %loop
|
|
|
|
exit:
|
|
|
|
ret void
|
|
|
|
}
|