[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2013-05-13 Thread jamborm at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371

Martin Jambor jamborm at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #17 from Martin Jambor jamborm at gcc dot gnu.org ---
Author: jamborm
Date: Mon May 13 10:16:09 2013
New Revision: 198821

URL: http://gcc.gnu.org/viewcvs?rev=198821root=gccview=rev
Log:
2013-05-13  Martin Jambor  mjam...@suse.cz

PR middle-end/42371
* ipa-prop.h (IPA_UNDESCRIBED_USE): New macro.
(ipa_constant_data): New type.
(ipa_jump_func): Use ipa_constant_data to hold information about
constant jump functions.
(ipa_get_jf_constant): Adjust to jump function type changes.
(ipa_get_jf_constant_rdesc): New function.
(ipa_param_descriptor): New field controlled_uses.
(ipa_get_controlled_uses): New function.
(ipa_set_controlled_uses): Likewise.
* ipa-ref.h (ipa_find_reference): Declare.
* ipa-prop.c (ipa_cst_ref_desc): New type.
(ipa_print_node_jump_functions_for_edge): Adjust for jump function type
changes.
(ipa_set_jf_constant): Likewise.  Also create reference descriptions.
New parameter cs.  Adjust all callers.
(ipa_analyze_params_uses): Detect uncontrolled and controlled uses.
(remove_described_reference): New function.
(jfunc_rdesc_usable): Likewise.
(try_make_edge_direct_simple_call): Decrement controlled use count,
attempt to remove reference if it hits zero.
(combine_controlled_uses_counters): New function.
(propagate_controlled_uses): Likewise.
(ipa_propagate_indirect_call_infos): Call propagate_controlled_uses.
(ipa_edge_duplication_hook): Duplicate reference descriptions.
(ipa_print_node_params): Print described use counter.
(ipa_write_jump_function): Adjust to jump function type changes.
(ipa_read_jump_function): New parameter CS, pass it to
ipa_set_jf_constant.  Adjust caller.
(ipa_write_node_info): Stream controlled use count
(ipa_read_node_info): Likewise.
* cgraph.c (cgraph_mark_address_taken_node): Bail out instead of
asserting.
* ipa-cp.c (ipcp_discover_new_direct_edges): Decrement controlled use
count.  Remove cloning-added reference if it reaches zero.
* ipa-ref.c (ipa_find_reference): New function.

testsuite/
* gcc.dg/ipa/remref-0.c: New test.
* gcc.dg/ipa/remref-1a.c: Likewise.
* gcc.dg/ipa/remref-1b.c: Likewise.
* gcc.dg/ipa/remref-2a.c: Likewise.
* gcc.dg/ipa/remref-2b.c: Likewise.


Added:
trunk/gcc/testsuite/gcc.dg/ipa/remref-0.c
trunk/gcc/testsuite/gcc.dg/ipa/remref-1a.c
trunk/gcc/testsuite/gcc.dg/ipa/remref-1b.c
trunk/gcc/testsuite/gcc.dg/ipa/remref-2a.c
trunk/gcc/testsuite/gcc.dg/ipa/remref-2b.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/cgraph.c
trunk/gcc/ipa-cp.c
trunk/gcc/ipa-prop.c
trunk/gcc/ipa-prop.h
trunk/gcc/ipa-ref.c
trunk/gcc/ipa-ref.h
trunk/gcc/testsuite/ChangeLog


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2013-04-17 Thread jamborm at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



Martin Jambor jamborm at gcc dot gnu.org changed:



   What|Removed |Added



URL||http://gcc.gnu.org/ml/gcc-p

   ||atches/2013-04/msg01032.htm

   ||l

 CC||jamborm at gcc dot gnu.org



--- Comment #16 from Martin Jambor jamborm at gcc dot gnu.org 2013-04-17 
15:58:17 UTC ---

I have submitted a patch to address this issue:



http://gcc.gnu.org/ml/gcc-patches/2013-04/msg01032.html


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2013-01-19 Thread hubicka at ucw dot cz


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



--- Comment #15 from Jan Hubicka hubicka at ucw dot cz 2013-01-19 21:48:12 
UTC ---

 Clearing of address-taken does not work:

 

 two/1 (two) @0x7fafc0e29818

   Type: function

   Visibility: prevailing_def_ironly

   Address is taken.

   References:

   Referring: main/3 (addr)

   Availability: available

   Function flags: analyzed body finalized

   Called by:

   Calls:

 

 that is, we do not re-compute address-taken after IPA inline transform stage

 and thus do not reclaim indirectly inlined functions that we no longer need.



We can't recompute here because inlining transform happens during the final

compilation stage, so the functions are already beging output to the assembly.



IPA-prop needs to realize that indirect inlining is going to optimize out the

address operation and remove the reference.  I assume this is not too hard to

implement - we only need to record when the function parameter is used _only_

of the stuff represented by jump functions and indirect edges. I was trying

to convince Martin to implement this for a while :)



Virtual functions are ven harder than indirect calls since we need to figure

out

the vtable will become unreachable at the IPA stage.



Honza


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2013-01-18 Thread rguenth at gcc dot gnu.org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



Richard Biener rguenth at gcc dot gnu.org changed:



   What|Removed |Added



 Status|REOPENED|NEW



--- Comment #14 from Richard Biener rguenth at gcc dot gnu.org 2013-01-18 
10:25:04 UTC ---

Clearing of address-taken does not work:



two/1 (two) @0x7fafc0e29818

  Type: function

  Visibility: prevailing_def_ironly

  Address is taken.

  References:

  Referring: main/3 (addr)

  Availability: available

  Function flags: analyzed body finalized

  Called by:

  Calls:



that is, we do not re-compute address-taken after IPA inline transform stage

and thus do not reclaim indirectly inlined functions that we no longer need.


Re: [Bug middle-end/42371] dead code not eliminated during folding with whole-program

2013-01-17 Thread Jan Hubicka
 Still a problem in latest 4.7, google/4.7, and trunk (4.8).
So 4.6 was working but 4.7 isn't?


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2013-01-17 Thread hubicka at ucw dot cz


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



--- Comment #12 from Jan Hubicka hubicka at ucw dot cz 2013-01-17 10:27:10 
UTC ---

 Still a problem in latest 4.7, google/4.7, and trunk (4.8).

So 4.6 was working but 4.7 isn't?


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2013-01-17 Thread matt at use dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



--- Comment #13 from Matt Hargett matt at use dot net 2013-01-17 18:28:18 UTC 
---

No. 



4.6 doesn't devirt (at -O2 or -O3) and therefore the DCE isn't relevant.



At both -O2 and -O3, with and without -fwhole-program, both with and without

adjustin declarations one()/two() to one(void)/two(void):



4.7 and google/4.7 both devirt correctly but the DCE on the function bodies

doesn't happen.



4.8 also devirts correctly, but the DCE on the function bodies doesn't happen.


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2013-01-16 Thread matt at use dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



Matt Hargett matt at use dot net changed:



   What|Removed |Added



 Status|RESOLVED|REOPENED

 Resolution|FIXED   |



--- Comment #11 from Matt Hargett matt at use dot net 2013-01-17 00:09:32 UTC 
---

Still a problem in latest 4.7, google/4.7, and trunk (4.8).


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2011-04-12 Thread matt at use dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371

Matt Hargett matt at use dot net changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #10 from Matt Hargett matt at use dot net 2011-04-12 18:29:28 UTC 
---
I just tested and it looks like this is actually fixed in 4.6 for this specific
example and another one I had.

I'm still seeing remnants with C++, but I'll file a separate bug for that.


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2011-03-16 Thread matt at use dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371

--- Comment #9 from Matt Hargett matt at use dot net 2011-03-16 21:43:56 UTC 
---
Now that 4.7 stage 1 is open, let me know if there's anything else I can
reasonably provide to provide examples, testing, etc. Thanks!


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2011-01-12 Thread hubicka at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371

Jan Hubicka hubicka at gcc dot gnu.org changed:

   What|Removed |Added

 AssignedTo|hubicka at gcc dot gnu.org  |mjambor at suse dot cz

--- Comment #8 from Jan Hubicka hubicka at gcc dot gnu.org 2011-01-12 
10:43:13 UTC ---
Hi,
the last problem was solved, sadly it is not last.  We still keep the functions
around because we don't see that indirect inlining effectively removes the
reference.  
Martin probably should look into this for 4.7.


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2011-01-11 Thread matt at use dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371

--- Comment #7 from Matt Hargett matt at use dot net 2011-01-11 23:44:22 UTC 
---
Is the last remaining issue with this test case fixed by the patch for PR46076?


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2010-11-17 Thread matt at use dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371

--- Comment #5 from Matt Hargett matt at use dot net 2010-11-17 21:43:13 UTC 
---
GCC 4.6.0.20101116 still shows this problem, but also introduces new problems
on top of it. Let me know if I should file a new bug for the regressions.
Either way, is there any update on this enhancement getting into 4.6? Thanks!


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2010-11-17 Thread hubicka at ucw dot cz
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371

--- Comment #6 from Jan Hubicka hubicka at ucw dot cz 2010-11-17 23:01:58 UTC 
---
The problem with not recomputing address taken flag is solved. The testcase
still
failed to iling because of type mismatch (i.e. one() instead of one(void)).
You probably could fix your sources there to work around this.

Whether this will be fixed is Richard's call (we need to make constant
propagation to take
away the cast I guess).  Technically this is regression to 4.3.

Yes, please go ahead and report the new problems so there is enough time to fix
them.


[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2010-06-07 Thread matt at use dot net


--- Comment #4 from matt at use dot net  2010-06-07 19:46 ---
Let me know when this is implemented on trunk (preferrably by marking this
report as resolved) and I'll test my proprietary test cases here.

Thanks!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2010-01-22 Thread hubicka at gcc dot gnu dot org


--- Comment #2 from hubicka at gcc dot gnu dot org  2010-01-22 19:09 ---
Note that testcase mises static in front of one/two.  This is something I
plan to implement for next release. Last release has some preparation work for
it, but at the moment we don't really build may edges nor other datastructures
related with indirect calls.

Honza


-- 

hubicka at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |hubicka at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2009-12-15 13:38:42 |2010-01-22 19:09:51
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2010-01-22 Thread hubicka at gcc dot gnu dot org


--- Comment #3 from hubicka at gcc dot gnu dot org  2010-01-22 19:11 ---
really an enhancement rather than bug.


-- 

hubicka at gcc dot gnu dot org changed:

   What|Removed |Added

   Severity|normal  |enhancement
   Last reconfirmed|2010-01-22 19:09:51 |2010-01-22 19:11:10
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371



[Bug middle-end/42371] dead code not eliminated during folding with whole-program

2009-12-15 Thread rguenth at gcc dot gnu dot org


--- Comment #1 from rguenth at gcc dot gnu dot org  2009-12-15 13:38 ---
This is because we never re-compute the address-taken flag of functions.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||hubicka at gcc dot gnu dot
   ||org
 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Keywords||missed-optimization
   Last reconfirmed|-00-00 00:00:00 |2009-12-15 13:38:42
   date||


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42371