Index: lib/Transforms/Utils/SimplifyInstructions.cpp =================================================================== --- lib/Transforms/Utils/SimplifyInstructions.cpp +++ lib/Transforms/Utils/SimplifyInstructions.cpp @@ -90,6 +90,7 @@ void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesCFG(); + AU.addRequired(); AU.addRequired(); AU.addRequired(); } @@ -99,9 +100,8 @@ if (skipFunction(F)) return false; - const DominatorTreeWrapperPass *DTWP = - getAnalysisIfAvailable(); - const DominatorTree *DT = DTWP ? &DTWP->getDomTree() : nullptr; + const DominatorTree *DT = + &getAnalysis().getDomTree(); const TargetLibraryInfo *TLI = &getAnalysis().getTLI(); AssumptionCache *AC = @@ -115,6 +115,7 @@ 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) @@ -127,10 +128,10 @@ PreservedAnalyses InstSimplifierPass::run(Function &F, FunctionAnalysisManager &AM) { - auto *DT = AM.getCachedResult(F); + auto &DT = AM.getResult(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'.