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: 1694286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=b/CYBoBe; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MxQbL1F6Nz23kR for ; Tue, 25 Oct 2022 19:49:01 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BF2143857C58 for ; Tue, 25 Oct 2022 08:48:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF2143857C58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666687739; bh=V38379fxoznkBmm79UGxMrwEblS6IV//kG2nIM4orDs=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=b/CYBoBeN3JbscSDIJHWHwthy9wixehpywqCHIEAemicLs1WBajzxdeZN9OVOFA/D 6O541KO31LiA+bAVml1+nvbBiVnYtHQshKLcq3TMtK5zkAS5lOKKnmUOfyTzGCnc0b Bc/+L1Fe8r5rYIhFP9JgR4p9NkfnvQKxTFp2+lIM= 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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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; +}