From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 9BBF4384DD93 for ; Tue, 13 Dec 2022 16:53:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9BBF4384DD93 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-x52e.google.com with SMTP id d14so18570896edj.11 for ; Tue, 13 Dec 2022 08:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=iyxrRe18b91qFo66sw9fraGhDyG/wDdJzICY7HhkZZ0=; b=j0BueazbE46zsrjcz/dc8iMuN4OvBdMvyzykwquCSN/0bPX1LPmZWticPDvr5rh/JV gD3fKc4eacbxdfynVVuGxiMYDFA8SbQwunq+AWuiO3jqgZ2tIhhc3y8bMvwXV1R1bKs8 6YJDIPYpQgR2V+LfMZqWNNiaiNeX8qg/FepMdkyjYJm8YMYh2tcJURwvrpt9d1k+6o35 0jmVpndHvvoli4sAOwUMJAUSNcc/6yraEiJOfxgib4nT7YfPw55vs0LKedfpO8yHGeMO iIxaJPQ2XoraHYxotaZ3cOZo1UKJb36E35fEXj7qEoQ90CW1U8AEt2oV0fmXvkrbdY28 JXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iyxrRe18b91qFo66sw9fraGhDyG/wDdJzICY7HhkZZ0=; b=g6i2vNaoSh/5LX2AgAXHhO6QNEbZBdesVzycBU1ErxH5hox79G7uX7SiX+18pKckHR 5Fff+pUSmn3DAFqaCeIjHR+5eIoyawRubovccWPnbSmP0HQxB2hzcoz9C5d3EOjPvzL6 iJiQbcOyNs5IEWh/kMFrdM/+WzHQsB45ThAMEVNa/d6AVY8ExLPf4t6LDdCHeQF2Uzp8 TM81tKbvFLvNq4iysO6liAB8B81krjlbS7zJw+PoHfYLg/rLc2Vj900JRWnsxPFhSi00 a2JXOZZJjrk3cUgmQDnTL72MRzxJF+gfr/94pnSt3WGcKXoLeLAEC5b9+SljpbazOXh0 wZFA== X-Gm-Message-State: ANoB5plAOjdit4f/u0jHBxkIl9yVi+rT5GF7AxWLdlldkV/7M8JHGH1Z 14exZdlDVDIu1aKNE6elTn0JjcZZC7DVvIGKMOTMN/mhH+A= X-Google-Smtp-Source: AA0mqf6WB9w+JDnxw4zzouDHACdWaVSSBKrxxlkYJZkkWiC/rbV7aBjb9ZBLgunDcn2aN/5O+8ndSW8IXn040bk3jSM= X-Received: by 2002:aa7:cd4d:0:b0:46a:832a:b851 with SMTP id v13-20020aa7cd4d000000b0046a832ab851mr59099517edw.127.1670950406189; Tue, 13 Dec 2022 08:53:26 -0800 (PST) MIME-Version: 1.0 References: <2858689.e9J7NaK4W3@fomalhaut> <4447258.LvFx2qVVIh@fomalhaut> In-Reply-To: From: Claudiu Zissulescu Ianculescu Date: Tue, 13 Dec 2022 18:53:14 +0200 Message-ID: Subject: Re: Possible regression in DF analysis To: Eric Botcazou Cc: gcc@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,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: UPDATE: 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. A possible solution is to include in the blocks_to_analyze the missing basic blocks, something like: 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); - 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 (); } What do you think, Claudiu On Tue, Dec 13, 2022 at 2:30 PM Claudiu Zissulescu Ianculescu wrote: > > 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? > > 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(). > > Thank you for your help, > Claudiu > > On Tue, Dec 13, 2022 at 10:41 AM Eric Botcazou wrote: > > > > > 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. > > > > So df_get_live_out does not contain the CC register? iv_analysis_loop_init > > only performs a local update of the DF information, maybe it does not cover > > the basic block containing insn 14 and 15? > > > > -- > > Eric Botcazou > > > >