]> granicus.if.org Git - clang/commit
[CodeGen] Generate follow-up metadata for loops with more than one transformation.
authorMichael Kruse <llvm@meinersbur.de>
Mon, 1 Apr 2019 17:47:41 +0000 (17:47 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Mon, 1 Apr 2019 17:47:41 +0000 (17:47 +0000)
commit2f03b60f2c0f44524f2822a0a254627814e331e9
treeacf491facce8b223600fd72ebdf921a51e9a3a2d
parent8aead58dfcd599634ffb831526046923018d0cd1
[CodeGen] Generate follow-up metadata for loops with more than one transformation.

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 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:

  LoopFullUnrollPass
  LoopDistributePass
  LoopVectorizePass
  LoopUnrollAndJamPass
  LoopUnrollPass
  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.

Differential Revision: https://reviews.llvm.org/D57978

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357415 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGLoopInfo.cpp
lib/CodeGen/CGLoopInfo.h
test/CodeGenCXX/pragma-followup_inner.cpp [new file with mode: 0644]
test/CodeGenCXX/pragma-followup_outer.cpp [new file with mode: 0644]
test/CodeGenCXX/pragma-loop-safety-imperfectly_nested.cpp
test/CodeGenCXX/pragma-loop-safety-nested.cpp
test/CodeGenCXX/pragma-loop-safety-outer.cpp
test/CodeGenCXX/pragma-loop-safety.cpp
test/CodeGenCXX/pragma-loop.cpp
test/CodeGenCXX/pragma-unroll-and-jam.cpp
test/OpenMP/simd_metadata.c