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.
Details
Diff Detail
- Build Status
Buildable 6052 Build 6052: arc lint + arc unit
Event Timeline
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()
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.
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.