https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35545
--- Comment #12 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
We still fail to fold here. After tracer we get:
# ap_2 = PHI <ap_8(4)>
# prephitmp_14 = PHI <&MEM[(void *)&_ZTV1A + 16B](4)>
_19 = *prephitmp_14;
PROF_24 = [obj_type_ref] OBJ_TYPE_REF(_19;(struct A)ap_2->0);
if (PROF_24 == foo)
goto <bb 9>;
else
goto <bb 8>;
and the necessary forward propagation & folding to realize that:
_19 = foo;
PROF_24 = [obj_type_ref] OBJ_TYPE_REF(_19;(struct A)ap_8->0);
if (PROF_24 == foo)
happens only in .optimized dump.
I would go with patch from comment 5 moving tracer earlier - the tail
duplication intends to make code more optimizable and it is stupid to run it
only after all optimizations are done.