[PATCH] D144860: [LoopPredication][NFC] Preserve DT and loop analyzes

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 21:51:46 PST 2023


skatkov added a comment.

In D144860#4157411 <https://reviews.llvm.org/D144860#4157411>, @mkazantsev wrote:

> Is it? I was reading LICM code and it's like
>
>   PreservedAnalyses LICMPass::run(Loop &L, LoopAnalysisManager &AM,
>                                   LoopStandardAnalysisResults &AR, LPMUpdater &) {
>     if (!AR.MSSA)
>       report_fatal_error("LICM requires MemorySSA (loop-mssa)",
>                          /*GenCrashDiag*/false);
>   
>     // For the new PM, we also can't use OptimizationRemarkEmitter as an analysis
>     // pass.  Function analyses need to be preserved across loop transformations
>     // but ORE cannot be preserved (see comment before the pass definition).
>     OptimizationRemarkEmitter ORE(L.getHeader()->getParent());
>   
>     LoopInvariantCodeMotion LICM(Opts.MssaOptCap, Opts.MssaNoAccForPromotionCap,
>                                  Opts.AllowSpeculation);
>     if (!LICM.runOnLoop(&L, &AR.AA, &AR.LI, &AR.DT, &AR.AC, &AR.TLI, &AR.TTI,
>                         &AR.SE, AR.MSSA, &ORE))
>       return PreservedAnalyses::all();
>   
>     auto PA = getLoopPassPreservedAnalyses();
>   
>     PA.preserve<DominatorTreeAnalysis>();
>     PA.preserve<LoopAnalysis>();
>     PA.preserve<MemorySSAAnalysis>();
>   
>     return PA;
>   }
>
> Should we then remove it from there?

I think yes.

  PreservedAnalyses llvm::getLoopPassPreservedAnalyses() {
    PreservedAnalyses PA;
    PA.preserve<DominatorTreeAnalysis>();
    PA.preserve<LoopAnalysis>();
    PA.preserve<LoopAnalysisManagerFunctionProxy>();
    PA.preserve<ScalarEvolutionAnalysis>();
    return PA;
  }


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144860/new/

https://reviews.llvm.org/D144860



More information about the llvm-commits mailing list