This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: -mpower4 sched2 bug miscompiles linux kernel
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Edelsohn <dje at watson dot ibm dot com>
- Date: Wed, 11 Sep 2002 17:12:00 +0930
- Subject: Re: -mpower4 sched2 bug miscompiles linux kernel
- References: <amodra@bigpond.net.au> <200209110223.WAA28072@makai.watson.ibm.com> <20020911161604.Q8357@bubble.sa.bigpond.net.au>
On Wed, Sep 11, 2002 at 04:16:04PM +0930, Alan Modra wrote:
> On Tue, Sep 10, 2002 at 10:23:04PM -0400, David Edelsohn wrote:
> > The -mstring problem was when I tested your version.
>
> I looked into the -maix64 -mstring problem, and yes, the patch still
> didn't get things correct. When called via emit_block_move_via_movstr,
> orig_src and orig_dest don't have correct mem aliasing info set up.
> So, adjust_address and friends start off with incorrect info. Setting
> MEM_ATTRS (x)->size in rs6000.c:expand_block_move compenstates. I
> guess this problem might need fixing in the generic code..
Duh, those MEM_ATTRS are shared. While the patch seemed to work, it's
surely wrong.
I need to replace
if (MEM_ATTRS (dest) != 0)
MEM_ATTRS (dest)->size = GEN_INT (move_bytes);
with
set_mem_size (dest, GEN_INT (move_bytes));
and similarly for "src". Now, this needs some more infrastructure.
* expr.h (set_mem_size): Declare.
* emit-rtl.c (set_mem_size): New function.
Index: gcc/expr.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.h,v
retrieving revision 1.121
diff -u -p -r1.121 expr.h
--- gcc/expr.h 29 Aug 2002 19:19:59 -0000 1.121
+++ gcc/expr.h 11 Sep 2002 07:37:06 -0000
@@ -616,6 +616,9 @@ extern void set_mem_expr PARAMS ((rtx, t
/* Set the offset for MEM to OFFSET. */
extern void set_mem_offset PARAMS ((rtx, rtx));
+/* Set the size for MEM to SIZE. */
+extern void set_mem_size PARAMS ((rtx, rtx));
+
/* Return a memory reference like MEMREF, but with its mode changed
to MODE and its address changed to ADDR.
(VOIDmode means don't change the mode.
Index: gcc/emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.292
diff -u -p -r1.292 emit-rtl.c
--- gcc/emit-rtl.c 8 Sep 2002 10:41:19 -0000 1.292
+++ gcc/emit-rtl.c 11 Sep 2002 07:37:11 -0000
@@ -1968,6 +1968,17 @@ set_mem_offset (mem, offset)
offset, MEM_SIZE (mem), MEM_ALIGN (mem),
GET_MODE (mem));
}
+
+/* Set the size of MEM to SIZE. */
+
+void
+set_mem_size (mem, size)
+ rtx mem, size;
+{
+ MEM_ATTRS (mem) = get_mem_attrs (MEM_ALIAS_SET (mem), MEM_EXPR (mem),
+ MEM_OFFSET (mem), size, MEM_ALIGN (mem),
+ GET_MODE (mem));
+}
/* Return a memory reference like MEMREF, but with its mode changed to MODE
and its address changed to ADDR. (VOIDmode means don't change the mode.
--
Alan Modra
IBM OzLabs - Linux Technology Centre