public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
@ 2010-11-10 22:13 ` hubicka at gcc dot gnu.org
  2010-11-10 22:24 ` owner at bugs dot debian.org
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: hubicka at gcc dot gnu.org @ 2010-11-10 22:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #18 from Jan Hubicka <hubicka at gcc dot gnu.org> 2010-11-10 22:12:42 UTC ---
Martin,
is this solved now?


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
  2010-11-10 22:13 ` [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined hubicka at gcc dot gnu.org
@ 2010-11-10 22:24 ` owner at bugs dot debian.org
  2010-11-10 22:27 ` owner at bugs dot debian.org
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: owner at bugs dot debian.org @ 2010-11-10 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #19 from owner at bugs dot debian.org 2010-11-10 22:24:15 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
  2010-11-10 22:13 ` [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined hubicka at gcc dot gnu.org
  2010-11-10 22:24 ` owner at bugs dot debian.org
@ 2010-11-10 22:27 ` owner at bugs dot debian.org
  2010-11-10 22:30 ` owner at bugs dot debian.org
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: owner at bugs dot debian.org @ 2010-11-10 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from owner at bugs dot debian.org 2010-11-10 22:27:14 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2010-11-10 22:27 ` owner at bugs dot debian.org
@ 2010-11-10 22:30 ` owner at bugs dot debian.org
  2010-11-10 22:33 ` owner at bugs dot debian.org
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: owner at bugs dot debian.org @ 2010-11-10 22:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from owner at bugs dot debian.org 2010-11-10 22:30:23 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2010-11-10 22:30 ` owner at bugs dot debian.org
@ 2010-11-10 22:33 ` owner at bugs dot debian.org
  2010-11-10 22:37 ` owner at bugs dot debian.org
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: owner at bugs dot debian.org @ 2010-11-10 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from owner at bugs dot debian.org 2010-11-10 22:33:17 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2010-11-10 22:33 ` owner at bugs dot debian.org
@ 2010-11-10 22:37 ` owner at bugs dot debian.org
  2010-11-10 22:39 ` owner at bugs dot debian.org
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: owner at bugs dot debian.org @ 2010-11-10 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #23 from owner at bugs dot debian.org 2010-11-10 22:36:14 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2010-11-10 22:37 ` owner at bugs dot debian.org
@ 2010-11-10 22:39 ` owner at bugs dot debian.org
  2010-11-10 22:40 ` owner at bugs dot debian.org
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: owner at bugs dot debian.org @ 2010-11-10 22:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from owner at bugs dot debian.org 2010-11-10 22:39:13 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.

--- Comment #25 from owner at bugs dot debian.org 2010-11-10 22:39:14 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2010-11-10 22:39 ` owner at bugs dot debian.org
@ 2010-11-10 22:40 ` owner at bugs dot debian.org
  2010-11-10 22:50 ` ian at airs dot com
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: owner at bugs dot debian.org @ 2010-11-10 22:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from owner at bugs dot debian.org 2010-11-10 22:39:13 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.

--- Comment #25 from owner at bugs dot debian.org 2010-11-10 22:39:14 UTC ---
Thank you for the additional information you have supplied regarding
this Bug report.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 Debian GCC Maintainers <debian-gcc@lists.debian.org>

If you wish to submit further information on this problem, please
send it to 173513@bugs.debian.org.

Please do not send mail to owner@bugs.debian.org unless you wish
to report a problem with the Bug-tracking system.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2010-11-10 22:40 ` owner at bugs dot debian.org
@ 2010-11-10 22:50 ` ian at airs dot com
  2010-11-11  9:45 ` jamborm at gcc dot gnu.org
                   ` (7 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: ian at airs dot com @ 2010-11-10 22:50 UTC (permalink / raw)
  To: gcc-bugs

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

Ian Lance Taylor <ian at airs dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ian at airs dot com

--- Comment #26 from Ian Lance Taylor <ian at airs dot com> 2010-11-10 22:49:18 UTC ---
See also http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=173513 .


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2010-11-10 22:50 ` ian at airs dot com
@ 2010-11-11  9:45 ` jamborm at gcc dot gnu.org
  2010-11-14 17:21 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: jamborm at gcc dot gnu.org @ 2010-11-11  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #27 from Martin Jambor <jamborm at gcc dot gnu.org> 2010-11-11 09:45:02 UTC ---
(In reply to comment #18)
> Martin,
> is this solved now?

The last time I checked it wasn't, mainly because this is not really
an IPA problem (if it was, indirect inlining would handle it just
fine).

I believe the current plan is to make early FRE fix this, see the
discussion in PR 40874.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2010-11-11  9:45 ` jamborm at gcc dot gnu.org
@ 2010-11-14 17:21 ` paolo.carlini at oracle dot com
  2013-01-16 12:39 ` mvanderkolff at gmail dot com
                   ` (5 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: paolo.carlini at oracle dot com @ 2010-11-14 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #28 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-11-14 17:11:21 UTC ---
For the record, my favorite example in the C++ library,
testsuite/performance/27_io/fmtflags_manipulators.cc, pretty simple, still
probably noticeable by many of our users, is by now perfectly optimized at -O2.
Many thanks.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2013-01-16 12:39 ` mvanderkolff at gmail dot com
@ 2013-01-16 12:39 ` mvanderkolff at gmail dot com
  2013-01-16 14:21 ` hubicka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: mvanderkolff at gmail dot com @ 2013-01-16 12:39 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #29 from Michael van der Kolff <mvanderkolff at gmail dot com> 2013-01-16 12:38:41 UTC ---
Created attachment 29180
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29180
testcase for member function pointer that isn't inlined


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2010-11-14 17:21 ` paolo.carlini at oracle dot com
@ 2013-01-16 12:39 ` mvanderkolff at gmail dot com
  2013-01-16 12:39 ` mvanderkolff at gmail dot com
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: mvanderkolff at gmail dot com @ 2013-01-16 12:39 UTC (permalink / raw)
  To: gcc-bugs


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

Michael van der Kolff <mvanderkolff at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mvanderkolff at gmail dot
                   |                            |com

--- Comment #30 from Michael van der Kolff <mvanderkolff at gmail dot com> 2013-01-16 12:39:24 UTC ---
The following is currently (g++ 4.7.2) inlined:
#include <iostream>

using namespace std;

class Foo
{
public:
    void Bar() const
    {
        cout << "Howdy!" << endl;
    }
};

int main()
{
    Foo x;
    auto y = [] (const Foo& z) { z.Bar(); };
    y(x);
    return 0;
}
objdump -D:
--snip --
  400700:       48 83 ec 08             sub    $0x8,%rsp
  400704:       be 0c 09 40 00          mov    $0x40090c,%esi
  400709:       bf a0 0c 60 00          mov    $0x600ca0,%edi
  40070e:       e8 cd ff ff ff          callq  4006e0
<_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@plt>
  400713:       48 89 c7                mov    %rax,%rdi
  400716:       e8 d5 ff ff ff          callq  4006f0
<_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@plt>
  40071b:       31 c0                   xor    %eax,%eax
  40071d:       48 83 c4 08             add    $0x8,%rsp
  400721:       c3                      retq   
  400722:       66 66 66 66 66 2e 0f    data32 data32 data32 data32 nopw
%cs:0x0(%rax,%rax,1)
--snip --
whereas any version with ptr-to-mem fn is not:
...
int main()
{
    Foo x;
    auto y = &Foo::Bar;
    (x.*y)();
    return 0;
}
objdump -D:
--snip --
0000000000400830 <main>:
  400830:       48 83 ec 18             sub    $0x18,%rsp
  400834:       48 8d 7c 24 0f          lea    0xf(%rsp),%rdi
  400839:       e8 42 01 00 00          callq  400980 <_ZNK3Foo3BarEv>
  40083e:       31 c0                   xor    %eax,%eax
  400840:       48 83 c4 18             add    $0x18,%rsp
  400844:       c3                      retq   
  400845:       66 66 2e 0f 1f 84 00    data32 nopw %cs:0x0(%rax,%rax,1)
--snip --


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2013-01-16 12:39 ` mvanderkolff at gmail dot com
@ 2013-01-16 14:21 ` hubicka at gcc dot gnu.org
  2013-01-16 14:49 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: hubicka at gcc dot gnu.org @ 2013-01-16 14:21 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #31 from Jan Hubicka <hubicka at gcc dot gnu.org> 2013-01-16 14:20:46 UTC ---
Well, after early optimizations we get:
int main() ()
{
  struct Foo x;
  void Foo::<T392> (const struct Foo *) * iftmp.0;
  long int _3;
  long int _4;
  int (*__vtbl_ptr_type) () * _5;
  long int _6;
  sizetype _7;
  int (*__vtbl_ptr_type) () * _8;

  <bb 2>:
  _3 = (long int) Bar;
  _4 = _3 & 1;
  if (_4 == 0)
    goto <bb 4>;
  else
    goto <bb 3>;

  <bb 3>:
  _5 = MEM[(int (*__vtbl_ptr_type) () * *)&x];

that is only later, at ccp2 times turned int
int main() ()
{
  struct Foo x;
  long int _3;

  <bb 2>:
  _3 = (long int) Bar;
  Foo::Bar (&x);
  x ={v} {CLOBBER};
  return 0;

}

ccp1 s not able to do this because it still sees:
int main() ()
{
  struct
  {
    void Foo::<T392> (const struct Foo *) * __pfn;
    long int __delta;
  } y;
  struct Foo x;
  void Foo::<T392> (const struct Foo *) * iftmp.0;
  void Foo::<T392> (const struct Foo *) * _5;
  long int _6;
  long int _7;
  long int _9;
  sizetype _10;
  struct Foo * _11;
  int (*__vtbl_ptr_type) () * _12;
  void Foo::<T392> (const struct Foo *) * _13;
  long int _14;
  long int _15;
  sizetype _16;
  int (*__vtbl_ptr_type) () * _17;
  long int _19;
  sizetype _20;
  const struct Foo * _21;

  <bb 2>:
  y.__pfn = Bar;
  y.__delta = 0;
  _5 = y.__pfn;
  _6 = (long int) _5;
  _7 = _6 & 1;
  if (_7 == 0)
    goto <bb 3>;
  else
    goto <bb 4>;

This is fixed by SRA to:
  <bb 2>:
  y$__pfn_4 = Bar;
  y$__delta_3 = 0;
  _5 = y$__pfn_4;
  _6 = (long int) _5;
  _7 = _6 & 1;
  if (_7 == 0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  iftmp.0_8 = y$__pfn_4;

Richi, is there chance for subsequent FRE to catch this?


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (13 preceding siblings ...)
  2013-01-16 14:21 ` hubicka at gcc dot gnu.org
@ 2013-01-16 14:49 ` rguenth at gcc dot gnu.org
  2013-03-18  8:54 ` rguenth at gcc dot gnu.org
  2013-03-18  8:56 ` rguenth at gcc dot gnu.org
  16 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-01-16 14:49 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|jamborm at gcc dot gnu.org  |rguenth at gcc dot gnu.org

--- Comment #32 from Richard Biener <rguenth at gcc dot gnu.org> 2013-01-16 14:49:31 UTC ---
Created attachment 29181
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29181
patch


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (14 preceding siblings ...)
  2013-01-16 14:49 ` rguenth at gcc dot gnu.org
@ 2013-03-18  8:54 ` rguenth at gcc dot gnu.org
  2013-03-18  8:56 ` rguenth at gcc dot gnu.org
  16 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-18  8:54 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #33 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-18 08:53:51 UTC ---
Author: rguenth
Date: Mon Mar 18 08:53:42 2013
New Revision: 196771

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196771
Log:
2013-03-18  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/3713
    * tree-ssa-sccvn.c (visit_copy): Simplify.  Always propagate
    has_constants and expr.
    (stmt_has_constants): Properly valueize SSA names when deciding
    whether the stmt has constants.

    * g++.dg/ipa/devirt-12.C: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/ipa/devirt-12.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-sccvn.c


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
                   ` (15 preceding siblings ...)
  2013-03-18  8:54 ` rguenth at gcc dot gnu.org
@ 2013-03-18  8:56 ` rguenth at gcc dot gnu.org
  16 siblings, 0 replies; 27+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-03-18  8:56 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.9.0
         Resolution|                            |FIXED

--- Comment #34 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-18 08:55:09 UTC ---
Fixed for 4.9.


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-1229@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2008-04-16 13:28 ` jamborm at gcc dot gnu dot org
@ 2009-08-06 12:22 ` jamborm at gcc dot gnu dot org
  3 siblings, 0 replies; 27+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2009-08-06 12:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #17 from jamborm at gcc dot gnu dot org  2009-08-06 12:22 -------
Note to self: PR 40874 is related.


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-1229@http.gcc.gnu.org/bugzilla/>
  2007-09-02 11:56 ` guillaume dot melquiond at ens-lyon dot fr
  2007-09-24 19:46 ` pinskia at gcc dot gnu dot org
@ 2008-04-16 13:28 ` jamborm at gcc dot gnu dot org
  2009-08-06 12:22 ` jamborm at gcc dot gnu dot org
  3 siblings, 0 replies; 27+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2008-04-16 13:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from jamborm at gcc dot gnu dot org  2008-04-16 13:27 -------
I'm now working on inlining of indirect calls (PR 9079) and intend to allow for
inlining of calls through member pointers too.


-- 

jamborm at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jamborm at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-03-11 06:23:54         |2008-04-16 13:27:21
               date|                            |


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-1229@http.gcc.gnu.org/bugzilla/>
  2007-09-02 11:56 ` guillaume dot melquiond at ens-lyon dot fr
@ 2007-09-24 19:46 ` pinskia at gcc dot gnu dot org
  2008-04-16 13:28 ` jamborm at gcc dot gnu dot org
  2009-08-06 12:22 ` jamborm at gcc dot gnu dot org
  3 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-09-24 19:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from pinskia at gcc dot gnu dot org  2007-09-24 19:45 -------
The testcase in comment #12 was fixed via
http://gcc.gnu.org/ml/gcc-cvs/2007-09/msg00696.html .


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <bug-3713-1229@http.gcc.gnu.org/bugzilla/>
@ 2007-09-02 11:56 ` guillaume dot melquiond at ens-lyon dot fr
  2007-09-24 19:46 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 27+ messages in thread
From: guillaume dot melquiond at ens-lyon dot fr @ 2007-09-02 11:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from guillaume dot melquiond at ens-lyon dot fr  2007-09-02 11:56 -------
Created an attachment (id=14150)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14150&action=view)
Implements folding of "(&function & 1)"

I encountered the same issue with some heavy template code: GCC was generating
some really awful code, while it should have been optimized to almost anything.
It basically comes down to this kind of C++ code:

  struct A { void a(); };
  template < void (A::*f)() >
  void g(A *t) { (t->*f)(); }
  void h(A *t) { g<&A::a>(t); }

After instantiation, it is somehow transformed to:

  struct A { void a(); };
  void h(A *t) { (t->*(&A::a))(); }

And GCC is unable to optimize it. So I played a bit with the attached patch,
which does fix the issue for my template code.

Note that GCC does inline the member function for my code (just add an empty
body to A::a to test it), but it doesn't inline it in Andrew Pinski's last
testcase. I have no idea why; perhaps because the address goes through a
variable. But at least the generated code no longer contain any crap and it
directly calls the correct function, even if it doesn't inline it.

(As for why the C++ front-end generates this code in the first place, it is
because the lower bit of the pointer indicates whether an extra indirection is
needed when calling the function through the pointer to member. The C++
front-end actually assumes that functions have an alignment of 2 at least, so
that this trick can work.)


-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <20010717101600.3713.philippeb@videotron.ca>
                   ` (4 preceding siblings ...)
  2005-07-04 21:54 ` pinskia at gcc dot gnu dot org
@ 2005-07-04 23:42 ` pcarlini at suse dot de
  5 siblings, 0 replies; 27+ messages in thread
From: pcarlini at suse dot de @ 2005-07-04 23:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2005-07-04 23:42 -------
... alternately, one we really care about, performance-wise, could be distilled
from libstdc++-v3/testsuite/performance/27_io/fmtflags_manipulators.cc...

-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <20010717101600.3713.philippeb@videotron.ca>
                   ` (3 preceding siblings ...)
  2005-05-08 23:58 ` pinskia at gcc dot gnu dot org
@ 2005-07-04 21:54 ` pinskia at gcc dot gnu dot org
  2005-07-04 23:42 ` pcarlini at suse dot de
  5 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-04 21:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-04 21:54 -------
Actually the testcase above is not really valid.
The below testcase is more correct as A::p cannot be inlined as it has its address taken (stupid bug in 
the C++ front-end really).
But here is a better testcase:
    struct A
    {
            void foo()
            {
            }
    };

    int main()
    {
     void (A::* const p)() = & A::foo;
            A a;
            (a.*p)();
    }


---- cut ---
  D.1749 = (int) foo;
  if ((D.1749 & 1) != 0) goto <L0>; else goto <L5>;

hmm, we need to know the alignment of a function, which is weird.  Why is the C++ front-end 
producing code like this, oh well.

-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <20010717101600.3713.philippeb@videotron.ca>
                   ` (2 preceding siblings ...)
  2005-01-23 15:15 ` steven at gcc dot gnu dot org
@ 2005-05-08 23:58 ` pinskia at gcc dot gnu dot org
  2005-07-04 21:54 ` pinskia at gcc dot gnu dot org
  2005-07-04 23:42 ` pcarlini at suse dot de
  5 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-08 23:58 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 3713 depends on bug 15838, which changed state.

Bug 15838 Summary: "Inline" value of static struct
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15838

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <20010717101600.3713.philippeb@videotron.ca>
  2004-06-06  1:26 ` pinskia at gcc dot gnu dot org
  2004-07-03 19:40 ` pinskia at gcc dot gnu dot org
@ 2005-01-23 15:15 ` steven at gcc dot gnu dot org
  2005-05-08 23:58 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 27+ messages in thread
From: steven at gcc dot gnu dot org @ 2005-01-23 15:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From steven at gcc dot gnu dot org  2005-01-23 15:14 -------
*** Bug 9079 has been marked as a duplicate of this bug. ***

-- 


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <20010717101600.3713.philippeb@videotron.ca>
  2004-06-06  1:26 ` pinskia at gcc dot gnu dot org
@ 2004-07-03 19:40 ` pinskia at gcc dot gnu dot org
  2005-01-23 15:15 ` steven at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-07-03 19:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-07-03 19:40 -------
*** Bug 16352 has been marked as a duplicate of this bug. ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smelkov at mph1 dot phys dot
                   |                            |spbu dot ru


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined
       [not found] <20010717101600.3713.philippeb@videotron.ca>
@ 2004-06-06  1:26 ` pinskia at gcc dot gnu dot org
  2004-07-03 19:40 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 27+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-06  1:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-06 01:26 -------
I filed PR15838 to track part of this bug which needs to be done to help fix this.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|15838                       |
          Component|rtl-optimization            |tree-optimization


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


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2013-03-18  8:56 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-3713-4@http.gcc.gnu.org/bugzilla/>
2010-11-10 22:13 ` [Bug tree-optimization/3713] Pointers to functions or member functions are not folded or inlined hubicka at gcc dot gnu.org
2010-11-10 22:24 ` owner at bugs dot debian.org
2010-11-10 22:27 ` owner at bugs dot debian.org
2010-11-10 22:30 ` owner at bugs dot debian.org
2010-11-10 22:33 ` owner at bugs dot debian.org
2010-11-10 22:37 ` owner at bugs dot debian.org
2010-11-10 22:39 ` owner at bugs dot debian.org
2010-11-10 22:40 ` owner at bugs dot debian.org
2010-11-10 22:50 ` ian at airs dot com
2010-11-11  9:45 ` jamborm at gcc dot gnu.org
2010-11-14 17:21 ` paolo.carlini at oracle dot com
2013-01-16 12:39 ` mvanderkolff at gmail dot com
2013-01-16 12:39 ` mvanderkolff at gmail dot com
2013-01-16 14:21 ` hubicka at gcc dot gnu.org
2013-01-16 14:49 ` rguenth at gcc dot gnu.org
2013-03-18  8:54 ` rguenth at gcc dot gnu.org
2013-03-18  8:56 ` rguenth at gcc dot gnu.org
     [not found] <bug-3713-1229@http.gcc.gnu.org/bugzilla/>
2007-09-02 11:56 ` guillaume dot melquiond at ens-lyon dot fr
2007-09-24 19:46 ` pinskia at gcc dot gnu dot org
2008-04-16 13:28 ` jamborm at gcc dot gnu dot org
2009-08-06 12:22 ` jamborm at gcc dot gnu dot org
     [not found] <20010717101600.3713.philippeb@videotron.ca>
2004-06-06  1:26 ` pinskia at gcc dot gnu dot org
2004-07-03 19:40 ` pinskia at gcc dot gnu dot org
2005-01-23 15:15 ` steven at gcc dot gnu dot org
2005-05-08 23:58 ` pinskia at gcc dot gnu dot org
2005-07-04 21:54 ` pinskia at gcc dot gnu dot org
2005-07-04 23:42 ` pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).