[PATCH] D19431: [LoopDist] Add llvm.loop.distribute.enable loop metadata

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 12:24:44 PDT 2016


anemet created this revision.
anemet added a reviewer: hfinkel.
anemet added a subscriber: llvm-commits.
Herald added subscribers: mzolotukhin, joker.eph.

D19403 adds a new pragma for loop distribution.  This change adds
support for the corresponding metadata that the pragma is translated to
by the FE.

As part of this I had to rethink the flag -enable-loop-distribute.  My
goal was to be backward compatible with the existing behavior:

  A1. pass is off by default from the optimization pipeline
  unless -enable-loop-distribute is specified

  A2. pass is on when invoked directly from opt (e.g. for unit-testing)

The new pragma/metadata overrides these defaults so the new behavior is:

  B1. A1 + enable distribution for individual loop with the pragma/metadata

  B2. A2 + disable distribution for individual loop with the pragma/metadata

The default value whether the pass is on or off comes from the initiator
of the pass.  From the PassManagerBuilder the default is off, from opt
it's on.

I moved -enable-loop-distribute under the pass.  If the flag is
specified it overrides the default from above.

Then the pragma/metadata can further modifies this per loop.

As a side-effect, we can now also use -enable-loop-distribute=0 from opt
to emulate the default from the optimization pipeline.  So to be precise
this is the new behavior:

  C1. pass is off by default from the optimization pipeline
  unless -enable-loop-distribute or the pragma/metadata enables it

  C2. pass is on when invoked directly from opt
  unless -enable-loop-distribute=0 or the pragma/metadata disables it

http://reviews.llvm.org/D19431

Files:
  docs/LangRef.rst
  include/llvm/Transforms/Scalar.h
  lib/Transforms/IPO/PassManagerBuilder.cpp
  lib/Transforms/Scalar/LoopDistribute.cpp
  test/Transforms/LoopDistribute/metadata.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19431.54702.patch
Type: text/x-patch
Size: 11046 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160422/54ffe888/attachment.bin>


More information about the llvm-commits mailing list