https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122633
--- Comment #2 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:73849aef07bd2954a80fbf1c8543d70db9beae6a commit r16-5553-g73849aef07bd2954a80fbf1c8543d70db9beae6a Author: Andrew Pinski <[email protected]> Date: Sun Nov 23 16:42:57 2025 -0800 forwprop: Add call stmt support to simple dse [PR122633] This adds the ability to the simple dse to remove the lhs of a call. It can also remove a call if it was pure/const in some cases. On trampv3, I found this happened a few times during forwprop2, 3 and 4. The one in 4 was a suprise and even more it caused a removal of a call which gcc was not able to remove before. This is due to the nature of DSE/DCE needs to be done iteratively together but we currently don't do that. So it just happens the late forwprop4's simple dse is able to remove this call. I will fix the xfail testcases in a followup, basically there exceptions can get a mismatch in the CLOBBER which I didn't except before and I was being super cautious when it comes having them match but in reality the difference in CLOBBERs don't matter. Bootstrapped and tested on x86_64-linux-gnu PR tree-optimization/122633 gcc/ChangeLog: * tree-ssa-forwprop.cc (do_simple_agr_dse): Remove lhs of dead store for a call (or the whole call stmt). gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/simple-dse-1.C: New test. * g++.dg/tree-ssa/simple-dse-2.C: New test. * g++.dg/tree-ssa/simple-dse-3.C: New test. * g++.dg/tree-ssa/simple-dse-4.C: New test. Signed-off-by: Andrew Pinski <[email protected]>
