From patchwork Wed Jan 2 23:59:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1020116 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-493306-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="NrM9xqVl"; 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 43VShv737Qz9s4s for ; Thu, 3 Jan 2019 10:59:57 +1100 (AEDT) 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=q91g8j3PHo6LliQKM8AJn12CizU+NFCGuIspiiqBtQ7+z5vPBy 7BrJMqKkuO0XwFkNN5OF5g9wJb2AUjTSF9sRWmKPxSvZ8gBikO5eVqaT3w1B03qi t3fvyqZ7L19qQd3HGjhxnWtm3T6/SPjpACyNv6rkz/2bzpSM9QaVfoFFY= 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=gASRSyOJehgrgeXlG8r1mWbunzk=; b=NrM9xqVl+Kw9KnsiXifs qKqTf+ZGTthrfYsfpiUGV79gu8MccqlnyEwiFj7GXdkvzVYsKwsrTE9RCxgTX+Gt IM+5u/iRO+yRoTd4UiDJ/jOFZgM1gmtOFgH3068igoI5Bj6PSV6ZwJ6XQgNvacCN PhDzspbUEK34mkiz1pIvAzw= Received: (qmail 12849 invoked by alias); 2 Jan 2019 23:59:50 -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 12832 invoked by uid 89); 2 Jan 2019 23:59:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=pulled 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, 02 Jan 2019 23:59:46 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C4103793C4 for ; Wed, 2 Jan 2019 23:59:45 +0000 (UTC) Received: from localhost.localdomain (ovpn-112-2.rdu2.redhat.com [10.10.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTP id 00402600C4 for ; Wed, 2 Jan 2019 23:59:44 +0000 (UTC) To: gcc-patches From: Jeff Law Subject: [committed] Drop SRK_LENRANGE_2 scaffolding Openpgp: preference=signencrypt Message-ID: <3e417cee-a6c0-6b93-0477-4af4668a66f6@redhat.com> Date: Wed, 2 Jan 2019 16:59:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 X-IsSubscribed: yes This removes SRK_LENRANGE_2 which was used temporarily as I pulled apart different parts of the API changes for get_range_strlen. As of a couple patches ago, it's no longer needed. Bootstrapped and regression tested on x86_64-linux-gnu. Installing on the trunk. jeff commit 54a7a5e3a7b392f05c72a292e778099e5c023c35 Author: Jeff Law Date: Tue Jan 1 22:17:44 2019 -0500 * gimple-fold.c (strlen_range_kind): Remove SRK_LENRANGE_2. (get_range_strlen_tree): Update appropriately. (get_range_strlen) * gimple-fold.h (get_range_strlen): Drop unused last argument. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b4e2f25a2cc..634de2b0d18 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,10 @@ 2019-01-02 Martin Sebor Jeff Law + * gimple-fold.c (strlen_range_kind): Remove SRK_LENRANGE_2. + (get_range_strlen_tree): Update appropriately. + (get_range_strlen) + * gimple-fold.h (get_range_strlen): Drop unused last argument. * gimple-fold.c (gimple_fold_builtin_strlen): Use set_strlen_range rather than set_range_info. diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 0bb4db5e160..529149acda3 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -77,8 +77,6 @@ enum strlen_range_kind { or element of. Also determine the size of the largest character array the string may refer to. */ SRK_LENRANGE, - /* Temporary until the rest of Martin's strlen range work is integrated. */ - SRK_LENRANGE_2, /* Determine the integer value of the argument (not string length). */ SRK_INT_VALUE }; @@ -1309,7 +1307,7 @@ get_range_strlen_tree (tree arg, bitmap *visited, strlen_range_kind rkind, pdata, eltsize); } else if (TREE_CODE (TREE_OPERAND (op, 0)) == COMPONENT_REF - && (rkind == SRK_LENRANGE || rkind == SRK_LENRANGE_2)) + && rkind == SRK_LENRANGE) { /* Fail if an array is the last member of a struct object since it could be treated as a (fake) flexible array @@ -1349,7 +1347,7 @@ get_range_strlen_tree (tree arg, bitmap *visited, strlen_range_kind rkind, } } - if (!val && (rkind == SRK_LENRANGE || rkind == SRK_LENRANGE_2)) + if (!val && rkind == SRK_LENRANGE) { if (TREE_CODE (arg) == ADDR_EXPR) return get_range_strlen (TREE_OPERAND (arg, 0), visited, rkind, @@ -1484,7 +1482,7 @@ get_range_strlen_tree (tree arg, bitmap *visited, strlen_range_kind rkind, on the length of the string based on the referenced object's or subobject's type. Determine the conservative upper bound based on the enclosing object's size if possible. */ - if (rkind == SRK_LENRANGE || rkind == SRK_LENRANGE_2) + if (rkind == SRK_LENRANGE) { poly_int64 offset; tree base = get_addr_base_and_unit_offset (arg, &offset); @@ -1538,7 +1536,7 @@ get_range_strlen_tree (tree arg, bitmap *visited, strlen_range_kind rkind, } pdata->maxlen = val; - return rkind == SRK_LENRANGE || rkind == SRK_LENRANGE_2 || !integer_all_onesp (val); + return rkind == SRK_LENRANGE || !integer_all_onesp (val); } /* For an ARG referencing one or more strings, try to obtain the range @@ -1600,7 +1598,7 @@ get_range_strlen (tree arg, bitmap *visited, for (unsigned int i = 0; i < 2; i++) if (!get_range_strlen (ops[i], visited, rkind, pdata, eltsize)) { - if (rkind != SRK_LENRANGE_2) + if (rkind != SRK_LENRANGE) return false; /* Set the upper bound to the maximum to prevent it from being adjusted in the next iteration but @@ -1634,7 +1632,7 @@ get_range_strlen (tree arg, bitmap *visited, if (!get_range_strlen (arg, visited, rkind, pdata, eltsize)) { - if (rkind != SRK_LENRANGE_2) + if (rkind != SRK_LENRANGE) return false; /* Set the upper bound to the maximum to prevent it from being adjusted in the next iteration but @@ -1680,12 +1678,11 @@ get_range_strlen (tree arg, bitmap *visited, 4 for wide characer strings. ELTSIZE is by default 1. */ bool -get_range_strlen (tree arg, c_strlen_data *pdata, unsigned eltsize, bool strict) +get_range_strlen (tree arg, c_strlen_data *pdata, unsigned eltsize) { bitmap visited = NULL; - if (!get_range_strlen (arg, &visited, strict ? SRK_LENRANGE : SRK_LENRANGE_2, - pdata, eltsize)) + if (!get_range_strlen (arg, &visited, SRK_LENRANGE, pdata, eltsize)) { /* On failure extend the length range to an impossible maximum (a valid MAXLEN must be less than PTRDIFF_MAX - 1). Other diff --git a/gcc/gimple-fold.h b/gcc/gimple-fold.h index 35f1ba26953..673d484ff52 100644 --- a/gcc/gimple-fold.h +++ b/gcc/gimple-fold.h @@ -26,7 +26,7 @@ extern tree create_tmp_reg_or_ssa_name (tree, gimple *stmt = NULL); extern tree canonicalize_constructor_val (tree, tree); extern tree get_symbol_constant_value (tree); struct c_strlen_data; -extern bool get_range_strlen (tree, c_strlen_data *, unsigned eltsize, bool = false); +extern bool get_range_strlen (tree, c_strlen_data *, unsigned eltsize); extern void gimplify_and_update_call_from_tree (gimple_stmt_iterator *, tree); extern bool fold_stmt (gimple_stmt_iterator *); extern bool fold_stmt (gimple_stmt_iterator *, tree (*) (tree));