-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Inliner asserts with cleanuppad #53206
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
Comments
A possibly helpful variant is this:
This results in a verifier error rather than an assert, with the following IR produced for
|
The testcases given are not quite valid... missing required "funclet" marking on invoke in cleanup. Verifier should be checking for that, I think? Anyway, fixed testcase:
I think the inliner's code for updating the EH pads is getting confused because the inlined code is unreachable. The simplest way to fix this might be to just teach the inliner to erase unreachable code... |
I just looked into this a bit. The pruning function cloner will only clone blocks that are reachable -- the problem is that PHI nodes only get resolved and folded after that, and then there's a second pass for folding terminators and dropping dead blocks: llvm-project/llvm/lib/Transforms/Utils/CloneFunction.cpp Lines 718 to 727 in 14e8bed
But that code will only drop trivially dead blocks, not those that are in unreachable cycles. |
Candidate patch: https://reviews.llvm.org/D118449 |
…PR53206) The pruning cloner already tries to remove unreachable blocks. The original cloning process will simplify instructions and constant terminators, and only clone blocks that are reachable at that point. However, phi nodes can only be simplified after everything has been cloned. For that reason, additional blocks may become unreachable after phi simplification. The code does try to handle this as well, but only removes blocks that don't have predecessors. It misses unreachable cycles. This can cause issues if SEH exception handling code is part of an unreachable cycle, as the inliner is not prepared to deal with that. This patch instead performs an explicit scan for reachable blocks, and drops everything else. Fixes llvm#53206. Differential Revision: https://reviews.llvm.org/D118449
…PR53206) The pruning cloner already tries to remove unreachable blocks. The original cloning process will simplify instructions and constant terminators, and only clone blocks that are reachable at that point. However, phi nodes can only be simplified after everything has been cloned. For that reason, additional blocks may become unreachable after phi simplification. The code does try to handle this as well, but only removes blocks that don't have predecessors. It misses unreachable cycles. This can cause issues if SEH exception handling code is part of an unreachable cycle, as the inliner is not prepared to deal with that. This patch instead performs an explicit scan for reachable blocks, and drops everything else. Fixes llvm#53206. Differential Revision: https://reviews.llvm.org/D118449
…PR53206) The pruning cloner already tries to remove unreachable blocks. The original cloning process will simplify instructions and constant terminators, and only clone blocks that are reachable at that point. However, phi nodes can only be simplified after everything has been cloned. For that reason, additional blocks may become unreachable after phi simplification. The code does try to handle this as well, but only removes blocks that don't have predecessors. It misses unreachable cycles. This can cause issues if SEH exception handling code is part of an unreachable cycle, as the inliner is not prepared to deal with that. This patch instead performs an explicit scan for reachable blocks, and drops everything else. Fixes llvm/llvm-project#53206. Differential Revision: https://reviews.llvm.org/D118449
…PR53206) The pruning cloner already tries to remove unreachable blocks. The original cloning process will simplify instructions and constant terminators, and only clone blocks that are reachable at that point. However, phi nodes can only be simplified after everything has been cloned. For that reason, additional blocks may become unreachable after phi simplification. The code does try to handle this as well, but only removes blocks that don't have predecessors. It misses unreachable cycles. This can cause issues if SEH exception handling code is part of an unreachable cycle, as the inliner is not prepared to deal with that. This patch instead performs an explicit scan for reachable blocks, and drops everything else. Fixes llvm/llvm-project#53206. Differential Revision: https://reviews.llvm.org/D118449
Asserts:
The text was updated successfully, but these errors were encountered: