This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: g77.f-torture/execute/short.f -Os failure
- To: <David dot Billinghurst at riotinto dot com>
- Subject: Re: g77.f-torture/execute/short.f -Os failure
- From: Bernd Schmidt <bernds at redhat dot com>
- Date: Fri, 30 Mar 2001 18:05:54 +0100 (BST)
- Cc: <gcc-gnats at gcc dot gnu dot org>, <gcc-patches at gcc dot gnu dot org>
On 28 Mar 2001 David.Billinghurst@riotinto.com wrote:
> Test g77.f-torture/execute/short.f -Os execution fails on i?86-pc-cygwin, mips-sgi-irix6.5 and i?86-pc-linux-gnu. This is a regression from gcc-2.95.
>
> I looked into this briefly last September. See:
> * http://gcc.gnu.org/ml/gcc-bugs/2000-09/msg00172.html
> * http://gcc.gnu.org/ml/gcc-bugs/2000-09/msg00315.html
>
>
> The bug was introduced/triggered a patch by Bernd Schmidt <bernds@cygnus.co.uk> on 2000-03-14.
The problem is that we introduce a new load from a pseudo, and extend its
lifetime. This confuses try_copy_prop, which gets to see the old lifetime
and thinks it has replaced all uses of the pseudo with something else, and
deletes its initializing insn.
Fixed with this patch; bootstrapped on mainline & 3.0 branch (up to libstdc++
which never seems to build these days).
Bernd
* loop.c (load_mems): When generating a load from a pseudo, update
REGNO_LAST_UID.
Index: loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.325
diff -u -p -r1.325 loop.c
--- loop.c 2001/03/22 18:48:30 1.325
+++ loop.c 2001/03/30 17:03:41
@@ -8811,7 +8811,7 @@ load_mems (loop)
struct loop_regs *regs = LOOP_REGS (loop);
int maybe_never = 0;
int i;
- rtx p;
+ rtx p, prev_ebb_head;
rtx label = NULL_RTX;
rtx end_label;
/* Nonzero if the next instruction may never be executed. */
@@ -8873,6 +8873,7 @@ load_mems (loop)
PREV_INSN (p) && GET_CODE (p) != CODE_LABEL;
p = PREV_INSN (p))
;
+ prev_ebb_head = p;
cselib_init ();
@@ -8963,7 +8964,7 @@ load_mems (loop)
loop_info->mems[i].reg = reg;
/* Now, replace all references to the MEM with the
- corresponding pesudos. */
+ corresponding pseudos. */
maybe_never = 0;
for (p = next_insn_in_loop (loop, loop->scan_start);
p != NULL_RTX;
@@ -9034,7 +9035,7 @@ load_mems (loop)
if (CONSTANT_P (equiv->loc))
const_equiv = equiv;
else if (GET_CODE (equiv->loc) == REG
- /* Extending hard register lifetimes cuases crash
+ /* Extending hard register lifetimes causes crash
on SRC targets. Doing so on non-SRC is
probably also not good idea, since we most
probably have pseudoregister equivalence as
@@ -9060,8 +9061,19 @@ load_mems (loop)
if (best_equiv)
best = copy_rtx (best_equiv->loc);
}
+
set = gen_move_insn (reg, best);
set = loop_insn_hoist (loop, set);
+ if (REG_P (best))
+ {
+ for (p = prev_ebb_head; p != loop->start; p = NEXT_INSN (p))
+ if (REGNO_LAST_UID (REGNO (best)) == INSN_UID (p))
+ {
+ REGNO_LAST_UID (REGNO (best)) = INSN_UID (set);
+ break;
+ }
+ }
+
if (const_equiv)
REG_NOTES (set) = gen_rtx_EXPR_LIST (REG_EQUAL,
copy_rtx (const_equiv->loc),