This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: hpux20 pointer optimization bug
- To: law at cygnus dot com
- Subject: Re: hpux20 pointer optimization bug
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Mon, 08 Jun 1998 17:03:05 -0700
- cc: tprince at cat dot e-mail dot com, egcs-patches at cygnus dot com, tprince at computer dot org
I believe all we need to do is clear v2->insn just like we clear
v2->same_insn when we determine the first GIV is invalid.
The same_insn field is used for givs's within the same instruction, which
might be subject to a match_dup. For instance, a divmodsi4 pattern with
two memory operands which must be identical. In this case, we must always
reduce both or neither, and we need to be careful about rtx sharing. This
is why we must clear the same_insn field if one of the giv's can't be reduced.
The same reasoning doesn't apply to the same field, but it does seem like
a reasonable solution. I don't see anything else using the `same' field
during or after loop unrolling, so it should be harmless to clear it to fix
this bug. If we add future optimizations to loop though, it might be useful
to retain this info if we can.
Alternatively, I think we could also fix the problem by moving the code that
sets the unrollled field. loop.h says:
unsigned unrolled : 1; /* 1 if new register has been allocated in
unrolled loop. */
We could redefine that to `allocated and initialized'. I think this patch
gives the same effect as your patch while leaving the same field set.
I don't think it makes much difference which way the problem is fixed though.
Mon Jun 8 16:57:52 1998 Jim Wilson <wilson@cygnus.com>
* unroll.c (find_splittable_givs): Move setting of unrolled field after
address check.
Index: unroll.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/unroll.c,v
retrieving revision 1.23
diff -p -r1.23 unroll.c
*** unroll.c 1998/05/06 21:07:32 1.23
--- unroll.c 1998/06/08 23:57:40
*************** find_splittable_givs (bl, unroll_type, l
*** 2906,2912 ****
rtx tem = gen_reg_rtx (v->mode);
record_base_value (REGNO (tem), v->add_val, 0);
- v->unrolled = 1;
/* If the address giv has a constant in its new_reg value,
then this constant can be pulled out and put in value,
--- 2906,2911 ----
*************** find_splittable_givs (bl, unroll_type, l
*** 2959,2964 ****
--- 2958,2967 ----
continue;
}
+ /* We set this after the address check, to guarantee that
+ the register will be initialized. */
+ v->unrolled = 1;
+
/* To initialize the new register, just move the value of
new_reg into it. This is not guaranteed to give a valid
instruction on machines with complex addressing modes.