You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Store all corresponding BasicBlocks in the block address map.
LLVM's codegen can can merge multiple BasicBlocks into a single
MachineBasicBlock. Unfortunately, MachineBasicBlock::getBasicBlock() only
returns the first BasicBlock in the merged sequence, so we have to find
the other corresponding BasicBlock(s) (if any) in the merged sequence
another way. We do so in two steps:
1. We create a set, MergedBBs, which is the set of BasicBlocks that are
*not* returned by MachineBasicBlock::getBasicBlock(MBB) for any
MachineBasicBlock, MBB, in the parent MachineFunction -- in other words,
it's the set of BasicBlocks that have been merged into a predecessor
during codegen.
2. For each BasicBlock BBX returned by
MachineBasicBlock::getBasicBlock() we check if it is terminated by an
unconditional branch. If so and that unconditional branch transfers to a
block BBY, and BBY is a member of MergedBBs, then we know that BBX and
BBY were merged during codegen. [Note that we then see if another BBZ
was also merged into BBY and so on]
Co-authored-by: Lukas Diekmann <[email protected]>
0 commit comments