The TailDuplicator merged two blocks, even if the first one ended with
a terminator, resulting in invalid MIR, where a terminator is in the
middle of a block.
Abort merging if the first block ends with a terminator.
Differential D112226
[TailDuplicator] Fix merging block with terminator sebastian-ne on Oct 21 2021, 8:15 AM. Authored by
Details
The TailDuplicator merged two blocks, even if the first one ended with Abort merging if the first block ends with a terminator.
Diff Detail
Event Timeline
Comment Actions
It’s not impossible, which is exactly what this patch fixes (because S_MOV_B32_term are terminators but not branch instructions, so they stay and should prevent merging even after branch instructions are removed).
Ups, you’re right, I got it wrong, it actually updates them for blocks *not* in TDBBs. I changed it, so it returns if Changed was false before. |
Isn't there a danger that this will fall through to the code that updates phi nodes, even though we didn't merge anything?