This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Add registers to debuginfo MIR test cases.
ClosedPublic

Authored by fhahn on Aug 1 2017, 8:05 AM.

Details

Summary

MIRParserImpl::computeFunctionProperties uses MRI.getNumVirtRegs() to
set the NoVReg property. By adding a bunch of registers to the MIR test
cases, the NoVReg property is not set when importing the MIR. Otherwise
NoVReg is set after instruction selection while the machine instructions
still contain virtual registers, causing expensive checks to fail.

Diff Detail

Event Timeline

fhahn created this revision.Aug 1 2017, 8:05 AM
MatzeB accepted this revision.Aug 1 2017, 9:00 AM

BTW: mir has a feature nowadays, where you can say %0 : gprnopc the first time a vreg is used instead of declaring it in the registers list. Unfortunately the dumper doesn't know about it yet. You may want to switch to that style, though this is fine too.

This revision is now accepted and ready to land.Aug 1 2017, 9:00 AM
MatzeB requested changes to this revision.EditedAug 1 2017, 9:09 AM

BTW: mir has a feature nowadays, where you can say %0 : gprnopc the first time a vreg is used instead of declaring it in the registers list. Unfortunately the dumper doesn't know about it yet. You may want to switch to that style, though this is fine too.

I just realized the vregs aren't even used, why are you adding 14 of them then and not just 1? This also seems odd enough that it warrants a comment in the .mir files.

The fix is also strange; I think what we really need here is a -start-after or -start-before llc argument so it starts at a later pass which doesn't create new vregs anymore. Maybe adrian remembers what -stop-after line he used to create them so we can use the same for start-after?

This revision now requires changes to proceed.Aug 1 2017, 9:09 AM
efriedma edited edge metadata.Aug 1 2017, 11:38 AM

"-start-after=livedebugvalues" appears to work.

fhahn added a comment.Aug 1 2017, 12:22 PM

Agreed, in hindsight the current solution is quite heavy-handed. 1 register

@efriedma -start-after=livedebugvalues works for me only for test/DebugInfo/MIR/ARM/split-superreg-complex.mir, for the other 2 FileCheck fails, I think because the check patterns are stronger. I'll have another look tomorrow.

fhahn updated this revision to Diff 109336.Aug 2 2017, 6:44 AM
fhahn edited edge metadata.

Using -start-before=livedebugvalues . I had to adjust the offset, but I don't think the exact offset is crucial for the test case. Maybe @aprantl can confirm that?

aprantl accepted this revision.Aug 3 2017, 2:20 PM

That change looks reasonable to me.

fhahn added a comment.Aug 4 2017, 1:54 AM

@MatzeB are you happy with the change too? It appears you have to remove your 'This revision now requires changes to proceed.' setting before Phab will mark this patch as accepted.

MatzeB accepted this revision.Aug 4 2017, 8:45 AM

yes, LGTM

This revision is now accepted and ready to land.Aug 4 2017, 8:45 AM
fhahn closed this revision.Aug 5 2017, 5:13 AM