[PATCH] D66459: Make ShrinkWrap more consistent.

Francis Visoiu Mistrih via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 18 10:30:01 PDT 2019


thegameg added a comment.

In D66459#1673510 <https://reviews.llvm.org/D66459#1673510>, @linzj wrote:

> In D66459#1673212 <https://reviews.llvm.org/D66459#1673212>, @thegameg wrote:
>
> > You can try to reproduce the behavior of the calling convention through a MIR test: https://llvm.org/docs/MIRLangRef.html, using `$REG = IMPLICIT_DEF` to clobber a CSR.
>
>
> Not that simple. Your solution just handles the call instructions. The the prologue is inserted by the prologue inserter. I can't simply add a prologue to a function's MIR script, right?


What I was suggesting is to write a MIR test that starts the compilation from the ShrinkWrap pass and goes through PrologEpilogInserter (or all the way to the end), then check the output.

To do that, you can generate the MIR test with `llc -stop-before shrink-wrap` with your patch applied, and use `$REG = IMPLICIT_DEF` to strip out everything related to your downstream code. Then using `llc -start-before shrink-wrap -stop-after prologepilog` should allow you to check if the prologue/epilogue has been inserted at the right place.
Another solution would be to use the debug output of the ShrinkWrap pass (`llc -run-pass shrink-wrap -debug-only=shrink-wrap`), but that will only be tested with asserts enabled.

I may be getting all of this wrong, so let me know if that doesn't make sense for your use case.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66459/new/

https://reviews.llvm.org/D66459





More information about the llvm-commits mailing list