[PATCH] D36157: [PM] Split LoopUnrollPass and make partial unroller a function pass

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 09:13:24 PDT 2017


tejohnson created this revision.
Herald added subscribers: eraman, mzolotukhin, mehdi_amini.

This is largely NFC*, in preparation for utilizing ProfileSummaryInfo
and BranchFrequencyInfo analyses. In this patch I am only doing the
splitting for the New PM, but I can do the same for the legacy PM as
a follow-on if this looks good.

*Not NFC since for partial unrolling we lose the updates done to the
loop traversal (adding new sibling and child loops) - according to
Chandler this is not very useful for partial unrolling, but it also
means that the debugging flag -unroll-revisit-child-loops no longer
works for partial unrolling.

A couple other notes/questions:

1. I noticed that we are still doing partial unrolling via the new

full unroll pass when there is metadata directing a partial unroll
(see @partial_unroll in test/Transforms/LoopUnroll/revisit.ll).
Should I change the code so this is disallowed when unrolling occurs via
the new full unroll pass? If so, presumably this part of the test
becomes obsolete.

2. The LoopPassManager adds a couple of loop canonicalization passes

(LoopSimplifyPass and LCSSAPass). I found I had to add these to
the list of passes for the test/Transforms/LoopUnroll/runtime-loop*.ll
tests to get the same behavior from the partial unroller since it no
longer had those added automatically. In the pipelines we set up in the
PassBuilder, should these be added before the function pass
LoopUnrollPass is added, or can we assume that we would have already
have done any necessary canonicalization through some earlier
invocations of the LoopPassManager?


https://reviews.llvm.org/D36157

Files:
  include/llvm/Transforms/Scalar/LoopUnrollPass.h
  lib/Passes/PassBuilder.cpp
  lib/Passes/PassRegistry.def
  lib/Transforms/Scalar/LoopUnrollPass.cpp
  test/Other/new-pm-defaults.ll
  test/Other/new-pm-thinlto-defaults.ll
  test/Transforms/Inline/last-call-bonus.ll
  test/Transforms/Inline/last-call-no-bonus.ll
  test/Transforms/LoopUnroll/basic.ll
  test/Transforms/LoopUnroll/full-unroll-heuristics.ll
  test/Transforms/LoopUnroll/partial-unroll-const-bounds.ll
  test/Transforms/LoopUnroll/revisit.ll
  test/Transforms/LoopUnroll/runtime-loop.ll
  test/Transforms/LoopUnroll/runtime-loop1.ll
  test/Transforms/LoopUnroll/runtime-loop2.ll
  test/Transforms/LoopUnroll/runtime-loop3.ll
  test/Transforms/LoopUnroll/runtime-loop5.ll
  test/Transforms/LoopUnroll/unloop.ll
  test/Transforms/LoopUnroll/update-loop-info-in-subloops.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36157.109138.patch
Type: text/x-patch
Size: 32384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170801/d92e1ae5/attachment.bin>


More information about the llvm-commits mailing list