[llvm-dev] Legacy Loop Pass Manager question

Bhatu via llvm-dev llvm-dev at lists.llvm.org
Thu Aug 9 02:16:43 PDT 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180809/c4666dbe/attachment.html>


More information about the llvm-dev mailing list