From patchwork Thu Oct 17 06:54:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1178324 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-511174-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="ZB8DBXq5"; 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 46v0KJ6mBsz9sNw for ; Thu, 17 Oct 2019 17:54:58 +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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=iLH8h1moln+GUsMJH33euRBkt0pI/ 5jNj000VUi9zTfFu/0v6Ns5VZVGG5IBZnLyvX/fh62c6wQYNMn/r/NvUrHA9/3Ev 6ikNvxFPrZsQ1AVd8lo4mxZssNlDYgtb1jCYXoJbM+A0BlVUijIV6/WTFFJb4OfR BtoextpfLyAkV4= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=TCvEDBqPlE724Zh1fgey+nt+l24=; b=ZB8 DBXq5K1mFtMYTE8xkBG12CAlgJAqLQLvKrk8W0/LWH4ml070OiwkDYVcRrm4XNHK wp7n9q5a0D7gS39qP3A7b9ovFnZWZLaMVK35LTyOEZICTv2WF/bF37vsc1ID3BoL qXeXBIThbTLVvxThwF1G7YZrLxmShW5CzTXQVexw= Received: (qmail 17648 invoked by alias); 17 Oct 2019 06:54:51 -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 17638 invoked by uid 89); 17 Oct 2019 06:54:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= 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; Thu, 17 Oct 2019 06:54:50 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F51930821BF; Thu, 17 Oct 2019 06:54:49 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.36.118.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 18F1A60852; Thu, 17 Oct 2019 06:54:48 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x9H6slOO006561; Thu, 17 Oct 2019 08:54:47 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x9H6sjuR006560; Thu, 17 Oct 2019 08:54:45 +0200 Date: Thu, 17 Oct 2019 08:54:45 +0200 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix ifcombine ICE (PR tree-optimization/92115) Message-ID: <20191017065445.GU2116@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.11.3 (2019-02-01) X-IsSubscribed: yes Hi! The following testcase ICEs, because ifcombine_ifandif attempts to set GIMPLE_COND condition to a condition that might trap (which is allowed only in COND_EXPR/VEC_COND_EXPR). Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2019-10-17 Jakub Jelinek PR tree-optimization/92115 * tree-ssa-ifcombine.c (ifcombine_ifandif): Force condition into temporary if it could trap. * gcc.dg/pr92115.c: New test. Jakub --- gcc/tree-ssa-ifcombine.c.jj 2019-09-20 12:25:42.232479343 +0200 +++ gcc/tree-ssa-ifcombine.c 2019-10-16 10:05:06.826174814 +0200 @@ -599,6 +599,12 @@ ifcombine_ifandif (basic_block inner_con t = canonicalize_cond_expr_cond (t); if (!t) return false; + if (!is_gimple_condexpr_for_cond (t)) + { + gsi = gsi_for_stmt (inner_cond); + t = force_gimple_operand_gsi_1 (&gsi, t, is_gimple_condexpr_for_cond, + NULL, true, GSI_SAME_STMT); + } gimple_cond_set_condition_from_tree (inner_cond, t); update_stmt (inner_cond); --- gcc/testsuite/gcc.dg/pr92115.c.jj 2019-10-16 10:07:35.923924633 +0200 +++ gcc/testsuite/gcc.dg/pr92115.c 2019-10-16 10:06:56.831514691 +0200 @@ -0,0 +1,10 @@ +/* PR tree-optimization/92115 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fexceptions -ffinite-math-only -fnon-call-exceptions -fsignaling-nans -fno-signed-zeros" } */ + +void +foo (double x) +{ + if (x == 0.0 && !__builtin_signbit (x)) + __builtin_abort (); +}