[Bug tree-optimization/46507] std::get and devirtualization on non-automatic variables

jamborm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 8 14:41:00 GMT 2013


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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

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

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #4)
> 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]

Assuming that first is a non-artificial (as in DECL_ARTIFICIAL) field,
we should be able to devirtualize this but as you have already
noticed, our current type-based middle-end intraprocedural
devirtualization machinery only works on automatic variables, but this
example shows another interesting situation.  Thanks for the testcase,
I will try to make it work after I cleanup the the code to better
interoperate with Honza's recent devirtualization work.



More information about the Gcc-bugs mailing list