Allow the specification of an insertion point (MachineInstr)
for insertMBBIntoMaps.
This makes it possible to update slot indexes and live intervals
when trivially splitting a block by specifying the point of the
split as the insertion point for the block in the maps.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I don't get completely what is the difference between this and just calling insertMBBInMaps() with the new block created by split as the argument. Shouldn't the insertion point being automatically devised correctly if the block is inserted in the right position?
llvm/include/llvm/CodeGen/SlotIndexes.h | ||
---|---|---|
609 | It seems it is actually put "before the next block in MachineFunction insertion order" (I don't think it has anything to do with it being a predecessor or a successor). |
I think the best way to describe the difference is that, at present, insertMBBInMaps inserts the block between blocks, but for splitting we need to the ability to insert the block between instructions. When splitting a sequence of instructions which already have slot indexes, the block needs to come before a given instruction, rather than the next block (which is after the instructions in the new block).
An alternative implementation to the one in this patch would be to change insertMBBInMaps so that it checks if first instruction of the block being added has a slot index. If so, then the block should go before that index, otherwise the current behaviour is maintained, i.e. for new empty blocks, or new blocks of new instructions.
It seems it is actually put "before the next block in MachineFunction insertion order" (I don't think it has anything to do with it being a predecessor or a successor).