[PATCH] D57978: [CodeGen] Generate follow-up metadata for loops with more than one transformation.

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 8 14:35:37 PST 2019

Meinersbur created this revision.
Meinersbur added reviewers: hfinkel, aaron.ballman, hsaito, dmgreen, anemet, rjmccall, Anastasia, pekka.jaaskelainen, meheff, tyler.nowicki.
Herald added a subscriber: zzheng.
Herald added a project: clang.

Before this patch, CGLoop would dump all transformations for a loop into a single LoopID without encoding any order in which to apply them. rL348944 <https://reviews.llvm.org/rL348944> added the possibility to encode a transformation order using followup-attributes.

When a loop has more than one transformation, use the follow-up attribute define the order in which they are applied. The emitted order is the defacto order as defined by the current LLVM pass pipeline, which is:

1. LoopFullUnrollPass
2. LoopDistributePass
3. LoopVectorizePass
4. LoopUnrollAndJamPass
5. LoopUnrollPass
6. MachinePipeliner

This patch should therefore not change the assembly output, assuming that all explicit transformations can be applied, and no implicit transformations in-between. In the former case, WarnMissedTransformationsPass should emit a warning (except for MachinePipeliner which is not implemented yet). The latter could be avoided by adding 'llvm.loop.disable_nonforced' attributes.

Because LoopUnrollAndJamPass processes a loop nest, generation of the MDNode is delayed to after the inner loop metadata have been processed. A temporary LoopID is therefore used to annotate instructions and RAUW'ed by the actual LoopID later.

  rC Clang



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57978.186043.patch
Type: text/x-patch
Size: 41588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190208/33585df5/attachment-0001.bin>

More information about the cfe-commits mailing list