From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id F180A38582BF for ; Fri, 9 Sep 2022 13:27:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F180A38582BF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 289Cbj6q031844; Fri, 9 Sep 2022 13:27:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=cWREujJslYotNt42x3gK1W0hbzXunHsW9qL87OssJQM=; b=EjYfqRMp94PqGrtkleQNee6GmVqBxKmfpTQbqYRdl422IociOc/JLy/8DjXs6nc373wq 5DYvF7PQswXkq9rXwzwS51H6BYRZ+UWsDZCKn14i89nhi/98Kda7aAVVZ3EkJl/ryW8s s/3oBT9F4jxCwm7sPvQZUz749MgOYAL5iiCGayhMYDsJ/FvQHneh8OfZY7esR0e8KVDy ElOONisBsQdzPFtz9cmXQi+JCN8vmbeWFMD5d+r1UOm63u6yQ3XaPmXieqHIr5gc5KBu X1VhDmy5NMfrzEeILG6qoVAELK6cVG0HQePJhPs+msAE9JymWoQXnSU/KGPLXzlwCb0R hQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jg1wkscg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Sep 2022 13:27:33 +0000 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 289Cc6CF036071; Fri, 9 Sep 2022 13:27:33 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3jg1wkscf0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Sep 2022 13:27:32 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 289DLSgi023452; Fri, 9 Sep 2022 13:27:30 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma03fra.de.ibm.com with ESMTP id 3jbxj8wy0u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 09 Sep 2022 13:27:30 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 289DRS0x28770692 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 9 Sep 2022 13:27:28 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 29CE511C04C; Fri, 9 Sep 2022 13:27:28 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3428711C04A; Fri, 9 Sep 2022 13:27:26 +0000 (GMT) Received: from [9.197.248.186] (unknown [9.197.248.186]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 9 Sep 2022 13:27:25 +0000 (GMT) Message-ID: Date: Fri, 9 Sep 2022 21:27:24 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v2] Handle OPAQUE_TYPE specially in verify_type [PR106833] Content-Language: en-US To: Richard Biener Cc: GCC Patches , Segher Boessenkool , Peter Bergner References: <302a193a-2751-a404-31c6-f5b4a3e6856a@linux.ibm.com> From: "Kewen.Lin" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 7kYgsTNV-ttV6T1VoeRIEuFJrwB2a2OV X-Proofpoint-ORIG-GUID: HslLlthEZIyQopjwwqONawe9_wXcJAqG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-09_06,2022-09-09_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 suspectscore=0 priorityscore=1501 adultscore=0 phishscore=0 bulkscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209090045 X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 2022/9/9 15:25, Richard Biener wrote: > On Fri, Sep 9, 2022 at 8:51 AM Kewen.Lin wrote: >> >> Hi Richi, >> >> Thanks for the review comments! >> >> on 2022/9/8 15:36, Richard Biener wrote: >>> >>> >>>> Am 08.09.2022 um 07:53 schrieb Kewen.Lin : >>>> >>>> Hi, >>>> >>>> As PR106833 shows, cv-qualified opaque type can cause ICE >>>> during LTO. It exposes that we missd to handle OPAQUE_TYPE >>>> well in type verification. As Richi pointed out, also >>>> assuming that target will always define TYPE_MAIN_VARIANT >>>> and TYPE_CANONICAL for opaque type, this patch is to check >>>> both are OPAQUE_TYPE_P. Besides, it also checks the only >>>> available size and alignment information as well as type >>>> mode for TYPE_MAIN_VARIANT. >>>> >> ... >>>> + >>>> + if (t != tv) >>>> + { >>>> + verify_match (TREE_CODE, t, tv); >>>> + verify_match (TYPE_MODE, t, tv); >>>> + verify_match (TYPE_SIZE, t, tv); >>> >>> TYPE_SIZE is a tree, you should probably >>> Compare this with operand_equal_p. It’s >>> Not documented to be a constant size? >>> Thus some VLA vector mode might be allowed ( a poly_int size), >> >> Thanks for catching, I was referencing the code in function >> verify_type_variant, that corresponding part seems imperfect: >> >> if (TREE_CODE (TYPE_SIZE (t)) != PLACEHOLDER_EXPR >> && TREE_CODE (TYPE_SIZE (tv)) != PLACEHOLDER_EXPR) >> verify_variant_match (TYPE_SIZE); >> >> I agree poly_int size is allowed, the patch was updated for it. >> >> BLKmode >>> Is ruled out(?), >> >> Yes, it requires a mode of MODE_OPAQUE class. >> >> the docs say we have >>> ‚An MODE_Opaque‘ here but I don’t see >>> This being verified? >>> >> >> There is a MODE equality check, I assumed the given t already >> has one MODE_OPAQUE mode, but the patch was updated to make >> it explicit as you concerned. >> >>> The macro makes this a bit unworldly >>> For the only benefit of elaborate diagnostic >>> Which I think isn’t really necessary >> >> OK, fixed! >> >> The previous version makes just one check on TYPE_CANONICAL to >> be cheap as gimple_canonical_types_compatible_p said, but >> since there are just several fields to be check, this updated >> version adjusted it to be the same as what's for TYPE_MAIN_VARIANT. >> Hope it's fine. :) > > I think we'll call verify_type on the main variant as well so that would be > redundant (ensured by transitivity), can you check? I just had a check and found that we don't always call verify_type on the main variant. For example, with one case like: __attribute__((noipa)) int foo(c){ return 0; } int main () { const __vector_quad c; int r = foo(c); return r; } Checking during LTO WPA, verify_type only gets type "const __vector_quad", no type "__vector_quad". btw, it needs some hacking in rs6000_function_arg to make this opaque type valid for function arg. > >> Tested as before. >> >> Does this updated patch look good to you? > > Yes, please remove the checks against the main variant if the above holds, > OK with or without that change depending on this outcome. > Committed in r13-2562, thanks! BR, Kewen