From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) by sourceware.org (Postfix) with ESMTPS id 193DC3858D39 for ; Mon, 13 Dec 2021 15:20:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 193DC3858D39 Received: from [10.10.3.121] (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id 22B30407625E; Mon, 13 Dec 2021 15:20:11 +0000 (UTC) Date: Mon, 13 Dec 2021 18:20:11 +0300 (MSK) From: Alexander Monakov To: Richard Biener cc: gcc-patches@gcc.gnu.org, Alexey Nurmukhametov Subject: Re: [RFC PATCH] tree-ssa-sink: do not sink to in front of setjmp In-Reply-To: <4493B84A-DB6D-468B-86BF-DA5383D8CFE4@gmail.com> Message-ID: <794111d4-a64c-17e5-a4fe-f96e5182ee1@ispras.ru> References: <4493B84A-DB6D-468B-86BF-DA5383D8CFE4@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Mon, 13 Dec 2021 15:20:17 -0000 On Mon, 13 Dec 2021, Richard Biener wrote: > On December 13, 2021 3:25:47 PM GMT+01:00, Alexander Monakov wrote: > >Greetings! > > > >While testing our patch that reimplements -Wclobbered on GIMPLE we found > >a case where tree-ssa-sink moves a statement to a basic block in front > >of a setjmp call. > > > >I am confident that this is unintended and should be considered invalid > >GIMPLE. > > Does CFG validation not catch this? That is, doesn't setjmp force the start of > a new BB? Oh, good point. There's stmt_start_bb_p which returns true for setjmp, but gimple_verify_flow_info doesn't check it. I guess we can try adding that and collect the fallout on bootstrap/regtest. > I think sinking relies on dominance and post dominance here but post dominance > may be too fragile with the abnormal cycles which are likely not backwards > reachable from exit. > > That said, checking for abnormal preds is OK, I just want to make sure we > detect the invalid CFG - do we? As above, no, otherwise it would have been caught much earlier than ICE'ing our -Wclobbered patch :) Thank you. Alexander