From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14532 invoked by alias); 8 Jul 2010 21:41:58 -0000 Received: (qmail 14503 invoked by uid 22791); 8 Jul 2010 21:41:56 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-pv0-f175.google.com (HELO mail-pv0-f175.google.com) (74.125.83.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Jul 2010 21:41:51 +0000 Received: by pvg13 with SMTP id 13so525849pvg.20 for ; Thu, 08 Jul 2010 14:41:49 -0700 (PDT) Received: by 10.114.120.1 with SMTP id s1mr10170287wac.129.1278625309419; Thu, 08 Jul 2010 14:41:49 -0700 (PDT) Received: from napoca ([163.181.251.115]) by mx.google.com with ESMTPS id c24sm1946312wam.19.2010.07.08.14.41.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 08 Jul 2010 14:41:48 -0700 (PDT) Received: by napoca (sSMTP sendmail emulation); Thu, 08 Jul 2010 16:41:45 -0500 From: Sebastian Pop To: gcc-patches@gcc.gnu.org Cc: rguenther@suse.de, matz@suse.de, Sebastian Pop Subject: [PATCH 2/4] Outline fold_or_predicates from add_to_predicate_list. Date: Thu, 08 Jul 2010 21:41:00 -0000 Message-Id: <1278625285-12667-3-git-send-email-sebpop@gmail.com> In-Reply-To: <1278625285-12667-1-git-send-email-sebpop@gmail.com> References: <1278625285-12667-1-git-send-email-sebpop@gmail.com> X-IsSubscribed: yes 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 X-SW-Source: 2010-07/txt/msg00719.txt.bz2 * tree-if-conv.c (fold_or_predicates): New. (add_to_predicate_list): Call it. --- gcc/tree-if-conv.c | 43 ++++++++++++++++++++++--------------------- 1 files changed, 22 insertions(+), 21 deletions(-) diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 34b4159..cac5a3b 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -300,6 +300,27 @@ parse_predicate (tree cond, tree *op0, tree *op1) return ERROR_MARK; } +/* Returns the fold of predicate C1 OR C2. */ + +static tree +fold_or_predicates (tree c1, tree c2) +{ + tree op1a, op1b, op2a, op2b; + enum tree_code code1 = parse_predicate (c1, &op1a, &op1b); + enum tree_code code2 = parse_predicate (c2, &op2a, &op2b); + + if (code1 != ERROR_MARK && code2 != ERROR_MARK) + { + tree t = maybe_fold_or_comparisons (code1, op1a, op1b, + code2, op2a, op2b); + if (t) + return t; + } + + return fold_build2_loc (UNKNOWN_LOCATION, TRUTH_OR_EXPR, + boolean_type_node, c1, c2); +} + /* Add condition NC to the predicate list of basic block BB. */ static inline void @@ -313,27 +334,7 @@ add_to_predicate_list (basic_block bb, tree nc) if (!is_predicated (bb)) bc = nc; else - { - enum tree_code code1, code2; - tree op1a, op1b, op2a, op2b; - - bc = bb_predicate (bb); - code1 = parse_predicate (bc, &op1a, &op1b); - code2 = parse_predicate (nc, &op2a, &op2b); - - if (code1 != ERROR_MARK && code2 != ERROR_MARK) - { - tree t = maybe_fold_or_comparisons (code1, op1a, op1b, - code2, op2a, op2b); - if (!t) - t = fold_build2_loc (EXPR_LOCATION (bc), TRUTH_OR_EXPR, - boolean_type_node, bc, nc); - bc = t; - } - else - bc = fold_build2_loc (EXPR_LOCATION (bc), TRUTH_OR_EXPR, - boolean_type_node, bc, nc); - } + bc = fold_or_predicates (nc, bb_predicate (bb)); if (!is_gimple_condexpr (bc)) { -- 1.7.0.4