diff options
author | Teresa Johnson <tejohnson@google.com> | 2019-01-04 19:05:01 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2019-01-04 19:05:01 +0000 |
commit | 6ed7913c988b484a4b5c6b1231d0b39ff077c766 (patch) | |
tree | 7dd2574a9d8577519833c70d390abc0a88718ef6 /clang/lib/CodeGen/BackendUtil.cpp | |
parent | 853b962416bcb5c85df455eb4d89c896f9147ee8 (diff) | |
download | bcm5719-llvm-6ed7913c988b484a4b5c6b1231d0b39ff077c766.tar.gz bcm5719-llvm-6ed7913c988b484a4b5c6b1231d0b39ff077c766.zip |
[ThinLTO] Clang changes to utilize new pass to handle chains of aliases
Summary:
As with NameAnonGlobals, invoke the new CanonicalizeAliases via clang
when using the new PM.
Depends on D54507.
Reviewers: pcc, davidxl
Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, cfe-commits
Differential Revision: https://reviews.llvm.org/D55620
llvm-svn: 350424
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 3280417a91a..1311af91686 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -60,6 +60,7 @@ #include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar/GVN.h" #include "llvm/Transforms/Utils.h" +#include "llvm/Transforms/Utils/CanonicalizeAliases.h" #include "llvm/Transforms/Utils/NameAnonGlobals.h" #include "llvm/Transforms/Utils/SymbolRewriter.h" #include <memory> @@ -996,9 +997,11 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( if (LangOpts.Sanitize.has(SanitizerKind::LocalBounds)) MPM.addPass(createModuleToFunctionPassAdaptor(BoundsCheckingPass())); - // Lastly, add a semantically necessary pass for LTO. - if (IsLTO || IsThinLTO) + // Lastly, add semantically necessary passes for LTO. + if (IsLTO || IsThinLTO) { + MPM.addPass(CanonicalizeAliasesPass()); MPM.addPass(NameAnonGlobalPass()); + } } else { // Map our optimization levels into one of the distinct levels used to // configure the pipeline. @@ -1019,10 +1022,12 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( if (IsThinLTO) { MPM = PB.buildThinLTOPreLinkDefaultPipeline( Level, CodeGenOpts.DebugPassManager); + MPM.addPass(CanonicalizeAliasesPass()); MPM.addPass(NameAnonGlobalPass()); } else if (IsLTO) { MPM = PB.buildLTOPreLinkDefaultPipeline(Level, CodeGenOpts.DebugPassManager); + MPM.addPass(CanonicalizeAliasesPass()); MPM.addPass(NameAnonGlobalPass()); } else { MPM = PB.buildPerModuleDefaultPipeline(Level, |