This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/46507] std::tuple missed optimization
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 14 Sep 2013 21:35:43 +0000
- Subject: [Bug tree-optimization/46507] std::tuple missed optimization
- Auto-submitted: auto-generated
- References: <bug-46507-4 at http dot gcc dot gnu dot org/bugzilla/>
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]