When filling worklist, UnscheduledPredecessors counter is increased whenever a MBB
within a BlockChain has any predecessor with different BlockChain. This counter is
decreased during buildChain (scheduled), by walking through every successor of MBB
within the BlockChain, decrease when successor BlockChain is different from current
BlockChain. Assuming BlockFilter condition is satisfied.
However, when a MBB is tail duplicated into it's predecessor, a previously increased
UnscheduledPredecessors counter may not be decreased. The BlockFilter condition may no
longer satisfied. Consider nested loop for example, the new predecessor and successor
are in different LoopBlockSet collected for outer and inner loop. Therefore, causing
an unreleased UnscheduledPredecessors counter for inner loop, causing assertion on
"Attempting to place block with unscheduled predecessors in worklist." when trying to
fill worklist later on.
This patch fixes pr44122.
This is the logic where BB is removed from the Chain and Chain Map. It's called in TailDuplicator::tailDuplicateAndUpdate(), when BB is dead and tailduplicator decides to removed it (removeDeadBlock).