From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666687707; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type; bh=V38379fxoznkBmm79UGxMrwEblS6IV//kG2nIM4orDs=; b=iemDyzEt7nB8BrmUpw80w5EWZbOP9QWh3KD0PEg89qj6cneSQp8xxE8KSSzPFjX4y5gMbR 5vcDqNh7o89NKlBCa6R4Ow2ipLNZxkHC4trFqImOhfoChOsxvXrks6xLEJt+nlaHciUAgE qUfbArTL9baBzQe8hs8Qaqoczii2YRo= 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 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] gimplify: Call gimple_boolify on IFN_ASSUME argument [PR107368] Message-ID: Reply-To: Jakub Jelinek 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-Type: text/plain; charset=us-ascii 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 List-Id: 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. --- 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; +} Jakub