https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126904
--- Comment #18 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Aldy Hernandez <[email protected]>: https://gcc.gnu.org/g:ae06482cb6fa4f68305192481e9efb3a8ef4a619 commit r17-5581-gae06482cb6fa4f68305192481e9efb3a8ef4a619 Author: Aldy Hernandez <[email protected]> Date: Fri Oct 9 10:54:53 2026 +0000 sccvn: finish elimination in vn_driver::finalize [PR126904] vn_driver::finalize's job is to finish what the walk eliminated, so that FRE's upcoming jump threader can still use the value numbers in between. Move eliminate_cleanup to finalize, so that in between the threader sees the IL as elimination left it, with value numbers that still describe it. vn_driver vn (fun, iterate_p, true); // The names and the CFG are still the ones the value numbers // describe. todo = vn.finalize (); When iterating, FRE now eliminates in the walk too, so the threader searches the IL as elimination leaves it. Searching before eliminating would complicate the threader considerably: neither it nor the jump threading registry handles the IL changing under them between the search and applying the paths. No functional change. PR tree-optimization/126904 gcc/ChangeLog: * tree-ssa-sccvn.h (vn_driver::todo): Remove. (class vn_driver): Add m_region_p and m_eliminator. * tree-ssa-sccvn.cc (do_rpo_vn_1): Take the walker that eliminates when iterating. Leave eliminate_cleanup to the caller. (do_rpo_vn): Pass ELIMINATE through. Return what finalize returns. (vn_driver::vn_driver): When iterating and eliminating, make a walker of its own for the elimination. (vn_driver::~vn_driver): Free it. (vn_driver::finalize): Call eliminate_cleanup on the walker that eliminated. Remove the full elimination. (pass_fre::execute): Have the walk eliminate when iterating too.
