eclipse / omr

Eclipse OMR™ Cross platform components for building reliable, high performance language runtimes
http://www.eclipse.org/omr
Other
934 stars 392 forks source link

Do not continue to merge back cold path if guard2 block has been removed #7297

Closed a7ehuo closed 2 months ago

a7ehuo commented 3 months ago

changeBranchDestination tries to remove unreachable blocks after the removal of the old edge from guard2 to cold2. Rarely, a previous transformation in this pass could have made guard2Block unreachable without removing it, in which case it might have been removed just now. Normally, if all relevant blocks are removed, later moveBlockAfterDest will not cause any issue since it will be just moving around all unreachable blocks. However, in an even more rare case, if some of the blocks are removed and some of them are not (eg, guard2Block and the previous block of guard2Block are removed but the next block of guard2Block is still valid), moveBlockAfterDest could end up joining an invalid/removed block with a valid block. Therefore, if guard2Block is no longer valid, it should not proceed.

Fixes: eclipse-openj9/openj9#18873

a7ehuo commented 3 months ago

@jdmpapin May I ask you to review this change? Thank you very much in advance! This comment gives a detailed example of the problem this PR fixes.

@hzongaro fyi

jdmpapin commented 2 months ago

The mac failure is #7181

Jenkins build all

jdmpapin commented 2 months ago

Everything has passed except for the known mac failure already mentioned