This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/46507] std::tuple missed optimization


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

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
                 CC|                            |mjambor at suse dot cz

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
In t.first.f(), the front-end knows that t.first is really an object of type A,
not something derived, so it doesn't need to do a virtual call (I am just
guessing, I didn't check in the FE sources). On the other hand, std::get
returns an A&, which as far as the front-end knows could really be an object of
a derived type. The compiler can only know better after inlining. However, gcc
now knows how to devirtualize a number of calls, so there is hope.

Martin, do you have an opinion on the testcase in comment 3? We get:

  _2 = &t_1(D)->first;
  _4 = MEM[(const struct type *)t_1(D)]._vptr.A;
  _5 = *_4;
  OBJ_TYPE_REF(_5;_2->0) (_2); [tail call]

vs

  _2 = &t_1(D)->first;
  A::f (_2); [tail call]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]