From patchwork Fri Jan 12 13:33:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 859923 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-470980-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Y98Aly2c"; 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 3zJ3bh5bQRz9s9Y for ; Sat, 13 Jan 2018 00:33:20 +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:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=GxYa2AIPbjOI75Pt JiZgolWatruLDR4uqqLA5K/pi2rFZ4zDcsEqcJByr5H5Ul1MOClos7ytRlMphsH7 +Akj2j2bt8WINWyoFTmRnVK//kOwoN/YF2B3jbPm7AdCE1iwlIjRalFMXAT3K45D xySRU8vknRcPqgYPhrlx09pcfDg= 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:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=+IfFPIqTdKkSONFNYlAVda pPURY=; b=Y98Aly2cX2m7grS3dCSFwOvR6U/+54xfM10Nd8MNUu/ZvdbrGcB+F7 HnumGIgsOaISAnGM3l/WAutM/MpBv6XXeFzUteHIcCD+cntcbMNzJJnubhaZSwbp wSI2Nn4ulcOvLh1Y0pzli7YH7TQw2hY7bwURUezIVCN2i2+7P5adI= Received: (qmail 107576 invoked by alias); 12 Jan 2018 13:33:13 -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 107535 invoked by uid 89); 12 Jan 2018 13:33:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:87po6f1, Hx-languages-length:1676, H*i:sk:87po6f1 X-HELO: mail-wr0-f169.google.com Received: from mail-wr0-f169.google.com (HELO mail-wr0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Jan 2018 13:33:11 +0000 Received: by mail-wr0-f169.google.com with SMTP id 36so5349168wrh.1 for ; Fri, 12 Jan 2018 05:33:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:cc:subject:references :date:in-reply-to:message-id:user-agent:mime-version; bh=JHlszLDBe/at65M6qUuBmnsry1hflB1bM1azqIYiydo=; b=KUKVzDM0FVP9M9n9DKb9KoHSaPfq/1XAGe/RhVAE6tz9gPp//TMHIRwoifa+7K0GUs ft8TIXonC42FpR23r9SaEcLFQO5d+N8WJ54lQ/RTF6BRDD6HBQcDHel3ca+lYm64ViQN T5k0pOwDMmg+V0P/DjpPSuPDxK1OhvvDdoF+FijWYa1Ql7Dgejzkcv32nPJvSZe6VKy1 ORx/rZglXT4akwfOJJmUYfJRg7dU2uNkDJNMCMo11Cgxsv99Im0rmq7GSQy1ZTjMIZE4 LsHFK00vC0Oh+ArJxVvoZsSb4563SzO8GKOyp1/ayeBEdsKPF+7RhWzrwJOLIaGOmEeB adkg== X-Gm-Message-State: AKwxytcKN6Pa2X6UhTAzM317DVX5HVWS/b4wXGV8WolIpyb545etDpBv KbpvJMQ+N0IQzpUAULVdETRaPaeDx7w= X-Google-Smtp-Source: ACJfBos4eKiitTyDxoojeXue8jkh2Up/nHgYwFB4JfGXGrfNNcsJ7BJ3YrBAOz7ezeikGuHcO+HdsA== X-Received: by 10.223.156.198 with SMTP id h6mr640590wre.281.1515763989005; Fri, 12 Jan 2018 05:33:09 -0800 (PST) Received: from localhost ([95.144.14.233]) by smtp.gmail.com with ESMTPSA id s20sm2701406wma.45.2018.01.12.05.33.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Jan 2018 05:33:08 -0800 (PST) From: Richard Sandiford To: Jeff Law Mail-Followup-To: Jeff Law , gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Cc: gcc-patches@gcc.gnu.org Subject: Allow variable-sized temporary variables in gimplify.c References: <87r2qyc1ww.fsf@linaro.org> <87y3l31se3.fsf@linaro.org> <87po6f19w2.fsf@linaro.org> Date: Fri, 12 Jan 2018 13:33:07 +0000 In-Reply-To: <87po6f19w2.fsf@linaro.org> (Richard Sandiford's message of "Fri, 12 Jan 2018 13:31:25 +0000") Message-ID: <87lgh319t8.fsf_-_@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 This is needed to build libgfortran for SVE. The OpenMP code needs to create temporary vector variables, and the variables will therefore be variable-sized for SVE. Earlier patches made such variables work. Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu. Also tested by comparing the before-and-after assembly output for at least one target per CPU directory. OK to install? Thanks, Richard 2018-01-12 Richard Sandiford gcc/ * gimplify.c (gimple_add_tmp_var_fn): Allow variables to have a poly_uint64 size, rather than requiring an unsigned HOST_WIDE_INT size. (gimple_add_tmp_var): Likewise. Index: gcc/gimplify.c =================================================================== --- gcc/gimplify.c 2018-01-10 08:43:40.053367209 +0000 +++ gcc/gimplify.c 2018-01-12 12:49:36.756892670 +0000 @@ -702,7 +702,7 @@ gimple_add_tmp_var_fn (struct function * /* Later processing assumes that the object size is constant, which might not be true at this point. Force the use of a constant upper bound in this case. */ - if (!tree_fits_uhwi_p (DECL_SIZE_UNIT (tmp))) + if (!tree_fits_poly_uint64_p (DECL_SIZE_UNIT (tmp))) force_constant_size (tmp); DECL_CONTEXT (tmp) = fn->decl; @@ -721,7 +721,7 @@ gimple_add_tmp_var (tree tmp) /* Later processing assumes that the object size is constant, which might not be true at this point. Force the use of a constant upper bound in this case. */ - if (!tree_fits_uhwi_p (DECL_SIZE_UNIT (tmp))) + if (!tree_fits_poly_uint64_p (DECL_SIZE_UNIT (tmp))) force_constant_size (tmp); DECL_CONTEXT (tmp) = current_function_decl;