diff options
| author | Dehao Chen <dehao@google.com> | 2016-05-05 20:47:53 +0000 |
|---|---|---|
| committer | Dehao Chen <dehao@google.com> | 2016-05-05 20:47:53 +0000 |
| commit | f50c67ce7c99eb19a7392d1db2c51acf22396f53 (patch) | |
| tree | e0ab32052c9b1c71e732ebf8cd9e9c5464736def /llvm/lib | |
| parent | 5eba657ff3d696b971d8f36a48a8d0801ab36c31 (diff) | |
| download | bcm5719-llvm-f50c67ce7c99eb19a7392d1db2c51acf22396f53.tar.gz bcm5719-llvm-f50c67ce7c99eb19a7392d1db2c51acf22396f53.zip | |
Revert http://reviews.llvm.org/D19926 as it breaks tests.
llvm-svn: 268681
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | 52 | ||||
| -rw-r--r-- | llvm/lib/Transforms/Utils/AddDiscriminators.cpp | 6 |
2 files changed, 28 insertions, 30 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp index 97c5f183dcb..e6933336947 100644 --- a/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp +++ b/llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp @@ -196,31 +196,35 @@ PreservedAnalyses SimplifyCFGPass::run(Function &F, return PreservedAnalyses::all(); } -CFGSimplifyPass::CFGSimplifyPass(int T, - std::function<bool(const Function &)> Ftor) - : FunctionPass(ID), PredicateFtor(Ftor) { - BonusInstThreshold = (T == -1) ? UserBonusInstThreshold : unsigned(T); - initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry()); -} - -bool CFGSimplifyPass::runOnFunction(Function &F) { - if (PredicateFtor && !PredicateFtor(F)) - return false; - - if (skipFunction(F)) - return false; - - AssumptionCache *AC = - &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); - const TargetTransformInfo &TTI = - getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); - return simplifyFunctionCFG(F, TTI, AC, BonusInstThreshold); -} +namespace { +struct CFGSimplifyPass : public FunctionPass { + static char ID; // Pass identification, replacement for typeid + unsigned BonusInstThreshold; + std::function<bool(const Function &)> PredicateFtor; + + CFGSimplifyPass(int T = -1, + std::function<bool(const Function &)> Ftor = nullptr) + : FunctionPass(ID), PredicateFtor(Ftor) { + BonusInstThreshold = (T == -1) ? UserBonusInstThreshold : unsigned(T); + initializeCFGSimplifyPassPass(*PassRegistry::getPassRegistry()); + } + bool runOnFunction(Function &F) override { + if (skipFunction(F) || (PredicateFtor && !PredicateFtor(F))) + return false; + + AssumptionCache *AC = + &getAnalysis<AssumptionCacheTracker>().getAssumptionCache(F); + const TargetTransformInfo &TTI = + getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F); + return simplifyFunctionCFG(F, TTI, AC, BonusInstThreshold); + } -void CFGSimplifyPass::getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired<AssumptionCacheTracker>(); - AU.addRequired<TargetTransformInfoWrapperPass>(); - AU.addPreserved<GlobalsAAWrapperPass>(); + void getAnalysisUsage(AnalysisUsage &AU) const override { + AU.addRequired<AssumptionCacheTracker>(); + AU.addRequired<TargetTransformInfoWrapperPass>(); + AU.addPreserved<GlobalsAAWrapperPass>(); + } +}; } char CFGSimplifyPass::ID = 0; diff --git a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp index 6c4db99efe3..2a6b6eb1b0b 100644 --- a/llvm/lib/Transforms/Utils/AddDiscriminators.cpp +++ b/llvm/lib/Transforms/Utils/AddDiscriminators.cpp @@ -67,7 +67,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Scalar.h" -#include "llvm/Transforms/Scalar/SimplifyCFG.h" using namespace llvm; @@ -80,10 +79,6 @@ struct AddDiscriminators : public FunctionPass { initializeAddDiscriminatorsPass(*PassRegistry::getPassRegistry()); } - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired<CFGSimplifyPass>(); - } - bool runOnFunction(Function &F) override; }; } // end anonymous namespace @@ -91,7 +86,6 @@ struct AddDiscriminators : public FunctionPass { char AddDiscriminators::ID = 0; INITIALIZE_PASS_BEGIN(AddDiscriminators, "add-discriminators", "Add DWARF path discriminators", false, false) -INITIALIZE_PASS_DEPENDENCY(CFGSimplifyPass) INITIALIZE_PASS_END(AddDiscriminators, "add-discriminators", "Add DWARF path discriminators", false, false) |

