[PATCH] D67011: [MachinePipeliner] Add a way to unit-test the schedule emitter

James Molloy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 30 10:34:48 PDT 2019


jmolloy created this revision.
jmolloy added reviewers: ThomasRaoux, bcahoon.
Herald added subscribers: llvm-commits, jsji.
Herald added a project: LLVM.

Emitting a schedule is really hard. There are lots of corner cases to take care of; in fact, of the 60+ SWP-specific testcases in the Hexagon backend most of those are testing codegen rather than the schedule creation itself.

One issue is that to test an emission corner case we must craft an input such that the generated schedule uses that corner case; sometimes this is very hard and convolutes testcases. Other times it is impossible but we want to test it anyway.

This patch adds a simple test pass that will consume a module containing a loop and generate pipelined code from it. We use post-instr-symbols as a way to annotate instructions with the stage and cycle that we want to schedule them at.

We also provide a flag that causes the MachinePipeliner to generate these annotations instead of actually emitting code; this allows us to generate an input testcase with:

  llc < %s -stop-after=pipeliner -pipeliner-annotate-for-testing -o test.mir

And run the emission in isolation with:

  llc < test.mir -run-pass=modulo-schedule-test

NOTE: relies on D67006 <https://reviews.llvm.org/D67006> to land.


Repository:
  rL LLVM

https://reviews.llvm.org/D67011

Files:
  include/llvm/CodeGen/ModuloSchedule.h
  include/llvm/InitializePasses.h
  lib/CodeGen/CodeGen.cpp
  lib/CodeGen/MachinePipeliner.cpp
  lib/CodeGen/ModuloSchedule.cpp
  test/CodeGen/Hexagon/pipeliner/swp-phi-start.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67011.218129.patch
Type: text/x-patch
Size: 14708 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190830/361ff6b4/attachment.bin>


More information about the llvm-commits mailing list