This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

alias problem during loop pass


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]