This is an archive of the discontinued LLVM Phabricator instance.

[globalisel] Improve legalizer DEBUG_ONLY output.
AbandonedPublic

Authored by dsanders on May 2 2017, 5:18 AM.

Details

Summary

This patch changes the way we decide which instructions to emit in the
DEBUG_ONLY output. It now emits all instructions that replace the work
list item regardless of their creation method (previously instructions
created with BuildMI() were not emitted) and it no longer requires the
new instructions to be added to the work list.

Event Timeline

dsanders created this revision.May 2 2017, 5:18 AM

Just to clarify, this wouldn't work if the target decided to insert new instructions before PrevMII (or even at the beginning for e.g.). I'm guessing if the target does that, its not a big deal if we don't print it.

Just to clarify, this wouldn't work if the target decided to insert new instructions before PrevMII (or even at the beginning for e.g.). I'm guessing if the target does that, its not a big deal if we don't print it.

That's right. It's my understanding that targets are supposed to substitute instructions in place, similar to the legalizer in SelectionDAG. If a target does something else it will need to add it's own DEBUG()

qcolombet edited edge metadata.May 4 2017, 2:10 PM

Hi Daniel,

Although the patch makes sense, I am not sure we can expect that PrintFrom and PrintTo are going to be valid at this point. For instance, CurrMI could fold PrintFrom with a custom legalizer action.

I don't have an alternative to offer though :(

Cheers,
-Quentin

I believe PrintTo will be valid since it's occurs after the instruction we're working on. If we're folding multiple instructions into one we'll be following the operands backwards, away from PrintTo.

For PrintFrom: At the moment, we only erase the current instruction and we leave operands we fold into it for the trivially-dead check in case there's another user of one of the defs for that operand. If that will continue to be the case, then PrintFrom is safe.

It does not sound to me like something we can ensure. I wouldn't pursue in that direction IMHO.

Is this still relevant?

dsanders abandoned this revision.Oct 24 2017, 9:47 AM

Tracing the legalizer is still something we need to improve on but this patch isn't suitable given that we aren't restricting the insertion point.