From patchwork Fri Nov 29 13:38:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederik Harwath X-Patchwork-Id: 1202477 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-514862-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="kVY0Zw4r"; 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 47PbFY4gMSz9sPj for ; Sat, 30 Nov 2019 00:38:55 +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 :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; q=dns; s= default; b=JBMggvhSnVUOrIjZ/VM2EKGPwxe122PSotPFtj29pDUO/N42KBL7V cqq6XY5VZcpmEWnCMQ3xswZY5uhFVzjNxoW6fzXVn99fbngyYDtd/LhAbg4fm4d1 Z09aswYXBM+AGCLkDsbNQynASgtbxBcE7xhvIZ9Y5VNsN6t93K7FXw= 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 :subject:from:to:cc:references:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=default; bh=/zV7hrIU0xdpIFuqEdaA4MPNgUk=; b=kVY0Zw4rsvbv8xP66WXQgNyQR4SO iILStp4wqJwa9KK5yJAcFnUtG7/I0OzqNPR2FAZhN1i/+nXomGvWSSoK1TbY67Bo kwC7G2tP1sf4Sb9yBRueNvGmReM3Ob1ukjZUXOPOJObl+LX8xhJW5LPwMGLZtUzl qpijioI9ZtWdAJY= Received: (qmail 106085 invoked by alias); 29 Nov 2019 13:38:48 -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 105705 invoked by uid 89); 29 Nov 2019 13:38:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-19.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=essential, H*MI:sk:15f42d1, H*i:sk:15f42d1, H*f:sk:15f42d1 X-HELO: esa1.mentor.iphmx.com Received: from esa1.mentor.iphmx.com (HELO esa1.mentor.iphmx.com) (68.232.129.153) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 29 Nov 2019 13:38:47 +0000 IronPort-SDR: CnsfviKgjSqe6ApGkGdmos6PH0S1HY3dedkVt7vEFm9KtYJBJlBap6DbZmFKFo0EqC9WoXqAOP 0viPSllIQ9oyWMz30fbuzv+gsLzxcCrAaEHl/F9+XoU1nYWaq78ZZC/UourWkoOeLL7LRnKqFR E+kcnDdorHtFHRZ+IgcYTJ854PzWFtZsdrwIuuYKDyMDSKl3Wmi955DJN1BDKcrJ2KqA6ZydFY i7QzEroMzLU0cSe3Hycri9fmAm/ygxrEmmR8cjMlhrm552+nkzOxfIdcnfr4UO5V19OcHHhLF3 Y70= Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 29 Nov 2019 05:38:45 -0800 IronPort-SDR: X4nTPZUbFcyH2xwHlYEBpVTnB2rVbmjNMghv3IwocZ+LFqMryEZwQUinAMYCWuuuCPzWsd6sFL pEYTFYm1Zw/Gv4PwW5+0yHWOD4CtOb4uH6XlLqhhllH+h0D3ohQO4+M9BcqdQInhOBvOiIoHS+ durCg7//crgUKunSciQ64/ka8DRW2Yu7bjtv8V144emD3oQzJMzsEwMBOC/GqXT77qwbj9yImh EW6DrLlfVvyAXwysiKQA2cChLXb7CYE8dNvuM6lRE81dy6mMsWwtRF+YqxzgCBX1w21Z4aiSgp TS4= Subject: [PATCH] Fix ICE in re-simplification of VEC_COND_EXPR (was: Re: [PATCH][amdgcn] Fix ICE in re-simplification of VEC_COND_EXPR) From: "Harwath, Frederik" To: Richard Biener , Richard Sandiford CC: Ilya Leoshkevich , Jakub Jelinek , GCC Patches , "Stubbs, Andrew" , References: <643ae1a0-ffa2-2004-d186-736c81c6a0d7@codesourcery.com> <15f42d15-a39e-c221-d041-acb9928ed3ac@codesourcery.com> X-Pep-Version: 2.0 Message-ID: <73fbd025-06d0-0641-00e2-a47bd8879e6a@codesourcery.com> Date: Fri, 29 Nov 2019 14:38:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <15f42d15-a39e-c221-d041-acb9928ed3ac@codesourcery.com> X-IsSubscribed: yes Hi, On 29.11.19 13:51, Harwath, Frederik wrote: >> condition for the inner vec_cond. Your fix looks reasonable but is >> very badly formatted. Can you instead do I hope the formatting looks better now. I have also removed the [amdgcn] from the subject line since the fact that this has been discovered in the context of amdgcn is not really essential. Best regards, Frederik 2019-11-29 Frederik Harwath gcc/ * gimple-match-head.c (maybe_resimplify_conditional_op): use generic_expr_could_trap_p to check if the condition of COND_EXPR or VEC_COND_EXPR can trap. --- gcc/gimple-match-head.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c index 2996bade301..c763a80a6d1 100644 --- a/gcc/gimple-match-head.c +++ b/gcc/gimple-match-head.c @@ -144,9 +144,21 @@ maybe_resimplify_conditional_op (gimple_seq *seq, gimple_match_op *res_op, /* Likewise if the operation would not trap. */ bool honor_trapv = (INTEGRAL_TYPE_P (res_op->type) && TYPE_OVERFLOW_TRAPS (res_op->type)); - if (!operation_could_trap_p ((tree_code) res_op->code, - FLOAT_TYPE_P (res_op->type), - honor_trapv, res_op->op_or_null (1))) + tree_code op_code = (tree_code) res_op->code; + bool op_could_trap; + + /* COND_EXPR and VEC_COND_EXPR will trap if, and only if, the condition + traps and hence we have to check this. For all other operations, we + don't need to consider the operands. */ + if (op_code == COND_EXPR || op_code == VEC_COND_EXPR) + op_could_trap = generic_expr_could_trap_p (res_op->ops[0]); + else + op_could_trap = operation_could_trap_p ((tree_code) res_op->code, + FLOAT_TYPE_P (res_op->type), + honor_trapv, + res_op->op_or_null (1)); + + if (!op_could_trap) { res_op->cond.cond = NULL_TREE; return false;