]> gcc.gnu.org Git - gcc.git/commit
tree-optimization/116460 - ICE with DCE in forwprop
authorRichard Biener <rguenther@suse.de>
Mon, 26 Aug 2024 11:50:00 +0000 (13:50 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 18 Sep 2024 09:42:11 +0000 (11:42 +0200)
commitbdc5937df68a197032e800fc27361037d016cbf1
treedb648d0d1fbf3e95bc5af832cecb5a2b8148af60
parenta308afb455d648d54430355cb07345a338501348
tree-optimization/116460 - ICE with DCE in forwprop

The following avoids removing stmts with defs that might still have
uses in the IL before calling simple_dce_from_worklist which might
remove those as that will wreck debug stmt generation.  Instead first
perform use-based DCE and then remove stmts which may have uses in
code that CFG cleanup will remove.  This requires tracking stmts
in to_remove by their SSA def so we can check whether it was removed
before without running into the issue that PHIs can be ggc_free()d
upon removal.  So this adds to_remove_defs in addition to to_remove
which has to stay to track GIMPLE_NOPs we want to elide.

PR tree-optimization/116460
* tree-ssa-forwprop.cc (pass_forwprop::execute): First do
simple_dce_from_worklist and then remove stmts in to_remove.
Track defs to be removed in to_remove_defs.

* g++.dg/torture/pr116460.C: New testcase.

(cherry picked from commit 172637cf0d9b7b2798f83b9c5f9598b449675cb0)
gcc/testsuite/g++.dg/torture/pr116460.C [new file with mode: 0644]
gcc/tree-ssa-forwprop.cc
This page took 0.067557 seconds and 6 git commands to generate.