@@ -90,6 +90,7 @@ namespace {
90
90
91
91
void getAnalysisUsage (AnalysisUsage &AU) const override {
92
92
AU.setPreservesCFG ();
93
+ AU.addRequired <DominatorTreeWrapperPass>();
93
94
AU.addRequired <AssumptionCacheTracker>();
94
95
AU.addRequired <TargetLibraryInfoWrapperPass>();
95
96
}
@@ -99,9 +100,8 @@ namespace {
99
100
if (skipFunction (F))
100
101
return false ;
101
102
102
- const DominatorTreeWrapperPass *DTWP =
103
- getAnalysisIfAvailable<DominatorTreeWrapperPass>();
104
- const DominatorTree *DT = DTWP ? &DTWP->getDomTree () : nullptr ;
103
+ const DominatorTree *DT =
104
+ &getAnalysis<DominatorTreeWrapperPass>().getDomTree ();
105
105
const TargetLibraryInfo *TLI =
106
106
&getAnalysis<TargetLibraryInfoWrapperPass>().getTLI ();
107
107
AssumptionCache *AC =
@@ -115,6 +115,7 @@ char InstSimplifier::ID = 0;
115
115
INITIALIZE_PASS_BEGIN (InstSimplifier, " instsimplify" ,
116
116
" Remove redundant instructions" , false , false )
117
117
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
118
+ INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
118
119
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
119
120
INITIALIZE_PASS_END(InstSimplifier, " instsimplify" ,
120
121
" Remove redundant instructions" , false , false )
@@ -127,10 +128,10 @@ FunctionPass *llvm::createInstructionSimplifierPass() {
127
128
128
129
PreservedAnalyses InstSimplifierPass::run (Function &F,
129
130
FunctionAnalysisManager &AM) {
130
- auto * DT = AM.getCachedResult <DominatorTreeAnalysis>(F);
131
+ auto & DT = AM.getResult <DominatorTreeAnalysis>(F);
131
132
auto &TLI = AM.getResult <TargetLibraryAnalysis>(F);
132
133
auto &AC = AM.getResult <AssumptionAnalysis>(F);
133
- bool Changed = runImpl (F, DT, &TLI, &AC);
134
+ bool Changed = runImpl (F, & DT, &TLI, &AC);
134
135
if (!Changed)
135
136
return PreservedAnalyses::all ();
136
137
// FIXME: This should also 'preserve the CFG'.
0 commit comments