diff options
author | Dehao Chen <dehao@google.com> | 2016-09-02 01:47:13 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2016-09-02 01:47:13 +0000 |
commit | 820372c0edfacecae45a30d19929d73fb29f8cd3 (patch) | |
tree | 5ab50a629c4a0195df90a66af2ccce098f23bc54 /llvm/lib/Transforms/Utils/SimplifyInstructions.cpp | |
parent | 9aec5c3797056b6fba619c81aea07e9e46d67178 (diff) | |
download | llvm-820372c0edfacecae45a30d19929d73fb29f8cd3.zip llvm-820372c0edfacecae45a30d19929d73fb29f8cd3.tar.gz llvm-820372c0edfacecae45a30d19929d73fb29f8cd3.tar.bz2 |
revert r280432:
r280432 | dehao | 2016-09-01 16:51:37 -0700 (Thu, 01 Sep 2016) | 9 lines
Explicitly require DominatorTreeAnalysis pass for instsimplify pass.
Summary: DominatorTreeAnalysis is always required by instsimplify.
llvm-svn: 280452
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyInstructions.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyInstructions.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp b/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp index 0be0b65..3099c49 100644 --- a/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp @@ -90,7 +90,6 @@ namespace { void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesCFG(); - AU.addRequired<DominatorTreeWrapperPass>(); AU.addRequired<AssumptionCacheTracker>(); AU.addRequired<TargetLibraryInfoWrapperPass>(); } @@ -100,8 +99,9 @@ namespace { if (skipFunction(F)) return false; - const DominatorTree *DT = - &getAnalysis<DominatorTreeWrapperPass>().getDomTree(); + const DominatorTreeWrapperPass *DTWP = + getAnalysisIfAvailable<DominatorTreeWrapperPass>(); + const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : nullptr; const TargetLibraryInfo *TLI = &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(); AssumptionCache *AC = @@ -115,7 +115,6 @@ char InstSimplifier::ID = 0; INITIALIZE_PASS_BEGIN(InstSimplifier, "instsimplify", "Remove redundant instructions", false, false) INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker) -INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass) INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) INITIALIZE_PASS_END(InstSimplifier, "instsimplify", "Remove redundant instructions", false, false) @@ -128,10 +127,10 @@ FunctionPass *llvm::createInstructionSimplifierPass() { PreservedAnalyses InstSimplifierPass::run(Function &F, FunctionAnalysisManager &AM) { - auto &DT = AM.getResult<DominatorTreeAnalysis>(F); + auto *DT = AM.getCachedResult<DominatorTreeAnalysis>(F); auto &TLI = AM.getResult<TargetLibraryAnalysis>(F); auto &AC = AM.getResult<AssumptionAnalysis>(F); - bool Changed = runImpl(F, &DT, &TLI, &AC); + bool Changed = runImpl(F, DT, &TLI, &AC); if (!Changed) return PreservedAnalyses::all(); // FIXME: This should also 'preserve the CFG'. |