From patchwork Fri Jul 31 12:24:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 502529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C5D8C1402BB for ; Fri, 31 Jul 2015 22:24:16 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=vylhURqr; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=iTNZSe8Oq032TQm6VVPr5RslHFbiYDwHZi4oOqoEp2bgQGUN9jojG PzX3g2Khxf2Ttg7R/oOKd1DR7sIgNMFCikTzdvxp1ka59YcLlZeapL71rO937LV/ qRWe6be2LahqDAoH/eDCOS9Sp4ss22+MtfBIaCENzfMyhatSLSpBVM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=Q8TZOXE6MzZKGXIvBHOCO/0hJOk=; b=vylhURqr0Sx0cR093zIo dkH5mpGNPkYxzYZoS4KkT4LbVbh3rH+VW8PiZYpb6lNMeMGDF4yYwGXEVxcF9ui8 /moN4OTokoubWiR+PjYDW/B7YWEsVmlE+MdMMnpB1kpZFbd2+oPXWIoJuDPdKRkG fFFqelSJ6lxUdj/w284OKTk= Received: (qmail 119864 invoked by alias); 31 Jul 2015 12:24:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 119850 invoked by uid 89); 31 Jul 2015 12:24:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Fri, 31 Jul 2015 12:24:08 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8D638AAC8 for ; Fri, 31 Jul 2015 12:24:05 +0000 (UTC) Date: Fri, 31 Jul 2015 14:24:05 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH][3/2] Remove GENERIC comparison folding from fold_stmt Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 This is the promised 3/2 - it removes simplifying the compare in COND_EXPRs through fold_binary in fold_gimple_assign. Bootstrapped on x86_64-unknown-linux-gnu, testing in progress (testing with an assert in place in progress still as well). Richard. 2015-07-31 Richard Biener * gimple-fold.c (fold_gimple_assign): Remove folding of the comparison in COND_EXPRs. Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 226433) +++ gcc/gimple-fold.c (working copy) @@ -416,49 +416,11 @@ fold_gimple_assign (gimple_stmt_iterator break; case GIMPLE_TERNARY_RHS: - /* Try to fold a conditional expression. */ - if (gimple_assign_rhs_code (stmt) == COND_EXPR) - { - tree op0 = gimple_assign_rhs1 (stmt); - tree tem; - bool set = false; - location_t cond_loc = gimple_location (stmt); - - if (COMPARISON_CLASS_P (op0)) - { - fold_defer_overflow_warnings (); - tem = fold_binary_loc (cond_loc, - TREE_CODE (op0), TREE_TYPE (op0), - TREE_OPERAND (op0, 0), - TREE_OPERAND (op0, 1)); - /* This is actually a conditional expression, not a GIMPLE - conditional statement, however, the valid_gimple_rhs_p - test still applies. */ - set = (tem && is_gimple_condexpr (tem) - && valid_gimple_rhs_p (tem)); - fold_undefer_overflow_warnings (set, stmt, 0); - } - else if (is_gimple_min_invariant (op0)) - { - tem = op0; - set = true; - } - else - return NULL_TREE; - - if (set) - result = fold_build3_loc (cond_loc, COND_EXPR, - TREE_TYPE (gimple_assign_lhs (stmt)), tem, - gimple_assign_rhs2 (stmt), - gimple_assign_rhs3 (stmt)); - } - - if (!result) - result = fold_ternary_loc (loc, subcode, - TREE_TYPE (gimple_assign_lhs (stmt)), - gimple_assign_rhs1 (stmt), - gimple_assign_rhs2 (stmt), - gimple_assign_rhs3 (stmt)); + result = fold_ternary_loc (loc, subcode, + TREE_TYPE (gimple_assign_lhs (stmt)), + gimple_assign_rhs1 (stmt), + gimple_assign_rhs2 (stmt), + gimple_assign_rhs3 (stmt)); if (result) {