-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LowerSwitch should remove all dead blocks introduced by switch processing #51725
Comments
assigned to @Nuullll |
opt -S -lowerswitch t.ll define i32 @f(i32 %c) { chk0: ; preds = %chk65 bb_if: ; preds = %chk0 bb_switch: ; preds = %bb_if LeafBlock: ; preds = %bb_switch successor_of_unreachable: ; No predecessors! another_ret: ; preds = %LeafBlock NewDefault: ; preds = %LeafBlock return: ; preds = %NewDefault, %another_ret, %successor_of_unreachable, %bb_if, %chk0, %chk65 |
Another simpler example: there's only one non-default case of the switch inst.
opt -S -lowerswitch t.ll
The default block isn't deleted. |
I think we need to use Dominator Tree to be able to delete new dead blocks accurately. |
We should delegate the dead block elimination to subsequent passes (such as DCE), to avoid unnecessary expense on compilation time. |
Extended Description
Consider the following ll:
Both "out_of_switch_range" and "successor_of_unreachable" should be deleted as they become dead after switch lowering.
But LowerSwitch only deletes the "out_of_switch_range" -- it didn't delete dead block's dominatees which also become unreachable.
The text was updated successfully, but these errors were encountered: