From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 9DE91384601D for ; Fri, 22 Jan 2021 02:22:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9DE91384601D Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 10M2HqwZ029094; Thu, 21 Jan 2021 21:22:02 -0500 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 367nsxg15x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 21 Jan 2021 21:22:02 -0500 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 10M2H3IK024049; Fri, 22 Jan 2021 02:22:00 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma04ams.nl.ibm.com with ESMTP id 367k0s849w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 22 Jan 2021 02:22:00 +0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 10M2Lvwx41615746 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 22 Jan 2021 02:21:57 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C4D85204F; Fri, 22 Jan 2021 02:21:57 +0000 (GMT) Received: from kewenlins-mbp.cn.ibm.com (unknown [9.200.146.152]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 0FEC952050; Fri, 22 Jan 2021 02:21:55 +0000 (GMT) Subject: Re: [PATCH/RFC] combine: Tweak the condition of last_set invalidation To: Segher Boessenkool Cc: GCC Patches , Bill Schmidt References: <6bcd32fa-d0ef-b136-ddd9-92a1d21f60af@linux.ibm.com> <20210115002237.GX30983@gate.crashing.org> <01684a9e-8dec-256a-5332-d8c5c1a4c483@linux.ibm.com> <20210122003008.GN30983@gate.crashing.org> From: "Kewen.Lin" Message-ID: Date: Fri, 22 Jan 2021 10:21:54 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20210122003008.GN30983@gate.crashing.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2021-01-21_11:2021-01-21, 2021-01-21 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 mlxscore=0 suspectscore=0 impostorscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101220004 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Fri, 22 Jan 2021 02:22:04 -0000 Hi Segher, on 2021/1/22 上午8:30, Segher Boessenkool wrote: > Hi Ke Wen, > > On Fri, Jan 15, 2021 at 04:06:17PM +0800, Kewen.Lin wrote: >> on 2021/1/15 上午8:22, Segher Boessenkool wrote: >>> On Wed, Dec 16, 2020 at 04:49:49PM +0800, Kewen.Lin wrote: >>>> ... op regX // this regX could find wrong last_set below >>>> regX = ... // if we think this set is valid >>>> ... op regX >>>> >>>> But because of retry's existence, the last_set_table_tick could >>> >>> It is not just because of retry: combine can change other insns than >>> just i2 and i3, too. And even changing i2 requires this! >> >> Ah, thanks for the information! Here retry is one example for that >> we can revisit one instruction but meanwhile the stored information >> for reg reference can be from that instruction after the current >> one but visited before. > > Yes; and we do not usually revisit just one insn, but everything after > it as well. We only need to revisit thos insns that are fed by what > has changed, but this is a good enough approximation (we never revisit > very far back). > >>> The whole reg_stat stuff is an ugly hack that does not work well. For >>> example, as in your example, some "known" value can be invalidated >>> before the combination that wants to know that value is tried. >>> >>> We need to have this outside of combine, in a dataflow(-like) thing >>> for example. This could take the place of REG_EQ* as well probably >>> (which is good, there are various problems with that as well). >> >> Good point, but IIUC we still need to keep updating(tracking) >> information like what we put into reg_stat stuff, it's not static >> since as you pointed out above, combine can change i2/i3 etc, >> we need to update the information for the changes. > > Yes, we should keep it correct all the time, and for any point in the > code. It also can be used by other passes, e.g. it can replace all > REG_EQ* notes, all nonzero_bits and num_sign_bit_copies, and no doubt > even more things. > >> Anyway, it's not what this patch tries to solve. :-P > > :-) > >>>> This proposal is to check whether the last_set_table safely happens >>>> after the current set, make the set still valid if so. >>> >>> I don't think this is safe to do like this, unfortunately. There are >>> more places that set last_set_invalid (well, one more), so at the very >>> minimum this needs a lot more justification. >> >> Let me try to explain it more. >> * Background * >> >> There are two places which set last_set_invalid to 1. >> >> CASE 1: > > > > Thanks for the in-depth explanation! > > I think this should be postponed to stage 1 though? Or is there > anything very urgent in it? > Yeah, I agree that this belongs to stage1, and there isn't anything urgent about it. Thanks for all further comments above! BR, Kewen