public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Claudiu Zissulescu Ianculescu <claziss@gmail.com>
To: Eric Botcazou <botcazou@adacore.com>
Cc: gcc@gcc.gnu.org
Subject: Re: Possible regression in DF analysis
Date: Tue, 13 Dec 2022 18:53:14 +0200	[thread overview]
Message-ID: <CAL0iMy3weuscQFtKPXG25WpJ=am73EXgJ2mF-4MU2U4UDuotvg@mail.gmail.com> (raw)
In-Reply-To: <CAL0iMy17-H3h-LfaPcKJyZVhpF7LL9TM30HxWGMFBzyozqg=8w@mail.gmail.com>

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
<claziss@gmail.com> 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 <botcazou@adacore.com> 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
> >
> >

  reply	other threads:[~2022-12-13 16:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-08 10:40 Claudiu Zissulescu Ianculescu
2022-12-08 11:33 ` Eric Botcazou
2022-12-08 11:51   ` Claudiu Zissulescu Ianculescu
2022-12-13  8:41     ` Eric Botcazou
2022-12-13 12:30       ` Claudiu Zissulescu Ianculescu
2022-12-13 16:53         ` Claudiu Zissulescu Ianculescu [this message]
2022-12-13 17:01           ` Richard Biener
2022-12-13 17:38             ` Claudiu Zissulescu Ianculescu
2022-12-14 10:37               ` Claudiu Zissulescu Ianculescu
2022-12-14 11:06                 ` Richard Biener
2022-12-14 11:30                   ` Claudiu Zissulescu Ianculescu
2022-12-14 12:39                     ` Richard Biener
2022-12-17  0:33     ` Jeff Law
     [not found]       ` <CAL0iMy1ad0PmprQdu6BMhHdivPz--1Yq72+n02Lj-SmxhZmxQQ@mail.gmail.com>
2022-12-20 12:34         ` Fwd: " Claudiu Zissulescu Ianculescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL0iMy3weuscQFtKPXG25WpJ=am73EXgJ2mF-4MU2U4UDuotvg@mail.gmail.com' \
    --to=claziss@gmail.com \
    --cc=botcazou@adacore.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).