public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* alias problem during loop pass
@ 2003-03-08 20:27 Roman Zippel
  0 siblings, 0 replies; only message in thread
From: Roman Zippel @ 2003-03-08 20:27 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-08 19:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-08 20:27 alias problem during loop pass Roman Zippel

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).