The code in ipa_analyze_call_uses tries to wade through the gimple to identify
uses of pointers to member functions that are invariant after inlining (due to
parameter passing).  However, the code only looks for the vbit test on the
pointer part of the pmf not on the delta.  On targets such as ARM all bits in
the pointer are meaningful and the vbit is stored in the delta and the code
scrubbing fails to match.

Testcase is g++.dg/ipa/iinline-1.C 

On arm the relevant gimple looks like:

  f$__pfn_4 = f.__pfn;
  f$__delta_24 = f.__delta;
  __comp_ctor  (&S, &"muhehehe"[0]);
  D.1787_3 = f$__delta_24 & 1;
  if (D.1787_3 != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

<bb 3>:
  D.1789_6 = f$__delta_24 >> 1;
  D.1790_7 = (unsigned int) D.1789_6;
  D.1791_8 = &S + D.1790_7;
  D.1792_9 = (int (*__vtbl_ptr_type) (void) * *) D.1791_8;
  D.1793_10 = *D.1792_9;
  D.1795_12 = (unsigned int) f$__pfn_4;
  D.1796_13 = D.1793_10 + D.1795_12;
  D.1797_14 = *D.1796_13;
  iftmp.0_15 = (String:: *) D.1797_14;
<bb 4>:
  # iftmp.0_1 = PHI <iftmp.0_15(3), f$__pfn_4(2)>
  D.1789_18 = f$__delta_24 >> 1;
  D.1790_19 = (unsigned int) D.1789_18;
  D.1798_20 = &S + D.1790_19;
  D.1784_21 = iftmp.0_1 (D.1798_20, 4);


-- 
           Summary: ipa_analyze_call_uses fails to handle
                    ptrmemfunc_vbit_in_delta
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rearnsha at gcc dot gnu dot org
GCC target triplet: arm-eabi


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

Reply via email to