On 2/18/2026 9:03 AM, Andrew Pinski wrote:
So delete_insn_and_edges was added explicitly to solve the problem of having
to cleanup the dead eh edges when a load becomes dead (non-trapping in this 
case).
This moves the one call to delete_insn in cprop_hardreg over to use 
delete_insn_and_edges
to fix this case.
Basically we copyprop the sp register into a memory load. This memory load is 
normally
dead way before but with non-call eh and -fno-delete-dead-exceptions, it is 
alive until
cprop_hardreg. After thie copy prop of the sp register into the memory address 
of the load,
the load becomes non-trapping and is allowed to be deleted. Except we don't 
remove the eh edges
because cprop_hardreg only called delete_insn. So this updates the call to 
delete_insn_and_edges
which removes the eh edges.

Bootstrapped and tested on x86_64-linux-gnu with no regressions.

        PR rtl-optimization/116053

gcc/ChangeLog:

        * regcprop.cc (copyprop_hardreg_forward_1): Use delete_insn_and_edges
        instead of delete_insn.

gcc/testsuite/ChangeLog:

        * gcc.dg/pr116053-1.c: New test.
OK
jeff

Reply via email to