aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-08-12 13:53:02 +0000
committerTeresa Johnson <tejohnson@google.com>2016-08-12 13:53:02 +0000
commitf93b246f8b22137abe69842ab4a99747d95a7f7a (patch)
tree95b3703eb5458c5152ed11937dbd23d24a1f9cd4 /llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
parent565bdd9fed999909827d75a4bea27ace05b4445d (diff)
downloadllvm-f93b246f8b22137abe69842ab4a99747d95a7f7a.zip
llvm-f93b246f8b22137abe69842ab4a99747d95a7f7a.tar.gz
llvm-f93b246f8b22137abe69842ab4a99747d95a7f7a.tar.bz2
[PM] Port ModuleSummaryIndex analysis to new pass manager
Summary: Port the ModuleSummaryAnalysisWrapperPass to the new pass manager. Use it in the ported BitcodeWriterPass (similar to how we use the legacy ModuleSummaryAnalysisWrapperPass in the legacy WriteBitcodePass). Also, pass the -module-summary opt flag through to the new pass manager pipeline and through to the bitcode writer pass, and add a test that uses it. Reviewers: mehdi_amini Subscribers: llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23439 llvm-svn: 278508
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp')
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
index 3e89ade..e8e0b10 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
@@ -19,12 +19,11 @@
#include "llvm/Pass.h"
using namespace llvm;
-PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &) {
- std::unique_ptr<ModuleSummaryIndex> Index;
- if (EmitSummaryIndex)
- Index = ModuleSummaryIndexBuilder(&M).takeIndex();
- WriteBitcodeToFile(&M, OS, ShouldPreserveUseListOrder, Index.get(),
- EmitModuleHash);
+PreservedAnalyses BitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) {
+ const ModuleSummaryIndex *Index =
+ EmitSummaryIndex ? &(AM.getResult<ModuleSummaryIndexAnalysis>(M))
+ : nullptr;
+ WriteBitcodeToFile(&M, OS, ShouldPreserveUseListOrder, Index, EmitModuleHash);
return PreservedAnalyses::all();
}