From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126243 invoked by alias); 30 Oct 2015 18:03:13 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 126220 invoked by uid 89); 30 Oct 2015 18:03:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 30 Oct 2015 18:03:11 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 6364A3A1182; Fri, 30 Oct 2015 18:03:10 +0000 (UTC) Received: from freie.home (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9UI38a2030119 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 30 Oct 2015 14:03:09 -0400 Received: from livre.home (livre.home [172.31.160.2]) by freie.home (8.14.9/8.14.9) with ESMTP id t9UI2wnO030528; Fri, 30 Oct 2015 16:02:58 -0200 From: Alexandre Oliva To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: Re: [PR68083] stop ifcombine from moving uninitialized uses before their guards References: Date: Fri, 30 Oct 2015 18:03:00 -0000 In-Reply-To: (Alexandre Oliva's message of "Fri, 30 Oct 2015 11:41:14 -0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2015-10/txt/msg03440.txt.bz2 On Oct 30, 2015, Alexandre Oliva wrote: > Incidentally, bb_no_side_effects_p (inner_cond_bb) is called in all four > tests in tree_ssa_ifcombine_bb_1, for each outer_cond_bb that > tree_ssa_ifcombine_bb might choose. Is there any reason to not factor > it out to the test that checks whether the inner_cond_bb is indeed an > if_then_else block, early in tree_ssa_ifcombine_bb, so as to > short-circuit the whole thing when the inner block is not viable? Like this... Bail out early if the inner block has side effects or is otherwise not eligible for ifcombine. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * tree-ssa-ifcombine.c (tree_ssa_ifcombine_bb_1): Factor out bb_no_side_effects_p tests... (tree_ssa_ifcombine_bb): ... here. --- gcc/tree-ssa-ifcombine.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gcc/tree-ssa-ifcombine.c b/gcc/tree-ssa-ifcombine.c index 622dc6b..3b60968 100644 --- a/gcc/tree-ssa-ifcombine.c +++ b/gcc/tree-ssa-ifcombine.c @@ -579,8 +579,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb, the inner cond_bb having no side-effects. */ if (phi_pred_bb != else_bb && recognize_if_then_else (outer_cond_bb, &inner_cond_bb, &else_bb) - && same_phi_args_p (outer_cond_bb, phi_pred_bb, else_bb) - && bb_no_side_effects_p (inner_cond_bb)) + && same_phi_args_p (outer_cond_bb, phi_pred_bb, else_bb)) { /* We have @@ -598,8 +597,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb, /* And a version where the outer condition is negated. */ if (phi_pred_bb != else_bb && recognize_if_then_else (outer_cond_bb, &else_bb, &inner_cond_bb) - && same_phi_args_p (outer_cond_bb, phi_pred_bb, else_bb) - && bb_no_side_effects_p (inner_cond_bb)) + && same_phi_args_p (outer_cond_bb, phi_pred_bb, else_bb)) { /* We have @@ -620,8 +618,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb, having no side-effects. */ if (phi_pred_bb != then_bb && recognize_if_then_else (outer_cond_bb, &then_bb, &inner_cond_bb) - && same_phi_args_p (outer_cond_bb, phi_pred_bb, then_bb) - && bb_no_side_effects_p (inner_cond_bb)) + && same_phi_args_p (outer_cond_bb, phi_pred_bb, then_bb)) { /* We have @@ -638,8 +635,7 @@ tree_ssa_ifcombine_bb_1 (basic_block inner_cond_bb, basic_block outer_cond_bb, /* And a version where the outer condition is negated. */ if (phi_pred_bb != then_bb && recognize_if_then_else (outer_cond_bb, &inner_cond_bb, &then_bb) - && same_phi_args_p (outer_cond_bb, phi_pred_bb, then_bb) - && bb_no_side_effects_p (inner_cond_bb)) + && same_phi_args_p (outer_cond_bb, phi_pred_bb, then_bb)) { /* We have @@ -676,7 +672,8 @@ tree_ssa_ifcombine_bb (basic_block inner_cond_bb) if (a && b) ; This requires a single predecessor of the inner cond_bb. */ - if (single_pred_p (inner_cond_bb)) + if (single_pred_p (inner_cond_bb) + && bb_no_side_effects_p (inner_cond_bb)) { basic_block outer_cond_bb = single_pred (inner_cond_bb); -- Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/ You must be the change you wish to see in the world. -- Gandhi Be Free! -- http://FSFLA.org/ FSF Latin America board member Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer