[PATCH] D32563: Add LiveRangeShrink pass to shrink live range within BB.

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 5 11:52:25 PDT 2017


andreadb added a comment.

In https://reviews.llvm.org/D32563#747423, @danielcdh wrote:

> In https://reviews.llvm.org/D32563#747393, @andreadb wrote:
>
> >
>
>
> Sorry, did not address this in the last patch. Done now. Note that I do not want to touch unnecessary files in this change. So I simply copied the code from MachineSink.cpp, and will refactor it to a utility function in MachineInstr.h/.cpp in a follow-up patch.


No problem. Thanks!

>> About your new test case. I think a MIR test would be even better. That said, I don't have a strong opinion (I am okay with your new test).
>>  In case, could you please regenerate the CHECK lines using `update_llc_test_checks.py? The test should be small, so I don't expect too many CHECK lines inserted by the script.
> 
> Done, but I'm not sure if that's the right thing to do. update_llc_test_checks makes the test too fragile: any subtle change of the codegen would break it. And it hides what the author really want to test and follow-up patch writers may simply run the script and regenerate the test (without understanding what it's testing, or they need to spend much time on what the original purpose is). BTW, what's MIR test? could you point me to one example? Thanks.

Right, I think it your test is okay.

About MIR tests, you can have a look at this page: http://llvm.org/docs/MIRLangRef.html
In particular, section "MIR Testing Guide" (and the next two sub-sections) are quite useful imho.

For example, you could do something like:

> llc my-new-test.ll -stop-after=machine-sink -o test.mir

Then, test.mir with a RUN line which only tests your new pass
For example:

> llc -o - %s -mtriple=x86_64-- -run-pass=lrshrink | FileCheck %s

The advantage is that you test your new pass in isolation.
But, as I wrote, I think your test is okay.


https://reviews.llvm.org/D32563





More information about the llvm-commits mailing list