summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2016-03-01 22:53:02 +0000
committerDehao Chen <dehao@google.com>2016-03-01 22:53:02 +0000
commit1012be120a17ca7693624e9ec63e7399d6d5e330 (patch)
tree7737c58232dbb0e2b4cdf51503992c9489872d14 /llvm/lib/Transforms
parent2e6a9a290b0edb2bbf06b13004b8082bdf315344 (diff)
downloadbcm5719-llvm-1012be120a17ca7693624e9ec63e7399d6d5e330.tar.gz
bcm5719-llvm-1012be120a17ca7693624e9ec63e7399d6d5e330.zip
Perform InstructioinCombiningPass before SampleProfile pass.
Summary: SampleProfile pass needs to be performed after InstructionCombiningPass, which helps eliminate un-inlinable function calls. Reviewers: davidxl, dnovillo Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D17742 llvm-svn: 262419
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/SampleProfile.cpp5
-rw-r--r--llvm/lib/Transforms/InstCombine/InstructionCombining.cpp20
2 files changed, 4 insertions, 21 deletions
diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index b8636665a82..97530a577f7 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -48,6 +48,7 @@
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Utils/Cloning.h"
+#include "llvm/Transforms/InstCombine/InstCombine.h"
#include <cctype>
using namespace llvm;
@@ -121,7 +122,7 @@ public:
bool runOnModule(Module &M) override;
void getAnalysisUsage(AnalysisUsage &AU) const override {
- AU.setPreservesCFG();
+ AU.addRequired<InstructionCombiningPass>();
}
protected:
@@ -1215,6 +1216,7 @@ char SampleProfileLoader::ID = 0;
INITIALIZE_PASS_BEGIN(SampleProfileLoader, "sample-profile",
"Sample Profile loader", false, false)
INITIALIZE_PASS_DEPENDENCY(AddDiscriminators)
+INITIALIZE_PASS_DEPENDENCY(InstructionCombiningPass)
INITIALIZE_PASS_END(SampleProfileLoader, "sample-profile",
"Sample Profile loader", false, false)
@@ -1258,6 +1260,7 @@ bool SampleProfileLoader::runOnModule(Module &M) {
bool SampleProfileLoader::runOnFunction(Function &F) {
F.setEntryCount(0);
+ getAnalysis<InstructionCombiningPass>(F);
Samples = Reader->getSamplesFor(F);
if (!Samples->empty())
return emitAnnotations(F);
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 1b95e9334c1..f25f063e1be 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3078,26 +3078,6 @@ PreservedAnalyses InstCombinePass::run(Function &F,
return PA;
}
-namespace {
-/// \brief The legacy pass manager's instcombine pass.
-///
-/// This is a basic whole-function wrapper around the instcombine utility. It
-/// will try to combine all instructions in the function.
-class InstructionCombiningPass : public FunctionPass {
- InstCombineWorklist Worklist;
-
-public:
- static char ID; // Pass identification, replacement for typeid
-
- InstructionCombiningPass() : FunctionPass(ID) {
- initializeInstructionCombiningPassPass(*PassRegistry::getPassRegistry());
- }
-
- void getAnalysisUsage(AnalysisUsage &AU) const override;
- bool runOnFunction(Function &F) override;
-};
-}
-
void InstructionCombiningPass::getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesCFG();
AU.addRequired<AAResultsWrapperPass>();
OpenPOWER on IntegriCloud