https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126815
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrea Pinski <[email protected]>: https://gcc.gnu.org/g:1374c269134364e5241051c45363e1b0c381f550 commit r17-3252-g1374c269134364e5241051c45363e1b0c381f550 Author: Andrea Pinski <[email protected]> Date: Wed Aug 12 17:58:22 2026 -0700 dce: Don't remove lhs for calls for no_delete case [PR126815] r17-3204-ge02ce3b8c4574c added a no_delete to simple_dce_from_worklist. With the no_delete option, for calls where the lhs would be removed, simple_dce_from_worklist would insert an assignment after the call. But with exceptions the call is required to be last stmt in the basic block. Note inserting before the call would not work either because of requirements of returns twice functions need to be the first stmt of the basic block ( see gimple_verify_flow_info). So the fix is instead just not removing the lhs for no_delete case. Pushed as obvious after a bootstrap/test on x86_64-linux-gnu. PR tree-optimization/126815 gcc/ChangeLog: * tree-ssa-dce.cc (simple_dce_from_worklist): Just don't remove the lhs for no_delete case rather than adding a new stmt. gcc/testsuite/ChangeLog: * g++.dg/torture/pr126815-1.C: New test. Signed-off-by: Andrea Pinski <[email protected]>
