29
29
#include " llvm/IR/Instructions.h"
30
30
#include " llvm/IR/Module.h"
31
31
#include " llvm/IR/PassManager.h"
32
- #include " llvm/InitializePasses.h"
33
- #include " llvm/Pass.h"
34
32
#include " llvm/Support/Casting.h"
35
33
#include " llvm/Transforms/Scalar.h"
36
34
#include " llvm/Transforms/Utils/Local.h"
@@ -172,46 +170,6 @@ static bool simplifyLoopInst(Loop &L, DominatorTree &DT, LoopInfo &LI,
172
170
return Changed;
173
171
}
174
172
175
- namespace {
176
-
177
- class LoopInstSimplifyLegacyPass : public LoopPass {
178
- public:
179
- static char ID; // Pass ID, replacement for typeid
180
-
181
- LoopInstSimplifyLegacyPass () : LoopPass(ID) {
182
- initializeLoopInstSimplifyLegacyPassPass (*PassRegistry::getPassRegistry ());
183
- }
184
-
185
- bool runOnLoop (Loop *L, LPPassManager &LPM) override {
186
- if (skipLoop (L))
187
- return false ;
188
- DominatorTree &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree ();
189
- LoopInfo &LI = getAnalysis<LoopInfoWrapperPass>().getLoopInfo ();
190
- AssumptionCache &AC =
191
- getAnalysis<AssumptionCacheTracker>().getAssumptionCache (
192
- *L->getHeader ()->getParent ());
193
- const TargetLibraryInfo &TLI =
194
- getAnalysis<TargetLibraryInfoWrapperPass>().getTLI (
195
- *L->getHeader ()->getParent ());
196
- MemorySSA *MSSA = &getAnalysis<MemorySSAWrapperPass>().getMSSA ();
197
- MemorySSAUpdater MSSAU (MSSA);
198
-
199
- return simplifyLoopInst (*L, DT, LI, AC, TLI, &MSSAU);
200
- }
201
-
202
- void getAnalysisUsage (AnalysisUsage &AU) const override {
203
- AU.addRequired <AssumptionCacheTracker>();
204
- AU.addRequired <DominatorTreeWrapperPass>();
205
- AU.addRequired <TargetLibraryInfoWrapperPass>();
206
- AU.setPreservesCFG ();
207
- AU.addRequired <MemorySSAWrapperPass>();
208
- AU.addPreserved <MemorySSAWrapperPass>();
209
- getLoopAnalysisUsage (AU);
210
- }
211
- };
212
-
213
- } // end anonymous namespace
214
-
215
173
PreservedAnalyses LoopInstSimplifyPass::run (Loop &L, LoopAnalysisManager &AM,
216
174
LoopStandardAnalysisResults &AR,
217
175
LPMUpdater &) {
@@ -231,18 +189,3 @@ PreservedAnalyses LoopInstSimplifyPass::run(Loop &L, LoopAnalysisManager &AM,
231
189
PA.preserve <MemorySSAAnalysis>();
232
190
return PA;
233
191
}
234
-
235
- char LoopInstSimplifyLegacyPass::ID = 0 ;
236
-
237
- INITIALIZE_PASS_BEGIN (LoopInstSimplifyLegacyPass, " loop-instsimplify" ,
238
- " Simplify instructions in loops" , false , false )
239
- INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
240
- INITIALIZE_PASS_DEPENDENCY(LoopPass)
241
- INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
242
- INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
243
- INITIALIZE_PASS_END(LoopInstSimplifyLegacyPass, " loop-instsimplify" ,
244
- " Simplify instructions in loops" , false , false )
245
-
246
- Pass *llvm::createLoopInstSimplifyPass() {
247
- return new LoopInstSimplifyLegacyPass ();
248
- }
0 commit comments