[PATCH] D122672: [CodeGen][ARM] Enable Swing Module Scheduling for ARM

David Penry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 29 11:06:39 PDT 2022


dpenry created this revision.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
dpenry requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This patch permits Swing Modulo Scheduling for ARM targets
turns it on by default for the Cortex-M7.  The t2Bcc
instruction is recognized as a loop-ending branch.

MachinePipeliner is extended by adding support for
"unpipelineable" instructions.  These instructions are
those which contribute to the loop exit test; in the SMS
papers they are removed before creating the dependence graph
and then inserted into the final schedule of the kernel and
prologues. Support for these instructions was not previously
necessary because current targets supporting SMS have only
supported it for hardware loop branches, which have no
loop-exit-contributing instructions in the loop body.

The current structure of the MachinePipeliner makes it difficult
to remove/exclude these instructions from the dependence graph.
Therefore, this patch leaves them in the graph, but adds a
"normalization" method which moves them in the schedule to
stage 0, which causes them to appear properly in kernel and
prologues.

It was also necessary to be more careful about boundary nodes
when iterating across successors in the dependence graph because
the loop exit branch is now a non-artificial successor to
instructions in the graph. In additional, schedules with physical
use/def pairs in the same cycle should be treated as creating an
invalid schedule because the scheduling logic doesn't respect
physical register dependence once scheduled to the same cycle.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122672

Files:
  llvm/include/llvm/CodeGen/MachinePipeliner.h
  llvm/include/llvm/CodeGen/ModuloSchedule.h
  llvm/lib/CodeGen/MachinePipeliner.cpp
  llvm/lib/CodeGen/ModuloSchedule.cpp
  llvm/lib/Target/ARM/ARM.td
  llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
  llvm/lib/Target/ARM/ARMBaseInstrInfo.h
  llvm/lib/Target/ARM/ARMSubtarget.cpp
  llvm/lib/Target/ARM/ARMSubtarget.h
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/test/CodeGen/ARM/O3-pipeline.ll
  llvm/test/CodeGen/Thumb2/swp-fixedii.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122672.418932.patch
Type: text/x-patch
Size: 37984 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220329/609a4473/attachment.bin>


More information about the llvm-commits mailing list