From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4129 invoked by alias); 21 May 2012 15:22:22 -0000 Received: (qmail 4115 invoked by uid 22791); 21 May 2012 15:22:21 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 May 2012 15:22:08 +0000 From: "wschmidt at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/53438] New: [4.7 Regression] Bitfield store replaced with full-byte store Date: Mon, 21 May 2012 15:23:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: wschmidt at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg02038.txt.bz2 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: unassigned@gcc.gnu.org ReportedBy: wschmidt@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: : 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: : 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: : 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: : 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.