public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Roman Zippel <zippel@linux-m68k.org>
To: gcc <gcc@gcc.gnu.org>
Subject: alias problem during loop pass
Date: Sat, 08 Mar 2003 20:27:00 -0000	[thread overview]
Message-ID: <3E6A4918.C365F399@linux-m68k.org> (raw)

Hi,

I'm currently trying to debug a problem, which causes a few problems for
Debian/m68k. The problem is present at least since 3.2 and also in
latest tree, but it seems not to be in 3.0.
I've put a test case at http://www.xs4all.nl/~zippel/sha.i, it's a
precompiled example from coreutils. Here is the important part:

void
sha_process_block (const void *buffer, size_t len, struct sha_ctx *ctx)
{
  const md5_uint32 *words = buffer;
  size_t nwords = len / sizeof (md5_uint32);
  const md5_uint32 *endp = words + nwords;
  md5_uint32 x[16];

  [..]
  while (words < endp)
    {
      md5_uint32 tm;
      int t;

      for (t = 0; t < 16; t++)
        {
          x[t] = (*words);
          words++;
        }

First it looks at the small loop and replaces x[t] with a pointer:

-(insn 86 84 87 (set (mem/s:SI (plus:SI (plus:SI (mult:SI (reg/v:SI 47)
-                        (const_int 4 [0x4]))
-                    (reg/f:SI 14 %a6))
-                (const_int -64 [0xffffffc0])) [5 x S4 A16])
-        (mem:SI (reg/v/f:SI 32) [5 S4 A16])) 29 {*m68k.md:976} (nil)
+(insn 86 84 2470 (set (mem/s:SI (reg/f:SI 1137) [5 x S4 A16])
+        (mem:SI (reg/v/f:SI 32) [5 S4 A16])) -1 (nil)
+    (nil))
+
+(insn 2470 86 87 (set (reg/f:SI 1137)
+        (plus:SI (reg/f:SI 1137)
+            (const_int 4 [0x4]))) -1 (nil)
     (nil))

The problem is now when it looks at the large loop, the x array is only
read after this and the optimizer thinks now it can move the array out
of the loop. AFAICS it goes wrong in loop.c:load_mems(), it does an
alias analysis with the already modified instructions, but then it uses
loop_info->store_mems to test for dependency tests, but this list still
contains the old reference.
At this point I really could need some help, how this should be fixed
correctly. Any ideas?

bye, Roman

                 reply	other threads:[~2003-03-08 19:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3E6A4918.C365F399@linux-m68k.org \
    --to=zippel@linux-m68k.org \
    --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).