@@ -10176,22 +10176,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
10176
10176
return true ;
10177
10177
}
10178
10178
10179
- LoopVectorizeResult LoopVectorizePass::runImpl (
10180
- Function &F, ScalarEvolution &SE_, LoopInfo &LI_, TargetTransformInfo &TTI_,
10181
- DominatorTree &DT_, BlockFrequencyInfo *BFI_, TargetLibraryInfo *TLI_,
10182
- DemandedBits &DB_, AssumptionCache &AC_, LoopAccessInfoManager &LAIs_,
10183
- OptimizationRemarkEmitter &ORE_, ProfileSummaryInfo *PSI_) {
10184
- SE = &SE_;
10185
- LI = &LI_;
10186
- TTI = &TTI_;
10187
- DT = &DT_;
10188
- BFI = BFI_;
10189
- TLI = TLI_;
10190
- AC = &AC_;
10191
- LAIs = &LAIs_;
10192
- DB = &DB_;
10193
- ORE = &ORE_;
10194
- PSI = PSI_;
10179
+ LoopVectorizeResult LoopVectorizePass::runImpl (Function &F) {
10195
10180
10196
10181
// Don't attempt if
10197
10182
// 1. the target claims to have no vector registers, and
@@ -10251,53 +10236,51 @@ LoopVectorizeResult LoopVectorizePass::runImpl(
10251
10236
10252
10237
PreservedAnalyses LoopVectorizePass::run (Function &F,
10253
10238
FunctionAnalysisManager &AM) {
10254
- auto &LI = AM.getResult <LoopAnalysis>(F);
10255
- // There are no loops in the function. Return before computing other expensive
10256
- // analyses.
10257
- if (LI.empty ())
10258
- return PreservedAnalyses::all ();
10259
- auto &SE = AM.getResult <ScalarEvolutionAnalysis>(F);
10260
- auto &TTI = AM.getResult <TargetIRAnalysis>(F);
10261
- auto &DT = AM.getResult <DominatorTreeAnalysis>(F);
10262
- auto &TLI = AM.getResult <TargetLibraryAnalysis>(F);
10263
- auto &AC = AM.getResult <AssumptionAnalysis>(F);
10264
- auto &DB = AM.getResult <DemandedBitsAnalysis>(F);
10265
- auto &ORE = AM.getResult <OptimizationRemarkEmitterAnalysis>(F);
10266
-
10267
- LoopAccessInfoManager &LAIs = AM.getResult <LoopAccessAnalysis>(F);
10268
- auto &MAMProxy = AM.getResult <ModuleAnalysisManagerFunctionProxy>(F);
10269
- ProfileSummaryInfo *PSI =
10270
- MAMProxy.getCachedResult <ProfileSummaryAnalysis>(*F.getParent ());
10271
- BlockFrequencyInfo *BFI = nullptr ;
10272
- if (PSI && PSI->hasProfileSummary ())
10273
- BFI = &AM.getResult <BlockFrequencyAnalysis>(F);
10274
- LoopVectorizeResult Result =
10275
- runImpl (F, SE, LI, TTI, DT, BFI, &TLI, DB, AC, LAIs, ORE, PSI);
10276
- if (!Result.MadeAnyChange )
10277
- return PreservedAnalyses::all ();
10278
- PreservedAnalyses PA;
10279
-
10280
- if (isAssignmentTrackingEnabled (*F.getParent ())) {
10281
- for (auto &BB : F)
10282
- RemoveRedundantDbgInstrs (&BB);
10283
- }
10284
-
10285
- PA.preserve <LoopAnalysis>();
10286
- PA.preserve <DominatorTreeAnalysis>();
10287
- PA.preserve <ScalarEvolutionAnalysis>();
10288
- PA.preserve <LoopAccessAnalysis>();
10289
-
10290
- if (Result.MadeCFGChange ) {
10291
- // Making CFG changes likely means a loop got vectorized. Indicate that
10292
- // extra simplification passes should be run.
10293
- // TODO: MadeCFGChanges is not a prefect proxy. Extra passes should only
10294
- // be run if runtime checks have been added.
10295
- AM.getResult <ShouldRunExtraVectorPasses>(F);
10296
- PA.preserve <ShouldRunExtraVectorPasses>();
10297
- } else {
10298
- PA.preserveSet <CFGAnalyses>();
10299
- }
10300
- return PA;
10239
+ LI = &AM.getResult <LoopAnalysis>(F);
10240
+ // There are no loops in the function. Return before computing other
10241
+ // expensive analyses.
10242
+ if (LI->empty ())
10243
+ return PreservedAnalyses::all ();
10244
+ SE = &AM.getResult <ScalarEvolutionAnalysis>(F);
10245
+ TTI = &AM.getResult <TargetIRAnalysis>(F);
10246
+ DT = &AM.getResult <DominatorTreeAnalysis>(F);
10247
+ TLI = &AM.getResult <TargetLibraryAnalysis>(F);
10248
+ AC = &AM.getResult <AssumptionAnalysis>(F);
10249
+ DB = &AM.getResult <DemandedBitsAnalysis>(F);
10250
+ ORE = &AM.getResult <OptimizationRemarkEmitterAnalysis>(F);
10251
+ LAIs = &AM.getResult <LoopAccessAnalysis>(F);
10252
+
10253
+ auto &MAMProxy = AM.getResult <ModuleAnalysisManagerFunctionProxy>(F);
10254
+ PSI = MAMProxy.getCachedResult <ProfileSummaryAnalysis>(*F.getParent ());
10255
+ BFI = nullptr ;
10256
+ if (PSI && PSI->hasProfileSummary ())
10257
+ BFI = &AM.getResult <BlockFrequencyAnalysis>(F);
10258
+ LoopVectorizeResult Result = runImpl (F);
10259
+ if (!Result.MadeAnyChange )
10260
+ return PreservedAnalyses::all ();
10261
+ PreservedAnalyses PA;
10262
+
10263
+ if (isAssignmentTrackingEnabled (*F.getParent ())) {
10264
+ for (auto &BB : F)
10265
+ RemoveRedundantDbgInstrs (&BB);
10266
+ }
10267
+
10268
+ PA.preserve <LoopAnalysis>();
10269
+ PA.preserve <DominatorTreeAnalysis>();
10270
+ PA.preserve <ScalarEvolutionAnalysis>();
10271
+ PA.preserve <LoopAccessAnalysis>();
10272
+
10273
+ if (Result.MadeCFGChange ) {
10274
+ // Making CFG changes likely means a loop got vectorized. Indicate that
10275
+ // extra simplification passes should be run.
10276
+ // TODO: MadeCFGChanges is not a prefect proxy. Extra passes should only
10277
+ // be run if runtime checks have been added.
10278
+ AM.getResult <ShouldRunExtraVectorPasses>(F);
10279
+ PA.preserve <ShouldRunExtraVectorPasses>();
10280
+ } else {
10281
+ PA.preserveSet <CFGAnalyses>();
10282
+ }
10283
+ return PA;
10301
10284
}
10302
10285
10303
10286
void LoopVectorizePass::printPipeline (
0 commit comments