[Bug tree-optimization/42970] Missed unused function return value elimination
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 Eric Gallager changed: What|Removed |Added Keywords||patch URL||https://gcc.gnu.org/ml/gcc- ||patches/2019-05/msg00472.ht ||ml --- Comment #8 from Eric Gallager --- (In reply to Martin Jambor from comment #7) > (In reply to Eric Gallager from comment #6) > > > > Stage 1 has opened again. > > And therefore I have submitted a cleaned-up version for review: > > https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00472.html Cool, thanks! Adding "patch" keyword then.
[Bug tree-optimization/42970] Missed unused function return value elimination
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 --- Comment #7 from Martin Jambor --- (In reply to Eric Gallager from comment #6) > > Stage 1 has opened again. And therefore I have submitted a cleaned-up version for review: https://gcc.gnu.org/ml/gcc-patches/2019-05/msg00472.html
[Bug tree-optimization/42970] Missed unused function return value elimination
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 --- Comment #6 from Eric Gallager --- (In reply to Martin Jambor from comment #5) > I have posted a WIP patch as: > > https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01765.html > > I am in the process of cleaning it up for final submission once stage 1 > opens again. Stage 1 has opened again.
[Bug tree-optimization/42970] Missed unused function return value elimination
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 Martin Jambor changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jamborm at gcc dot gnu.org --- Comment #5 from Martin Jambor --- I have posted a WIP patch as: https://gcc.gnu.org/ml/gcc-patches/2018-12/msg01765.html I am in the process of cleaning it up for final submission once stage 1 opens again.
[Bug tree-optimization/42970] Missed unused function return value elimination
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 Eric Gallager changed: What|Removed |Added CC||jamborm at gcc dot gnu.org Assignee|jamborm at gcc dot gnu.org |unassigned at gcc dot gnu.org --- Comment #4 from Eric Gallager --- (In reply to Eric Gallager from comment #3) > Should Martin Jambor remain the assignee for this? No reply; moving from assignee to cc
[Bug tree-optimization/42970] Missed unused function return value elimination
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org --- Comment #3 from Eric Gallager --- Should Martin Jambor remain the assignee for this?
[Bug tree-optimization/42970] Missed unused function return value elimination
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 --- Comment #2 from Richard Biener rguenth at gcc dot gnu.org --- Consider LTO. Note that the issue is that while we remove assignments to unused variables from calls at the caller side we never remove a never used return value from a return statement. This keeps the computation of 'counter' and 'counter' itself life and thus weakens IPA reference analysis. For the following testcase we should be able to remove the call to quantum_gate_counter _without using the trick of inlining it_. Basically some IPA optimization should figure out that 'return counter' is dead and it and all producing stmts can be elimiated. You cannot elimiate the return stmt if you don't change the functions signature, but if you don't want to do that you can for example just return 0. It get's tricky with the requirements in the description but the idea was that the early IPA-SRA pass would clone the function for unused return value, local passes then would eliminate all stmts in the clone making it const and thus we win. The tricky part here is that early opts don't see the whole program so that quantum_gate_counter is exported (and we share the 'counter' variable with the original function which cannot be eliminated). static int __attribute__((noinline,noclone)) quantum_gate_counter(int inc) { static int counter = 0; if(inc 0) counter += inc; else if(inc 0) counter = 0; return counter; } int main() { quantum_gate_counter (1); return 0; }
[Bug tree-optimization/42970] Missed unused function return value elimination
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 Andrew Pinski pinskia at gcc dot gnu.org changed: What|Removed |Added Status|WAITING |NEW
[Bug tree-optimization/42970] Missed unused function return value elimination
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 Kai Tietz ktietz at gcc dot gnu.org changed: What|Removed |Added CC||ktietz at gcc dot gnu.org --- Comment #1 from Kai Tietz ktietz at gcc dot gnu.org --- This testcase seems to be invalid ... The function quantum_gate_counter is visible out-side of the current TU. So nobody can predict that return-type isn't used by external users. So optimization can be done. By adding static to the prototype of quantum_gate_counter for making it visible only to local TU, things getting optimized as desired.
[Bug tree-optimization/42970] Missed unused function return value elimination
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42970 Jan Hubicka hubicka at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed||2010.11.10 17:24:29 CC||hubicka at gcc dot gnu.org Ever Confirmed|0 |1