@@ -89,79 +89,3 @@ PreservedAnalyses LoopRotatePass::run(Loop &L, LoopAnalysisManager &AM,
89
89
PA.preserve <MemorySSAAnalysis>();
90
90
return PA;
91
91
}
92
-
93
- namespace {
94
-
95
- class LoopRotateLegacyPass : public LoopPass {
96
- unsigned MaxHeaderSize;
97
- bool PrepareForLTO;
98
-
99
- public:
100
- static char ID; // Pass ID, replacement for typeid
101
- LoopRotateLegacyPass (int SpecifiedMaxHeaderSize = -1 ,
102
- bool PrepareForLTO = false )
103
- : LoopPass(ID), PrepareForLTO(PrepareForLTO) {
104
- initializeLoopRotateLegacyPassPass (*PassRegistry::getPassRegistry ());
105
- if (SpecifiedMaxHeaderSize == -1 )
106
- MaxHeaderSize = DefaultRotationThreshold;
107
- else
108
- MaxHeaderSize = unsigned (SpecifiedMaxHeaderSize);
109
- }
110
-
111
- // LCSSA form makes instruction renaming easier.
112
- void getAnalysisUsage (AnalysisUsage &AU) const override {
113
- AU.addRequired <AssumptionCacheTracker>();
114
- AU.addRequired <TargetTransformInfoWrapperPass>();
115
- AU.addPreserved <MemorySSAWrapperPass>();
116
- getLoopAnalysisUsage (AU);
117
-
118
- // Lazy BFI and BPI are marked as preserved here so LoopRotate
119
- // can remain part of the same loop pass manager as LICM.
120
- AU.addPreserved <LazyBlockFrequencyInfoPass>();
121
- AU.addPreserved <LazyBranchProbabilityInfoPass>();
122
- }
123
-
124
- bool runOnLoop (Loop *L, LPPassManager &LPM) override {
125
- if (skipLoop (L))
126
- return false ;
127
- Function &F = *L->getHeader ()->getParent ();
128
-
129
- auto *LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo ();
130
- const auto *TTI = &getAnalysis<TargetTransformInfoWrapperPass>().getTTI (F);
131
- auto *AC = &getAnalysis<AssumptionCacheTracker>().getAssumptionCache (F);
132
- auto &DT = getAnalysis<DominatorTreeWrapperPass>().getDomTree ();
133
- auto &SE = getAnalysis<ScalarEvolutionWrapperPass>().getSE ();
134
- const SimplifyQuery SQ = getBestSimplifyQuery (*this , F);
135
- std::optional<MemorySSAUpdater> MSSAU;
136
- // Not requiring MemorySSA and getting it only if available will split
137
- // the loop pass pipeline when LoopRotate is being run first.
138
- auto *MSSAA = getAnalysisIfAvailable<MemorySSAWrapperPass>();
139
- if (MSSAA)
140
- MSSAU = MemorySSAUpdater (&MSSAA->getMSSA ());
141
- // Vectorization requires loop-rotation. Use default threshold for loops the
142
- // user explicitly marked for vectorization, even when header duplication is
143
- // disabled.
144
- int Threshold = hasVectorizeTransformation (L) == TM_ForcedByUser
145
- ? DefaultRotationThreshold
146
- : MaxHeaderSize;
147
-
148
- return LoopRotation (L, LI, TTI, AC, &DT, &SE, MSSAU ? &*MSSAU : nullptr , SQ,
149
- false , Threshold, false ,
150
- PrepareForLTO || PrepareForLTOOption);
151
- }
152
- };
153
- } // end namespace
154
-
155
- char LoopRotateLegacyPass::ID = 0 ;
156
- INITIALIZE_PASS_BEGIN (LoopRotateLegacyPass, " loop-rotate" , " Rotate Loops" ,
157
- false , false )
158
- INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
159
- INITIALIZE_PASS_DEPENDENCY(LoopPass)
160
- INITIALIZE_PASS_DEPENDENCY(TargetTransformInfoWrapperPass)
161
- INITIALIZE_PASS_DEPENDENCY(MemorySSAWrapperPass)
162
- INITIALIZE_PASS_END(LoopRotateLegacyPass, " loop-rotate" , " Rotate Loops" , false ,
163
- false )
164
-
165
- Pass *llvm::createLoopRotatePass(int MaxHeaderSize, bool PrepareForLTO) {
166
- return new LoopRotateLegacyPass (MaxHeaderSize, PrepareForLTO);
167
- }
0 commit comments