From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32338 invoked by alias); 3 Feb 2013 00:46:05 -0000 Received: (qmail 32123 invoked by uid 48); 3 Feb 2013 00:45:39 -0000 From: "steven at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/56151] [4.8 Regression] Performance degradation after r194054 on x86 Atom. Date: Sun, 03 Feb 2013 00:46:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: steven at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Status Last reconfirmed CC Ever Confirmed Message-ID: In-Reply-To: References: 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: 2013-02/txt/msg00165.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56151 Steven Bosscher changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-02-03 CC|steven at gcc dot gnu.org | Ever Confirmed|0 |1 --- Comment #3 from Steven Bosscher 2013-02-03 00:45:37 UTC --- Confirmed. My patch only avoids situations that ought not to happen in the first place: self-referencing REG_EQUAL notes. If this somehow prevents an interesting code transformation I don't consider it my responsibility to find out what that might be. Therefore I'm not taking this bug. I did look at the difference in generated code. The regression is due to the optabs.c change, reverting it results in the pre-r194054 code again. The difference in code from the 'expand' pass is: 86: NOTE_INSN_BASIC_BLOCK 13 87: {r130:SI=r60:SI>>0x5;clobber flags:CC;} 88: {r131:SI=r130:SI<<0x2;clobber flags:CC;} 89: {r86:SI=r103:SI+r131:SI;clobber flags:CC;} 90: {r132:SI=r60:SI&0x1f;clobber flags:CC;} 91: r133:SI=`setmask' - 92: r134:SI=[r132:SI*0x4+r133:SI] - 93: {[r86:SI]=[r86:SI]|r134:SI;clobber flags:CC;} + 94: r136:SI=[r132:SI*0x4+r133:SI] + 95: r137:SI=[r86:SI] + 96: {r135:SI=r137:SI|r136:SI;clobber flags:CC;} + 97: [r86:SI]=r135:SI REG_EQUAL [r86:SI]|[r132:SI*0x4+r133:SI] // next basic block The '+' code is the post-patch code, '-' is pre-patch (the continuous numbering is due to the '-' code being rejected post-past, so those two insn UIDs are lost). Post-patch the extra moves of insns 95 and 97 are never cleaned up. The extra move is introduced to make room for the REG_EQUAL note that is self-referencing in the pre-patch situation (SET of r86 with REG_EQUAL note using r86). So the pre-patch RTL was indeed invalid. Combine fails to restore the code to its pre-patch state because it combines: 94: r136:SI=[r132:SI*0x4+`setmask'] 95: r137:SI=[r86:SI] 96: {r135:SI=r137:SI|r136:SI;clobber flags:CC;} to: 95: r137:SI=[r86:SI] 96: {r135:SI=r137:SI|[r132:SI*0x4+`setmask'];clobber flags:CC;} and the 'setmask' reference make merging the SET of r135 and the store impossible: Trying 96 -> 97: Failed to match this instruction: (parallel [ (set (mem:SI (reg/f:SI 86 [ D.1803 ]) [2 *_41+0 S4 A32]) (ior:SI (reg:SI 137 [ *_41 ]) (mem:SI (plus:SI (mult:SI (reg:SI 132 [ D.1801 ]) (const_int 4 [0x4])) (symbol_ref:SI ("setmask") )) [2 setmaskD.1732 S4 A32]))) (clobber (reg:CC 17 flags)) ]) Failed to match this instruction: (set (mem:SI (reg/f:SI 86 [ D.1803 ]) [2 *_41+0 S4 A32]) (ior:SI (reg:SI 137 [ *_41 ]) (mem:SI (plus:SI (mult:SI (reg:SI 132 [ D.1801 ]) (const_int 4 [0x4])) (symbol_ref:SI ("setmask") )) [2 setmaskD.1732 S4 A32])))