From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22763 invoked by alias); 3 Sep 2015 03:36:46 -0000 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 Received: (qmail 22626 invoked by uid 48); 3 Sep 2015 03:36:21 -0000 From: "miyuki at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/67438] [6 Regression] ~X op ~Y pattern relocation causes loop performance degradation on 32bit x86 Date: Thu, 03 Sep 2015 03:36:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: missed-optimization, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: miyuki at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg00222.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67438 Mikhail Maltsev changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |miyuki at gcc dot gnu.org --- Comment #4 from Mikhail Maltsev --- I looked at gimple dumps. The only difference looks like this. In the "good" revision after forwprop1: : _13 = *in_2; a_14 = ~_13; _17 = MEM[(char *)in_2 + 1B]; b_18 = ~_17; in_20 = &MEM[(void *)in_2 + 3B]; _21 = MEM[(char *)in_2 + 2B]; c_22 = ~_21; if (a_14 < b_18) goto ; else goto ; In the "bad" revision this basic block is simplified: : _13 = *in_2; a_14 = ~_13; _17 = MEM[(char *)in_2 + 1B]; b_18 = ~_17; in_20 = &MEM[(void *)in_2 + 3B]; _21 = MEM[(char *)in_2 + 2B]; c_22 = ~_21; if (_13 > _17) goto ; else goto ; Next BB's are: : d_23 = MIN_EXPR ; : d_24 = MIN_EXPR ; : # d_4 = PHI The condition of "if" is not altered throughout all other passes (it gets if-converted and vectorized). Another small difference: VRP adds assertions in bb 4 (a_12 lt_expr b_14, b_14 gt_expr a_12) and bb5 (a_12 ge_expr b_14, b_14 le_expr a_12). For some reason this does not happen in the "bad" revision. As I understand, the problem is that if we do not fold the condition, values _13 and _17 are killed after we calculate a_14 = ~_13 and b_18 = ~_17. But if we do fold, they are still live (because they are used in the condition), thus, register pressure increases.