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/Transforms/Scalar | |
| 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/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | 52 | 
1 files changed, 28 insertions, 24 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; | 

