From 820372c0edfacecae45a30d19929d73fb29f8cd3 Mon Sep 17 00:00:00 2001 From: Dehao Chen Date: Fri, 2 Sep 2016 01:47:13 +0000 Subject: 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 --- llvm/lib/Transforms/Utils/SimplifyInstructions.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'llvm/lib/Transforms/Utils') diff --git a/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp b/llvm/lib/Transforms/Utils/SimplifyInstructions.cpp index 0be0b65e20a..3099c498a7c 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(); AU.addRequired(); AU.addRequired(); } @@ -100,8 +99,9 @@ namespace { if (skipFunction(F)) return false; - const DominatorTree *DT = - &getAnalysis().getDomTree(); + const DominatorTreeWrapperPass *DTWP = + getAnalysisIfAvailable(); + const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : nullptr; const TargetLibraryInfo *TLI = &getAnalysis().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(F); + auto *DT = AM.getCachedResult(F); auto &TLI = AM.getResult(F); auto &AC = AM.getResult(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'. -- cgit v1.2.3