This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix unroll.c for PARALLELs, etc.
- To: gcc-patches at gcc dot gnu dot org
- Subject: fix unroll.c for PARALLELs, etc.
- From: Geoffrey Keating <geoffk at cygnus dot com>
- Date: Sun, 4 Nov 2001 00:11:08 -0800
This patch fixes two problems that appeared on stormy16.
First of all, on stormy16 all add insns have a clobber, so
single_set is required.
Secondly, the original code was failing to check that the
insns it was looking at were actually related at all, which
I fixed by using find_last_value.
Tested on stormy16-elf and an i686-linux bootstrap.
--
Geoff Keating <geoffk@redhat.com>
===File ~/patches/gcc-stormy-unroll.patch===================
2001-11-03 Geoffrey Keating <geoffk@redhat.com>
* unroll.c (calculate_giv_inc): Use find_last_value rather
than just hoping the last instruction is the right SET.
[Fixes 990604-1.c on stormy16.]
Index: unroll.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/unroll.c,v
retrieving revision 1.143
diff -p -u -p -r1.143 unroll.c
--- unroll.c 2001/10/28 20:09:17 1.143
+++ unroll.c 2001/11/03 21:32:45
@@ -1556,7 +1556,7 @@ calculate_giv_inc (pattern, src_insn, re
/* SR sometimes computes the new giv value in a temp, then copies it
to the new_reg. */
src_insn = PREV_INSN (src_insn);
- pattern = PATTERN (src_insn);
+ pattern = single_set (src_insn);
if (GET_CODE (SET_SRC (pattern)) != PLUS)
abort ();
@@ -1571,8 +1571,7 @@ calculate_giv_inc (pattern, src_insn, re
{
/* SR sometimes puts the constant in a register, especially if it is
too big to be an add immed operand. */
- src_insn = PREV_INSN (src_insn);
- increment = SET_SRC (PATTERN (src_insn));
+ increment = find_last_value (increment, &src_insn, NULL_RTX, 0);
/* SR may have used LO_SUM to compute the constant if it is too large
for a load immed operand. In this case, the constant is in operand
@@ -1598,8 +1597,8 @@ calculate_giv_inc (pattern, src_insn, re
rtx second_part = XEXP (increment, 1);
enum rtx_code code = GET_CODE (increment);
- src_insn = PREV_INSN (src_insn);
- increment = SET_SRC (PATTERN (src_insn));
+ increment = find_last_value (XEXP (increment, 0),
+ &src_insn, NULL_RTX, 0);
/* Don't need the last insn anymore. */
delete_related_insns (get_last_insn ());
@@ -1642,7 +1641,7 @@ calculate_giv_inc (pattern, src_insn, re
tries++;
src_insn = PREV_INSN (src_insn);
- pattern = PATTERN (src_insn);
+ pattern = single_set (src_insn);
delete_related_insns (get_last_insn ());
============================================================