From patchwork Wed Jul 17 20:58:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1133430 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-505224-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="pmAOz7hx"; dkim-atps=neutral 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 45pqNz3YVCz9s3Z for ; Thu, 18 Jul 2019 06:58:25 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=VodPo0SGUuxdiKQ+333ppLf7gNVMh3gGARwdRs9dYCKRBnqoTc pRiq/G5iIZLxPtrktHwC2uFBZhH00MrDHt2jM/5HKXSwxdhOXUVN4dNH3H7tSaXh heBXABEJ4qudLYnPHanFNyYjTGmP0AoR3SxuSw7QVrFQ3JYS4j1KBLPIc= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=X/iO+OeQxX1bxlS+DLA2XFvwJ64=; b=pmAOz7hx0OjDxPgFiXPx EkTzG00/aVRWitSEpZDdb89fS6EPsNvVDGSjt5+DNoxHTH79fmWulKA12JeY4Xq5 1oSsXyIKczz8FLTWbkkUvluw0PyIq8BgXfhsNMka3V7arvEC8LHJlz5HbHSHVEyG IxnOZnGKrq2t1iN2v6KwNcY= Received: (qmail 64346 invoked by alias); 17 Jul 2019 20:58:18 -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 64335 invoked by uid 89); 17 Jul 2019 20:58:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-14.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= 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 ESMTP; Wed, 17 Jul 2019 20:58:16 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47BF981F1B for ; Wed, 17 Jul 2019 20:58:15 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-17.rdu2.redhat.com [10.10.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58FAD19C78 for ; Wed, 17 Jul 2019 20:58:13 +0000 (UTC) To: gcc-patches From: Jeff Law Subject: [committed] Fix indentation goof in tree-ssa-dse.c Openpgp: preference=signencrypt Message-ID: Date: Wed, 17 Jul 2019 14:58:13 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 X-IsSubscribed: yes I've been poking at a bit at some missed cases in tree-ssa-dse.c and noticed the formatting for a couple of case statements was wrong. There was also a missing return/break would led to a fallthru warning in some of the work I did. There's no functional changes here. Bootstrapped and regression tested on x86-64. Installing on the trunk. jeff diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c43cf95f4e0..6d8b082a718 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-07-17 Jeff Law + + * tree-ssa-dse.c (initialize_ao_ref_for_dse): Fix formatting. + (dse_walker::dse_optimize_stmt): Likewise. Add missing return to + avoid unexpected switch statement fallthru. + 2019-07-17 Uroš Bizjak * config/i386/i386.md (*add3_doubleword): diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index df05a55ce78..9bdcf9ae6af 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -107,42 +107,42 @@ initialize_ao_ref_for_dse (gimple *stmt, ao_ref *write) { switch (DECL_FUNCTION_CODE (gimple_call_fndecl (stmt))) { - case BUILT_IN_MEMCPY: - case BUILT_IN_MEMMOVE: - case BUILT_IN_MEMSET: - case BUILT_IN_MEMCPY_CHK: - case BUILT_IN_MEMMOVE_CHK: - case BUILT_IN_MEMSET_CHK: - { - tree size = NULL_TREE; - if (gimple_call_num_args (stmt) == 3) - size = gimple_call_arg (stmt, 2); - tree ptr = gimple_call_arg (stmt, 0); - ao_ref_init_from_ptr_and_size (write, ptr, size); - return true; - } + case BUILT_IN_MEMCPY: + case BUILT_IN_MEMMOVE: + case BUILT_IN_MEMSET: + case BUILT_IN_MEMCPY_CHK: + case BUILT_IN_MEMMOVE_CHK: + case BUILT_IN_MEMSET_CHK: + { + tree size = NULL_TREE; + if (gimple_call_num_args (stmt) == 3) + size = gimple_call_arg (stmt, 2); + tree ptr = gimple_call_arg (stmt, 0); + ao_ref_init_from_ptr_and_size (write, ptr, size); + return true; + } - /* A calloc call can never be dead, but it can make - subsequent stores redundant if they store 0 into - the same memory locations. */ - case BUILT_IN_CALLOC: - { - tree nelem = gimple_call_arg (stmt, 0); - tree selem = gimple_call_arg (stmt, 1); - tree lhs; - if (TREE_CODE (nelem) == INTEGER_CST - && TREE_CODE (selem) == INTEGER_CST - && (lhs = gimple_call_lhs (stmt)) != NULL_TREE) - { - tree size = fold_build2 (MULT_EXPR, TREE_TYPE (nelem), - nelem, selem); - ao_ref_init_from_ptr_and_size (write, lhs, size); - return true; - } - } + /* A calloc call can never be dead, but it can make + subsequent stores redundant if they store 0 into + the same memory locations. */ + case BUILT_IN_CALLOC: + { + tree nelem = gimple_call_arg (stmt, 0); + tree selem = gimple_call_arg (stmt, 1); + tree lhs; + if (TREE_CODE (nelem) == INTEGER_CST + && TREE_CODE (selem) == INTEGER_CST + && (lhs = gimple_call_lhs (stmt)) != NULL_TREE) + { + tree size = fold_build2 (MULT_EXPR, TREE_TYPE (nelem), + nelem, selem); + ao_ref_init_from_ptr_and_size (write, lhs, size); + return true; + } + } - default: - break; + default: + break; } } else if (is_gimple_assign (stmt)) @@ -964,57 +964,58 @@ dse_dom_walker::dse_optimize_stmt (gimple_stmt_iterator *gsi) tree fndecl = gimple_call_fndecl (stmt); switch (DECL_FUNCTION_CODE (fndecl)) { - case BUILT_IN_MEMCPY: - case BUILT_IN_MEMMOVE: - case BUILT_IN_MEMSET: - case BUILT_IN_MEMCPY_CHK: - case BUILT_IN_MEMMOVE_CHK: - case BUILT_IN_MEMSET_CHK: - { - /* Occasionally calls with an explicit length of zero - show up in the IL. It's pointless to do analysis - on them, they're trivially dead. */ - tree size = gimple_call_arg (stmt, 2); - if (integer_zerop (size)) - { - delete_dead_or_redundant_call (gsi, "dead"); - return; - } - - /* If this is a memset call that initializes an object - to zero, it may be redundant with an earlier memset - or empty CONSTRUCTOR of a larger object. */ - if ((DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET - || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET_CHK) - && integer_zerop (gimple_call_arg (stmt, 1))) - dse_optimize_redundant_stores (stmt); - - enum dse_store_status store_status; - m_byte_tracking_enabled - = setup_live_bytes_from_ref (&ref, m_live_bytes); - store_status = dse_classify_store (&ref, stmt, - m_byte_tracking_enabled, - m_live_bytes); - if (store_status == DSE_STORE_LIVE) - return; - - if (store_status == DSE_STORE_MAYBE_PARTIAL_DEAD) - { - maybe_trim_memstar_call (&ref, m_live_bytes, stmt); - return; - } - - if (store_status == DSE_STORE_DEAD) + case BUILT_IN_MEMCPY: + case BUILT_IN_MEMMOVE: + case BUILT_IN_MEMSET: + case BUILT_IN_MEMCPY_CHK: + case BUILT_IN_MEMMOVE_CHK: + case BUILT_IN_MEMSET_CHK: + { + /* Occasionally calls with an explicit length of zero + show up in the IL. It's pointless to do analysis + on them, they're trivially dead. */ + tree size = gimple_call_arg (stmt, 2); + if (integer_zerop (size)) + { delete_dead_or_redundant_call (gsi, "dead"); + return; + } + + /* If this is a memset call that initializes an object + to zero, it may be redundant with an earlier memset + or empty CONSTRUCTOR of a larger object. */ + if ((DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET + || DECL_FUNCTION_CODE (fndecl) == BUILT_IN_MEMSET_CHK) + && integer_zerop (gimple_call_arg (stmt, 1))) + dse_optimize_redundant_stores (stmt); + + enum dse_store_status store_status; + m_byte_tracking_enabled + = setup_live_bytes_from_ref (&ref, m_live_bytes); + store_status = dse_classify_store (&ref, stmt, + m_byte_tracking_enabled, + m_live_bytes); + if (store_status == DSE_STORE_LIVE) return; - } - case BUILT_IN_CALLOC: - /* We already know the arguments are integer constants. */ - dse_optimize_redundant_stores (stmt); + if (store_status == DSE_STORE_MAYBE_PARTIAL_DEAD) + { + maybe_trim_memstar_call (&ref, m_live_bytes, stmt); + return; + } - default: + if (store_status == DSE_STORE_DEAD) + delete_dead_or_redundant_call (gsi, "dead"); return; + } + + case BUILT_IN_CALLOC: + /* We already know the arguments are integer constants. */ + dse_optimize_redundant_stores (stmt); + return; + + default: + return; } }