https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122058

--- Comment #45 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #43)
> (In reply to Jan Hubicka from comment #41)
> > +  PROF_64 = [obj_type_ref] OBJ_TYPE_REF(_12;(struct
> > ModifierStore)prephitmp_74->2B);
> > +  if (PROF_64 ==
> > _ZThn8_NK3icu6number4impl15LongNameHandler11getModifierENS1_6SignumENS_14Stan
> > dardPlural4FormE.localalias)
> > +    goto <bb 8>; [24.00%]
> > +  else
> > +    goto <bb 9>; [76.00%]
> > +
> > +  <bb 8> [local count: 229067787]:
> > 
> > ....
> > 
> > +  goto <bb 13>; [100.00%]
> > +
> > +  <bb 9> [local count: 725381317]:
> > +  PROF_68 = [obj_type_ref] OBJ_TYPE_REF(_12;(struct
> > ModifierStore)prephitmp_74->2B);
> > 
> > We definitely miss optimization here; PROF_68 is the same as PROF_64. I
> > suppose FRE is confused by OBJ_TYPE_REF?
> 
> FRE doesn't handle OBJ_TYPE_REF in any specific way.  It's semantics
> were never very clear to me and we seem to rely on its presence and thus
> lowering it like RTL expansion does on its own isn't wanted.  OBJ_TYPE_REF
> is GIMPLE_SINGLE_RHS and VN simply drops OBJ_TYPE_REF to varying.

Btw, for virtual calls we embed the OBJ_TYPE_REF as gimple_call_fn,
and we also consider virtual tables writable?

  <bb 2> :
  # VUSE <.MEM_5(D)>
  _1 = a_6(D)->_vptr.A;
  # VUSE <.MEM_5(D)>
  _2 = *_1;
  # .MEM_7 = VDEF <.MEM_5(D)>
  OBJ_TYPE_REF(_2;(struct A)a_6(D)->0B) (a_6(D));
  # VUSE <.MEM_7>
  _3 = a_6(D)->_vptr.A;
  # VUSE <.MEM_7>
  _4 = *_3;
  # .MEM_8 = VDEF <.MEM_7>
  OBJ_TYPE_REF(_4;(struct A)a_6(D)->0B) (a_6(D));

so we do not CSE a virtual table lookup here.  I think we should see to
improve the GIMPLE representation before improving CSE.

Reply via email to