From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17815 invoked by alias); 9 Dec 2016 12:55:08 -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 17780 invoked by uid 89); 9 Dec 2016 12:55:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1485 X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 09 Dec 2016 12:54:57 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6A4F2707; Fri, 9 Dec 2016 04:54:56 -0800 (PST) Received: from localhost (e105548-lin.manchester.arm.com [10.45.32.67]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 17B2F3F477 for ; Fri, 9 Dec 2016 04:54:55 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [5/67] Small tweak to array_value_type References: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> Date: Fri, 09 Dec 2016 12:55:00 -0000 In-Reply-To: <87h96dp8u6.fsf@e105548-lin.cambridge.arm.com> (Richard Sandiford's message of "Fri, 09 Dec 2016 12:48:01 +0000") Message-ID: <87vautnty9.fsf@e105548-lin.cambridge.arm.com> User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-12/txt/msg00772.txt.bz2 Store the type mode in a variable so that a later, more mechanical patch can change its type. gcc/ 2016-11-24 Richard Sandiford Alan Hayward David Sherwood * tree-switch-conversion.c (array_value_type): Only read TYPE_MODE once. Use get_narrowest_mode instead of GET_CLASS_NARROWEST_MODE. diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index b063c46..8b64f4b 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -945,15 +945,15 @@ array_value_type (gswitch *swtch, tree type, int num, { unsigned int i, len = vec_safe_length (info->constructors[num]); constructor_elt *elt; - machine_mode mode; int sign = 0; tree smaller_type; if (!INTEGRAL_TYPE_P (type)) return type; - mode = GET_CLASS_NARROWEST_MODE (GET_MODE_CLASS (TYPE_MODE (type))); - if (GET_MODE_SIZE (TYPE_MODE (type)) <= GET_MODE_SIZE (mode)) + machine_mode type_mode = TYPE_MODE (type); + machine_mode mode = get_narrowest_mode (type_mode); + if (GET_MODE_SIZE (type_mode) <= GET_MODE_SIZE (mode)) return type; if (len < (optimize_bb_for_size_p (gimple_bb (swtch)) ? 2 : 32)) @@ -991,7 +991,7 @@ array_value_type (gswitch *swtch, tree type, int num, mode = GET_MODE_WIDER_MODE (mode); if (mode == VOIDmode - || GET_MODE_SIZE (mode) >= GET_MODE_SIZE (TYPE_MODE (type))) + || GET_MODE_SIZE (mode) >= GET_MODE_SIZE (type_mode)) return type; } }