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]

Re: Bug in loop invariant motion with trivial test case


On Thursday 12 August 2004 22:44, Richard Henderson wrote:
> On Thu, Aug 12, 2004 at 10:40:08PM +0200, Steven Bosscher wrote:
> > I'm wondering if we really want to apply this optimization to
> > aggregate types if they appear as an lvalue, because the
> > replacement temporary is itself also an aggregate, and it can
> > never be a register.  So perhaps something like this,
>
> If aggregate_type_p (as opposed to AGGREGATE_TYPE_P) is true,
> then the value is returned in registers, otherwise in memory.

It shouldn't be necessary anyway.  On closer inspection,
the problem appears to be that the VUSE is just skipped
in rewrite_mem_refs.  The following patch fixes that, but
I'm still trying to understand what exactly this code is
trying to do.  It's not very well commented and I'm not
very familiar with this (or any other ;-) loop pass.

Gr.
Steven



Index: tree-ssa-loop-im.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-im.c,v
retrieving revision 2.5
diff -u -3 -p -r2.5 tree-ssa-loop-im.c
--- tree-ssa-loop-im.c  10 Aug 2004 18:31:26 -0000      2.5
+++ tree-ssa-loop-im.c  12 Aug 2004 21:03:39 -0000
@@ -890,8 +890,12 @@ single_reachable_address (struct loop *l

          vuses = STMT_VUSE_OPS (stmt);
          for (i = 0; i < NUM_VUSES (vuses); i++)
-           maybe_queue_var (VUSE_OP (vuses, i), loop,
-                            seen, queue, &in_queue);
+           {
+             tree op = VUSE_OP (vuses, i);
+             if (op == common_ref)
+               record_mem_ref (mem_refs, stmt, aref);
+             maybe_queue_var (op, loop, seen, queue, &in_queue);
+           }
          break;

        case PHI_NODE:



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