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 87DC3384AB58 for ; Fri, 3 May 2024 19:17:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 87DC3384AB58 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 87DC3384AB58 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714763831; cv=none; b=TnUHesOBMMbrv5N4JRwjsVuYe8zXPF6/ecAgIKbLFW9gON5lqvFGCzu6oT6HgDtID+GzrNSBaEtowTcVSXSHyEaLuIv6Yd3ILICw9+2NLaSPbgp+cvYTxEu1uaoTGG32fUwIssVZDLfwsOnKDDpmXlMC7C8VwnTZnYNy4pmOFHk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714763831; c=relaxed/simple; bh=eoK5ITCH8eI7MiZqSqFXSh5RMgiDlBgt7HPIYdDZxRM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=VjL4UYOrBap41J8HlDJBdXJ9KzpWHkd9Qxfaealdp8df9Kt3Mqs1p50nX9p5TBYdO0J7d38vk59wZOHToDeVeJc3DbKyVUscISwSxxTgXT9lpM3St66vQtJdMtsog59nJE5VTjR4VHlxlczTX9GV9Yd5dip9EM9qvXmhjeBagfw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1714763829; 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=sYkDn1Gpm6pECsuVcfz/o/JRIqoBIRd2bLD2kpsX2fc=; b=eDbd4BTm54fPhKpoOeLXanwF4nFkC9TQXOiSKs+penlTYdOzjE0H7UULiUQ0fAKhKbWKbT X4vW0YJ9pxb4sMDS4ZdhQc0fXvIZYOgLWZAttBGLNcwZgFbtUk1ao8fPKXjF28AoWvzBG0 2188gZp+w5ywjrPY68jyazA5ar/mkW8= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-1-GtOXtwj-NjOuYcGlwMRVNA-1; Fri, 03 May 2024 15:17:06 -0400 X-MC-Unique: GtOXtwj-NjOuYcGlwMRVNA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EF0F33C14941; Fri, 3 May 2024 19:16:31 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.45.224.64]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 95397112131D; Fri, 3 May 2024 19:16:31 +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 443JGTeo3198496 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 3 May 2024 21:16:29 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 443JGSE13198495; Fri, 3 May 2024 21:16:28 +0200 Date: Fri, 3 May 2024 21:16:28 +0200 From: Jakub Jelinek To: Martin Uecker Cc: Richard Biener , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] middle-end/114931 - type_hash_canon and structual equality types Message-ID: Reply-To: Jakub Jelinek References: <05B84303-9D17-4DAE-A9D9-A77DA3EA7878@suse.de> <39fcac8a1c61acaaa1c80602b76f48ef73f5f885.camel@tugraz.at> MIME-Version: 1.0 In-Reply-To: <39fcac8a1c61acaaa1c80602b76f48ef73f5f885.camel@tugraz.at> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 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=-4.4 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_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 Fri, May 03, 2024 at 09:11:20PM +0200, Martin Uecker wrote: > > TYPE_CANONICAL as used by the middle-end cannot express this but > > Hm. so how does it work now for arrays? Do you have a testcase which doesn't work correctly with the arrays? E.g. same_type_for_tbaa has type1 = TYPE_MAIN_VARIANT (type1); type2 = TYPE_MAIN_VARIANT (type2); /* Handle the most common case first. */ if (type1 == type2) return 1; /* If we would have to do structural comparison bail out. */ if (TYPE_STRUCTURAL_EQUALITY_P (type1) || TYPE_STRUCTURAL_EQUALITY_P (type2)) return -1; /* Compare the canonical types. */ if (TYPE_CANONICAL (type1) == TYPE_CANONICAL (type2)) return 1; /* ??? Array types are not properly unified in all cases as we have spurious changes in the index types for example. Removing this causes all sorts of problems with the Fortran frontend. */ if (TREE_CODE (type1) == ARRAY_TYPE && TREE_CODE (type2) == ARRAY_TYPE) return -1; ... and later compares alias sets and the like. So, even if int[] and int[0] have different TYPE_CANONICAL, they will be considered maybe the same. Also, guess get_alias_set has some ARRAY_TYPE handling... Anyway, I think we should just go with Richi's patch. Jakub