From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by sourceware.org (Postfix) with ESMTPS id A0A8E383CD18 for ; Tue, 13 Dec 2022 17:01:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A0A8E383CD18 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x534.google.com with SMTP id z92so18662208ede.1 for ; Tue, 13 Dec 2022 09:01:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=smCVVJqWGRRJETUdCyh0BqezFt9r8XtkE8JPvXeVR/A=; b=CARJqN7p/Ca03F5tat68RZT/Flscx3Q8gW2BgVdzZv5Z4Qzect0y5/prX17HZXSm2n Z4MOpCSVaTuGkMJacINF6s82WevPpKdOPLt3bIBurm/ruKoywlFr3N1tIifNhIbIeM1y QpGmRA590znJCJKAMzKezksBDP1Lc9Fp1+V548PpgewWDusSJkATGVRaHqg0INGRWt/p IsMhsqj28sZ6TlkkdcZc1tC86GXHpWoxMX19Bt2JmH/ejyLbDw16aVYQ+qMGugvTOuES ZoHciWqouex9tFnWYHK3cn/gbKVFWW1qGKB8EWvDMBVOLZxDmOhiM0oSgDyvOS9Tx77S eyXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=smCVVJqWGRRJETUdCyh0BqezFt9r8XtkE8JPvXeVR/A=; b=vqrKgGsiAWe7jBrxcNNazuDF+4xOM1iRDJdbGfHXtxwh6QJ+ukW2kfO/wkniPrOfm/ F1k+3BeurIv2Syf+S3dtEGNskT5/HoVYZaolO/udor6PigvuIwo2zq8rzieW/y/QKSKL Hhm3kDfMzzCksP3y2jNEMcabmxw5xtDruRs36d7UrdpSSeqi/bJd82yJ5nZ0SUMvYdS5 D7xvHWgvc1JCFgjaTp0WBTt77XjaAC+AQxKLUZyKl/HpK2IXcv42ffgfFIl62sxp0DLU 7k0wI8vSzxQYkTqW3cAtGB1R7yiZIiNTK+GfnDIDlHCYgu7v6wADFAshhtU4ZYQiU0+J 4TLA== X-Gm-Message-State: ANoB5plT7n9DnIgDbvUK+QFHhl81BOKxvF1N7v+XV5+oW4YHoOJy+d41 Kp9QAgWS4FrcheA0GB3YjZgwjmqVCfM= X-Google-Smtp-Source: AA0mqf4Hsx8npfoZ3JDRNFfzXEZBIZpem8M6Pd6bb/eLekY10VjGhzk4P2TyvQHp8+rtBnZSR21eUQ== X-Received: by 2002:a05:6402:d46:b0:46a:d5ee:7664 with SMTP id ec6-20020a0564020d4600b0046ad5ee7664mr17067384edb.6.1670950908592; Tue, 13 Dec 2022 09:01:48 -0800 (PST) Received: from smtpclient.apple (dynamic-095-118-090-221.95.118.pool.telefonica.de. [95.118.90.221]) by smtp.gmail.com with ESMTPSA id c23-20020aa7c757000000b0046db7a913f1sm5210695eds.81.2022.12.13.09.01.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Dec 2022 09:01:47 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: Possible regression in DF analysis Date: Tue, 13 Dec 2022 18:01:36 +0100 Message-Id: References: Cc: Eric Botcazou , gcc@gcc.gnu.org In-Reply-To: To: Claudiu Zissulescu Ianculescu X-Mailer: iPhone Mail (20B110) X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,WEIRD_PORT 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: > Am 13.12.2022 um 17:54 schrieb Claudiu Zissulescu Ianculescu via Gcc : >=20 > =EF=BB=BFUPDATE: > The df_analyze_loop is calling the df_set_blocks. Thus, the analysis > behaves as if the function only contains those blocks and any edges > that occur directly between the blocks in the set (see df-core.cc). > This said, the loop-doloop behaves faulty at loop-doloop.cc:772 as the > df_get_lives_out (loop_end) is not computed correctly. >=20 > A possible solution is to include in the blocks_to_analyze the missing > basic blocks, something like: >=20 > diff --git a/gcc/df-core.cc b/gcc/df-core.cc > index a901b84878f..d7059c188b2 100644 > --- a/gcc/df-core.cc > +++ b/gcc/df-core.cc > @@ -1437,7 +1437,15 @@ df_analyze_loop (class loop *loop) > df_set_blocks (blocks); > BITMAP_FREE (blocks); >=20 > - df_analyze_1 (); > + /* Add the loop's header successor bbs too. */ > + edge e; > + edge_iterator ei; > + FOR_EACH_EDGE (e, ei, loop->header->succs) > + bitmap_set_bit (df->blocks_to_analyze, e->dest->index); > + > + if (dump_file) > + debug_bitmap_file (dump_file, df->blocks_to_analyze); > + df_analyze (); > } >=20 > What do you think, Maybe you want to iterate over the loops exit edges and include their destin= ation block instead? > Claudiu >=20 >> On Tue, Dec 13, 2022 at 2:30 PM Claudiu Zissulescu Ianculescu >> wrote: >>=20 >> It looks like that. The df_analyze_loop is only looking at the loop >> BBs, and it is not clear for me if df_analyze_loop is required to have >> all the df_live_outs correctly computed or not. Do you know if it is >> true? >>=20 >> If the df_analyze_loop is not supposed to compute all the df_live_outs >> correctly, then the error resides in how loop-doloop is using the >> iv_analysis_loop_init(). >>=20 >> Thank you for your help, >> Claudiu >>=20 >>> On Tue, Dec 13, 2022 at 10:41 AM Eric Botcazou wr= ote: >>>=20 >>>> The problem shows in loop-doloop.c when I introduce a loop end pattern >>>> that replaces the first jump instruction (JUMP_INSN 15) with a pattern >>>> that clobbers CC reg. However, the DF doesn't look like it works as >>>> the doloop step cannot find the CC reg alive. Please see >>>> loop-doloop.c:766. Hence, it introduces the doloop_end patterns, and >>>> renders the compare instruction (INSN 14) dead code. leading to >>>> errors. >>>=20 >>> So df_get_live_out does not contain the CC register? iv_analysis_loop_i= nit >>> only performs a local update of the DF information, maybe it does not co= ver >>> the basic block containing insn 14 and 15? >>>=20 >>> -- >>> Eric Botcazou >>>=20 >>>=20