https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89139
David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2019-02-01 CC| |dmalcolm at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Indeed, the last elimination is happening too late. At -O3: .040t.tailr1 converts the tail-recursion in "g" into a loop .076i.inline inlines "g" into "foo", but an initialization of a temporary with "h" remains in "foo" .103t.dce2 eliminates that last use of "h". With the "a * 2" -> "a" variant at -O3, .025t.einline inlines "g" into "foo", converting the tail recursion into a loop .033t.fre1 eliminates the usage of "h" cgraphunit.c:expand_all_functions happens at .090t ("fixup_cfg" and siblings/descendants), so the elimination of the last "h" in .103t.dce2 happens when we're already running cgraph_node::expand on "h" (whereas in the einline variant, "h" has already been eliminated before cgraphunit.c:expand_all_functions).