[llvm-dev] Legacy Loop Pass Manager question

Michael Kruse via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 16 08:58:26 PDT 2018


This usually happens if an analysis required by LoopInfo is not
preserved. However, LoopDeletion, LoopUnrollAndJam and LoopUnroll's
getAnalysisUsage all call getLoopAnalysisUsage, which add the same
pass preservations.

I'd debug and step through the loop manager's code to find what makes
the cases different.

Michael

Am Do., 9. Aug. 2018 um 04:17 Uhr schrieb Bhatu via llvm-dev
<llvm-dev at lists.llvm.org>:
>
> Hi,
>
> If we add multiple loop passes to the pass manager in PassManagerBuilder.cpp consecutively without any func/module pass in between, I used to think they would belong to the same loop pass manager. But it does not seem to be the case.
>
> For example for this code snippet
>   PM.add(createIndVarSimplifyPass());        // Canonicalize indvars
>   MPM.add(createLoopIdiomPass());             // Recognize idioms like memset.
>   addExtensionsToPM(EP_LateLoopOptimizations, MPM);
>   MPM.add(createLoopDeletionPass());          // Delete dead loops
> ..
>   if (!DisableUnrollLoops)
>     MPM.add(createSimpleLoopUnrollPass(OptLevel));    // Unroll small loops
>
> I see -debug-pass=Structure output:
>         Scalar Evolution Analysis
>         Loop Pass Manager
>           Induction Variable Simplification
>           Recognize loop idioms
>           Delete dead loops
>           Unroll loops
>         MergedLoadStoreMotion
>
> Which is in line to what I thought. However for this code snippet:
>     if (EnableUnrollAndJam) {
>       // Unroll and Jam. We do this before unroll but need to be in a separate
>       // loop pass manager in order for the outer loop to be processed by
>       // unroll and jam before the inner loop is unrolled.
>       MPM.add(createLoopUnrollAndJamPass(OptLevel));
>     }
>
>     MPM.add(createLoopUnrollPass(OptLevel));    // Unroll small loops
>
> I see:
>       Loop-Closed SSA Form Pass
>       Loop Pass Manager
>         Unroll and Jam loops
>       Loop Pass Manager
>         Unroll loops
>       Lazy Branch Probability Analysis
>
> Here two different loop pass managers were created. What is the difference in between these two cases? How was the loop pass manager split up in the second case?
>
>
> --
> Regards
> Bhatu
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list