https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122247
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <[email protected]>: https://gcc.gnu.org/g:5558fa14d999c4d67a1efbba5ca1fe6d6f7ab3ae commit r16-4740-g5558fa14d999c4d67a1efbba5ca1fe6d6f7ab3ae Author: Andrew Pinski <[email protected]> Date: Tue Oct 28 17:20:18 2025 -0700 forwprop: Improve simple dse for eh [PR122247] In the case with EH, we end up with the following IR: ``` # .MEM_5 = VDEF <.MEM_4(D)> inner = outer; # .MEM_6 = VDEF <.MEM_5> p (outer); <bb 3> : # .MEM_7 = VDEF <.MEM_6> inner ={v} {CLOBBER(eos)}; ... <bb 4> : <L0>: # .MEM_9 = VDEF <.MEM_6> inner ={v} {CLOBBER(eos)}; ``` So when the simple DSE looks at the clobber from `bb3`, we find the use of MEM_6 is in a non dominating BB of BB3 so it gets rejected. But since this usage is also a clobber which isthe same as the original clobber; it can be safely assumed to do the same thing as the first clobber. So it can be safely ignored. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/122247 gcc/ChangeLog: * tree-ssa-forwprop.cc (do_simple_agr_dse): Allow use to be a clobber of the same kind to the same lhs. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/copy-prop-aggregate-sra-1.C: New test. Signed-off-by: Andrew Pinski <[email protected]>
