From patchwork Tue Oct 25 08:48:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 10592 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp884956wru; Tue, 25 Oct 2022 01:49:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM41SrMqzn3C/SfzKCLWDcCqQEsyqXrgu1j8kTu42AiJXiHkl0K+gPC4ZrS2iAUBFyWxHn5k X-Received: by 2002:a17:907:97c3:b0:79b:3f8d:a354 with SMTP id js3-20020a17090797c300b0079b3f8da354mr18376172ejc.461.1666687765993; Tue, 25 Oct 2022 01:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666687765; cv=none; d=google.com; s=arc-20160816; b=ODr26h6LwyIOpMSeR/O65LHjLlzxvrRjXLWkBPDJu0Fx4EokKz44Cc5dQH8/SV4L17 pxsZ/AeQYnzgcUlA2GGvMQzt4XBLKjBngbnJpkNymXQGYRqmgMNcoS1Fi789RZUO+cVM TNFAskRHqGEsTcixQsJJsLxHuHM/RvlJN9974jXlyEoOzQrJXNXob4B428ppdt6ewiIZ AOZTsNoFrdZNhvj7EPRUiGuu11NCus38UVZJ5GsaBfe7tjnHJBiP8bK75WlcnXxyvCSj Iiur28jbtolR5AkQwZZFmT0YBedgNcZ50fgUx59pxSX/MB1R74xnj1+Vo6s5xvmSh4jC NNrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=V38379fxoznkBmm79UGxMrwEblS6IV//kG2nIM4orDs=; b=E7CLj3XSGrvky2IWkvBIuYhlyHjQBWPdEbxmhMxXGCM2Kuy/qInIfp6qXdpA6dLwyy Po9GE3fniU8Qz6lwMzObIzyS3mbuMfOoc8OtR/K8HwwKzusl4ko6WTji6Oh1Jq9KXRl7 bGq33//yd4YS1w7oSZOy8dfRYgkVH5jxxykgs8fCcC5texcz3bNrP03tc7ZS4mDPQXFj Jde24Cq3MlIGYogxFCOq5obOOhhjaANkJiP4ggAcPgWmFava8HRLXV+AZi1mhxS30A6Z 8/c7y2zllgTLGs+ZeNDfXImgauCjUIcqhoR312+szcSlwkaZbNFpF0X4c4/VSFWwj+1e iaSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ronYtbLv; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id nc3-20020a1709071c0300b0073da4a0f01csi2474860ejc.743.2022.10.25.01.49.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Oct 2022 01:49:25 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ronYtbLv; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A5F43857BAE for ; Tue, 25 Oct 2022 08:49:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A5F43857BAE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666687764; bh=V38379fxoznkBmm79UGxMrwEblS6IV//kG2nIM4orDs=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ronYtbLvGf3wL2vUkn6re2zNBEPdcyLO8X6mlWcS/PAhHg2IOsCL6eqcKVFQpOv6b wzsTNTVfRQyX7VbVkp9WxGH9pSki+nR+JnZ+yS7Nypw0AJJ/K8dTUIf2NI7dx714Wr D8JbQAGwWoY/9j3W5dQMfRu4NTj+GgBICKOQ31R0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 759943858029 for ; Tue, 25 Oct 2022 08:48:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 759943858029 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-657-xdAfPNDFMhy_MpRybx43ZA-1; Tue, 25 Oct 2022 04:48:25 -0400 X-MC-Unique: xdAfPNDFMhy_MpRybx43ZA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DD198185A7AC for ; Tue, 25 Oct 2022 08:48:24 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.193.252]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 958C140C2064 for ; Tue, 25 Oct 2022 08:48:24 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 29P8mMgm710776 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Tue, 25 Oct 2022 10:48:22 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 29P8mLur710775 for gcc-patches@gcc.gnu.org; Tue, 25 Oct 2022 10:48:21 +0200 Date: Tue, 25 Oct 2022 10:48:21 +0200 To: gcc-patches@gcc.gnu.org Subject: [committed] gimplify: Call gimple_boolify on IFN_ASSUME argument [PR107368] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jakub Jelinek via Gcc-patches From: Jakub Jelinek Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747648790646306052?= X-GMAIL-MSGID: =?utf-8?q?1747648790646306052?= Hi! The following testcase ICEs in C, because assume attribute condition has int type rather than bool and the gimplification into GIMPLE_ASSUME assigns it into a bool variable. Fixed by calling gimple_boolify. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2022-10-25 Jakub Jelinek PR tree-optimization/107368 * gimplify.cc (gimplify_call_expr): For complex IFN_ASSUME conditions call gimple_boolify on the condition. * gcc.dg/attr-assume-5.c: New test. Jakub --- gcc/gimplify.cc.jj 2022-10-24 10:22:08.590902730 +0200 +++ gcc/gimplify.cc 2022-10-24 11:01:54.121339779 +0200 @@ -3586,7 +3586,7 @@ gimplify_call_expr (tree *expr_p, gimple a separate function easily. */ tree guard = create_tmp_var (boolean_type_node); *expr_p = build2 (MODIFY_EXPR, void_type_node, guard, - CALL_EXPR_ARG (*expr_p, 0)); + gimple_boolify (CALL_EXPR_ARG (*expr_p, 0))); *expr_p = build3 (BIND_EXPR, void_type_node, NULL, *expr_p, NULL); push_gimplify_context (); gimple_seq body = NULL; --- gcc/testsuite/gcc.dg/attr-assume-5.c.jj 2022-10-24 11:13:47.169624469 +0200 +++ gcc/testsuite/gcc.dg/attr-assume-5.c 2022-10-24 11:16:11.137662896 +0200 @@ -0,0 +1,10 @@ +/* PR tree-optimization/107368 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +double +f4 (double x) +{ + [[gnu::assume (x && x > 0.0)]]; + return x; +}