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 147DF3858D32 for ; Mon, 18 Sep 2023 09:08:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 147DF3858D32 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=1695028115; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=2bnWxFFT6iNjKQReeede3pkUf5Z4UUO2XoLoUzxMcsI=; b=Hdihh3JVDzkfPQHTxui1rmvnNeCVxEgS+ZNjOm0b/Bsj4h6w4qD+AYdTnm6081KrcgHvBF An5bM53qailkWwb/9zeSbYvdxh2E7cNpjCbWkkV+ZIvWn4z/EmWln8bjuN4iA+gJKfXmxT MKcf033hyDy9NcpPjQXzuMpQHIBv8qg= 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-369-gNI-2q4zNbWJL80F6aTDfg-1; Mon, 18 Sep 2023 05:08:31 -0400 X-MC-Unique: gNI-2q4zNbWJL80F6aTDfg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0F30985A5A8; Mon, 18 Sep 2023 09:08:31 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C718E492B05; Mon, 18 Sep 2023 09:08:30 +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 38I98T9P011777 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 18 Sep 2023 11:08:29 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 38I98Tlm011776; Mon, 18 Sep 2023 11:08:29 +0200 Date: Mon, 18 Sep 2023 11:08:28 +0200 From: Jakub Jelinek To: Richard Biener , Andrew Pinski Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] MATCH: Make zero_one_valued_p non-recusive fully Message-ID: Reply-To: Jakub Jelinek References: <20230917214055.1752964-1-apinski@marvell.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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=-9.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,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: On Mon, Sep 18, 2023 at 11:04:16AM +0200, Richard Biener via Gcc-patches wrote: > > Note genmatch should warn (or error out) if this gets detected so I filed PR 111446 > > which I will be looking into next week or the week after so we don't run into > > this issue again. > > > > PR tree-optimization/111442 > > > > gcc/ChangeLog: > > > > * match.pd (zero_one_valued_p): Have the bit_and match not be > > recusive. s/recusive/recursive/g s/recusion/recursion/g > > diff --git a/gcc/match.pd b/gcc/match.pd > > index 887665633d4..773c3810f51 100644 > > --- a/gcc/match.pd > > +++ b/gcc/match.pd > > @@ -2183,8 +2183,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) > > > > /* (a&1) is always [0,1] too. This is useful again when > > the range is not known. */ > > +/* Note this can't be recusive due to VN handling of equivalents, > > + VN and would cause an infinite recusion. */ > > (match zero_one_valued_p > > - (bit_and:c@0 @1 zero_one_valued_p)) > > + (bit_and:c@0 @1 integer_onep) > > + (if (INTEGRAL_TYPE_P (type)))) > > > > /* A conversion from an zero_one_valued_p is still a [0,1]. > > This is useful when the range of a variable is not known */ > > diff --git a/gcc/testsuite/gcc.c-torture/compile/pr111442-1.c b/gcc/testsuite/gcc.c-torture/compile/pr111442-1.c > > new file mode 100644 > > index 00000000000..5814ee938de > > --- /dev/null > > +++ b/gcc/testsuite/gcc.c-torture/compile/pr111442-1.c > > @@ -0,0 +1,13 @@ > > + > > +int *a, b; > > +int main() { > > + int d = 1, e; > > + if (d) > > + e = a ? 0 % 0 : 0; > > + if (d) > > + a = &d; > > + d = -1; > > + b = d & e; > > + b = 2 * e ^ 1; > > + return 0; > > +} > > -- > > 2.31.1 > > Jakub