From patchwork Thu Jan 4 10:02:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 123398 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp11231914qgn; Thu, 4 Jan 2018 02:02:23 -0800 (PST) X-Google-Smtp-Source: ACJfBotat2Oxb1+HUP5uAbbOzcB4FznOEg7ndX41Nda5bW2/DRt+JdsEHHt8bEH4Bjhjf6EFPKfo X-Received: by 10.99.171.11 with SMTP id p11mr3554446pgf.392.1515060143670; Thu, 04 Jan 2018 02:02:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515060143; cv=none; d=google.com; s=arc-20160816; b=RIfMX2FKD0Y+XkKlnb1daR8faqfcNb9gMBvyO+dE4jaw988w/7c84kJxnvEj/nc8hD 9hkmMZwYb9U02lIFFXnVNNWY0GN0fZ0V3t0+4nV/xD0oKdCO1HTbd8gwL1iGBYDOExcM cpuLFZM5Bk3Uol0yUagwc/KAuaQDALqsArL7mGZN6R5yyWF9i5IXKPr6GPsJH3D+7EDM QL6dm+nW3GHAwx1Vovih8lpY+D/Rz+VkOvuLXH0t6qFu+Qax9917lK2qC9YhknmU5WDv 3qrjZ9IdVmCq0DWv24xZ/wBIkU7h0yFWhaptgVg/6iytPgdjz84RFYmdv7T3Vko+Z20n Olog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:date:subject:mail-followup-to:to :from:delivered-to:sender:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:mailing-list:dkim-signature :domainkey-signature:arc-authentication-results; bh=1ekIW7oOJCSHxRRS0Y2jMKex1Hex8p7LCJ7yyXsu2gg=; b=xLKNMUHOUTdP51EWEmVwfEfj9Mb3/lKe0cFeJO21cRdP1+UqUAUhcY1iGPJiPIP13/ RmWBDTJnDxux3HpEVgTwE3eqtDHdikYXtFf9IMyMebqsO+ui+7JvOlqPc4x18pgw7fZA 6dYOvn0NhqyZpnwPHoluMVF+bp0juHj4DGIweB4enNCiOFtUW2IA51ysk4yGSsgjyKud AJca/E6Wv+qjBIcTCbhnDnsYk4mJVFUktySACOKmjASjlEr9bXtvWii0qLrOd3gERxlq MHv9ZOlnCX7EfU66PmlAQtucAx6egKWS7u9N5gd8O4keLZomktPAKJ7nlRMhOihdwqgt 9gKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=EflgMJ2N; spf=pass (google.com: domain of gcc-patches-return-470126-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470126-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id 37si2081718plq.120.2018.01.04.02.02.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Jan 2018 02:02:23 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-470126-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=EflgMJ2N; spf=pass (google.com: domain of gcc-patches-return-470126-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-470126-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=WgGLqe074a28M4da3Dfq42nbsLjUcbYmlxcvIj5wHEAdwtJj6/Ga5 2HUod7uZEmhyOI4z+uXAy3Ggq5S6W6soo+DXX8NZgJ2mLeVEKKd5/5lwEmS7nEBT EtV8aKtglSfvPGWynopp7FeKMqP4lr3rREqHG71WUKIei0dez7vY1M= 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:subject:date:message-id:mime-version:content-type; s= default; bh=MobZhh9UbqsuZYB5ousCX092EfE=; b=EflgMJ2NyP9B8Wfhk7T2 E/ZsxBBqEoRJmg6ogZWTUzsVm6F3Ohrks4rHzLvbDIsMQ5Hly3lWR4981PHFUDFR Inw5EcMOPxgObWloOPp+QJp1R08QwniZzSkpwVJTffr/gLtzt3hU1v6HlsXtTHuz LdNDIQAIqRzUkYGVVBhkvqE= Received: (qmail 61638 invoked by alias); 4 Jan 2018 10:02:07 -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 59501 invoked by uid 89); 4 Jan 2018 10:02:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.1 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= X-HELO: mail-wm0-f49.google.com Received: from mail-wm0-f49.google.com (HELO mail-wm0-f49.google.com) (74.125.82.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 04 Jan 2018 10:02:05 +0000 Received: by mail-wm0-f49.google.com with SMTP id a79so2391231wma.0 for ; Thu, 04 Jan 2018 02:02:04 -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:subject:date:message-id :user-agent:mime-version; bh=1ekIW7oOJCSHxRRS0Y2jMKex1Hex8p7LCJ7yyXsu2gg=; b=j6pWz7MQQl4i5U/+t4aGBcgJa0HEN02u+agABHNcPTXENZ/opJWFoBPiLuqzl3cuR8 uCmEEEZP2r6O60oGMLAfCOLCRj0O5q20jBmpVlgWUJVIo5QYyLM3JPlPtc6nbjp7avM3 VAqmKxP2Vl9fSHDJC/ZnbobqXx4R60pngeK8SJS2wPLGPz6mg9wXcfDVTgeiBt5DotS0 v5EfWKsfAJVkx6DEqB6xGmjblG83FkPjqAgp5+YLUQjFOEz0NJyloFOvoMr+4aoJnLF6 KlWNmcneRbQCsPKrATfiWW6+aEkyoHSaEFkAjUWF1FU8LiuOLeJaja/8HX2dNRfBGMU/ ENQg== X-Gm-Message-State: AKGB3mKfjpRlDXHQysgEHMbT8G9rB5q33UvefX11PmqXDh0I9etdnd6w lTrsFAMun3AxDJ56ucWdU07YkZ/YYgY= X-Received: by 10.28.7.133 with SMTP id 127mr3353812wmh.31.1515060122678; Thu, 04 Jan 2018 02:02:02 -0800 (PST) Received: from localhost ([95.144.14.233]) by smtp.gmail.com with ESMTPSA id m18sm3937504wmc.18.2018.01.04.02.02.01 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jan 2018 02:02:01 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Allow VEC_PERM_EXPR folding to fail Date: Thu, 04 Jan 2018 10:02:01 +0000 Message-ID: <87o9mahrhi.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 tree-ssa-forwprop.c was asserting that a VEC_PERM_EXPR fold on three VECTOR_CSTs would always succeed, but it's possible for it to fail with variable-length vectors. 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? Richard 2018-01-04 Richard Sandiford gcc/ * tree-ssa-forwprop.c (is_combined_permutation_identity): Allow the VEC_PERM_EXPR fold to fail. Index: gcc/tree-ssa-forwprop.c =================================================================== --- gcc/tree-ssa-forwprop.c 2018-01-03 21:42:44.571646705 +0000 +++ gcc/tree-ssa-forwprop.c 2018-01-04 10:00:03.582673530 +0000 @@ -1865,7 +1865,8 @@ is_combined_permutation_identity (tree m gcc_checking_assert (TREE_CODE (mask1) == VECTOR_CST && TREE_CODE (mask2) == VECTOR_CST); mask = fold_ternary (VEC_PERM_EXPR, TREE_TYPE (mask1), mask1, mask1, mask2); - gcc_assert (TREE_CODE (mask) == VECTOR_CST); + if (mask == NULL_TREE || TREE_CODE (mask) != VECTOR_CST) + return 0; if (!VECTOR_CST_NELTS (mask).is_constant (&nelts)) return 0;