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

             Bug #: 53438
           Summary: [4.7 Regression] Bitfield store replaced with
                    full-byte store
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: wschm...@gcc.gnu.org
              Host: powerpc64-linux
            Target: powerpc64-linux
             Build: powerpc64-linux


Created attachment 27461
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27461
Reduced testcase

In the attached reduced testcase YarrPattern.ii, function void
JSC::Yarr::YarrPatternConstructor::atomParenthesesSubpatternBegin(bool) (struct
YarrPatternConstructor * const this, bool capture), the "capture" argument is
copied into a one-bit bitfield m_capture within an inlined constructor.  In
4.6, we get the proper read-modify-write code for the bitfield update.  In 4.7,
the value of capture is stored as a full byte instead.

In the 077t.cplxlower dump, we see:

<bb 8>:
  D.4581_14 = this_1(D)->m_alternative;
  D.3875.type = 7;
  D.3875.m_capture = capture_5(D);
  D.3875.m_invert = 0;
  ...

In 078t.sra:

<bb 8>:
  D.4581_14 = this_1(D)->m_alternative;
  SR.171_48 = 7;
  SR.172_47 = capture_5(D);
  SR.173_46 = 0;
  D.6531_55 = &MEM[(struct Vector *)D.4581_14].impl;
  MEM[(struct PatternTerm *)&t] = SR.171_48;
  MEM[(struct PatternTerm *)&t + 4B] = SR.172_47;
  t.m_invert = SR.173_46;
  ...

In 079t.copyrename3:

<bb 8>:
  D.4581_14 = this_1(D)->m_alternative;
  SR.171_48 = 7;
  capture_47 = capture_5(D);
  SR.173_46 = 0;
  D.6531_55 = &MEM[(struct Vector *)D.4581_14].impl;
  MEM[(struct PatternTerm *)&t] = SR.171_48;
  MEM[(struct PatternTerm *)&t + 4B] = capture_47;
  t.m_invert = SR.173_46;
  ...

In 149t.optimized:

<bb 9>:
  D.4581_14 = this_1(D)->m_alternative;
  D.6531_55 = &MEM[(struct Vector *)D.4581_14].impl;
  MEM[(struct PatternTerm *)&t] = 7;
  MEM[(struct PatternTerm *)&t + 4B] = capture_5(D);
  t.m_invert = 0;
  ...

The bitfield-ness of m_capture is lost along the way.  On powerpc64-linux, this
generates a store-byte instruction instead of a read-modify-write.

The reduced test doesn't show the correct code for 4.6 since the method in
question is discarded for whatever reason.  If needed, that can be seen in the
larger YarrPattern.orig.ii, also attached.

The regression remains in current trunk as well.

Sorry for the relatively large test, but delta couldn't reduce it further and
it didn't seem worthwhile to keep hacking on it by hand.

Reply via email to