This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] for PR 17428
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 21 Sep 2004 22:35:31 +0200
- Subject: [patch] for PR 17428
Hello,
speculative prefetching may insert code in the middle of area where
arguments of the function call are loaded to hard registers.
If any operation in the inserted code needs a hard register
that is occupied by an argument already, reload ICEs.
This patch fixes the problem, by always saving and restoring
values of hard registers that are live over the inserted code.
Profiledbootstrapped & regtested on i686.
Zdenek
PR target/17428
* cfgrtl.c (safe_insert_insn_on_edge): Avoid extending life range of hard
registers.
* value-prof.c (insn_prefetch_values_to_profile): Only scan normal insns.
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.133
diff -c -3 -p -r1.133 cfgrtl.c
*** cfgrtl.c 7 Sep 2004 17:54:16 -0000 1.133
--- cfgrtl.c 21 Sep 2004 20:28:17 -0000
*************** safe_insert_insn_on_edge (rtx insn, edge
*** 1455,1460 ****
--- 1455,1469 ----
for (x = insn; x; x = NEXT_INSN (x))
if (INSN_P (x))
note_stores (PATTERN (x), mark_killed_regs, killed);
+
+ /* Mark all hard registers as killed. Register allocator/reload cannot
+ cope with the situation when life range of hard register spans operation
+ for that the appropriate register is needed, i.e. it would be unsafe to
+ extend the life ranges of hard registers. */
+ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if (!fixed_regs[regno])
+ SET_REGNO_REG_SET (killed, regno);
+
bitmap_operation (killed, killed, e->dest->global_live_at_start,
BITMAP_AND);
Index: value-prof.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/value-prof.c,v
retrieving revision 1.15
diff -c -3 -p -r1.15 value-prof.c
*** value-prof.c 10 Sep 2004 10:44:48 -0000 1.15
--- value-prof.c 21 Sep 2004 20:28:18 -0000
*************** insn_prefetch_values_to_profile (rtx ins
*** 245,251 ****
int write;
histogram_value hist;
! if (!INSN_P (insn))
return false;
if (!find_mem_reference (insn, &mem, &write))
--- 245,252 ----
int write;
histogram_value hist;
! /* It only makes sense to look for memory references in ordinary insns. */
! if (GET_CODE (insn) != INSN)
return false;
if (!find_mem_reference (insn, &mem, &write))