* Another reload bug
@ 2003-04-09 23:28 Eric Botcazou
2003-04-10 21:11 ` Richard Henderson
0 siblings, 1 reply; 3+ messages in thread
From: Eric Botcazou @ 2003-04-09 23:28 UTC (permalink / raw)
To: Richard Henderson; +Cc: gcc
Hello Richard,
I've narrowed down the bug reported as PR optimization/10352, a regression
from GCC 3.2 present on the 3.2 branch since 3.2.1 (and incidentally also a
RedHat 9 regression w.r.t RedHat 8 :-) to this patch
2002-10-24 Richard Henderson <rth@redhat.com>
PR opt/7944
* reload.c (find_reloads_toplev): Use simplify_gen_subreg; mode
of X is not important when simplifying subregs of constants.
We are trying to reload
(subreg:SF (reg/v/u:DI 62) 4)
with reg_equiv_constant[regno] == (const_int 0 [0x0]).
But simplify_gen_subreg() can't handle the MODE_INT to MODE_FLOAT conversion:
we have this line in simplify-rtx.c:simplify_subreg()
/* We don't handle synthetizing of non-integral constants yet. */
if (GET_MODE_CLASS (outermode) != MODE_INT)
return NULL_RTX;
so we abort.
Now your patch appears to have removed the required conversion code:
Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.178.2.4.2.3
retrieving revision 1.178.2.4.2.4
diff -u -p -r1.178.2.4.2.3 -r1.178.2.4.2.4
--- reload.c 17 Oct 2002 16:52:27 -0000 1.178.2.4.2.3
+++ reload.c 24 Oct 2002 08:59:49 -0000 1.178.2.4.2.4
@@ -4427,20 +4427,12 @@ find_reloads_toplev (x, opnum, type, ind
reg_equiv_constant[regno])) != 0)
return tem;
- if (GET_MODE_BITSIZE (GET_MODE (x)) == BITS_PER_WORD
- && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
- && reg_equiv_constant[regno] != 0
- && (tem = operand_subword (reg_equiv_constant[regno],
- SUBREG_BYTE (x) / UNITS_PER_WORD, 0,
- GET_MODE (SUBREG_REG (x)))) != 0)
+ if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
+ && reg_equiv_constant[regno] != 0)
{
- /* TEM is now a word sized constant for the bits from X that
- we wanted. However, TEM may be the wrong representation.
-
- Use gen_lowpart_common to convert a CONST_INT into a
- CONST_DOUBLE and vice versa as needed according to by the mode
- of the SUBREG. */
- tem = gen_lowpart_common (GET_MODE (x), tem);
+ tem =
+ simplify_gen_subreg (GET_MODE (x), reg_equiv_constant[regno],
+ GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
if (!tem)
abort ();
return tem;
Should we restore the original code as the "plan B" here?
Note also that the patch lifted the condition
- if (GET_MODE_BITSIZE (GET_MODE (x)) == BITS_PER_WORD
so this ends up disabling entirely the subsequent block of code.
--
Eric Botcazou
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Another reload bug
2003-04-09 23:28 Another reload bug Eric Botcazou
@ 2003-04-10 21:11 ` Richard Henderson
2003-04-11 1:49 ` Thanks, GCC developers & maintainers (was Re: Another reload bug) Jeff Epler
0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2003-04-10 21:11 UTC (permalink / raw)
To: Eric Botcazou; +Cc: gcc
On Thu, Apr 10, 2003 at 12:18:02AM +0200, Eric Botcazou wrote:
> Should we restore the original code as the "plan B" here?
No, I'm going to backport a small bit o code from mainline
simplify_subreg that takes care of this.
I'll commit it after testing completes; the testcase from
this pr will be committed as g++.dg/opt/reload2.C.
r~
Tue Jul 23 21:49:24 2002 J"orn Rennecke <joern.rennecke@superh.com>
* simplify-rtx.c (simplify_subreg): When converting to a non-int
mode, try to convert to an integer mode of matching size first.
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.94.2.1
diff -c -p -d -r1.94.2.1 simplify-rtx.c
*** simplify-rtx.c 6 Mar 2002 22:43:21 -0000 1.94.2.1
--- simplify-rtx.c 10 Apr 2003 20:48:36 -0000
*************** simplify_subreg (outermode, op, innermod
*** 2484,2489 ****
--- 2484,2503 ----
return new;
}
+ if (GET_MODE_CLASS (outermode) != MODE_INT
+ && GET_MODE_CLASS (outermode) != MODE_CC)
+ {
+ enum machine_mode new_mode = int_mode_for_mode (outermode);
+
+ if (new_mode != innermode || byte != 0)
+ {
+ op = simplify_subreg (new_mode, op, innermode, byte);
+ if (! op)
+ return NULL_RTX;
+ return simplify_subreg (outermode, op, new_mode, 0);
+ }
+ }
+
offset = byte * BITS_PER_UNIT;
switch (GET_CODE (op))
{
^ permalink raw reply [flat|nested] 3+ messages in thread
* Thanks, GCC developers & maintainers (was Re: Another reload bug)
2003-04-10 21:11 ` Richard Henderson
@ 2003-04-11 1:49 ` Jeff Epler
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Epler @ 2003-04-11 1:49 UTC (permalink / raw)
To: Richard Henderson, Eric Botcazou, gcc
Thanks, GCC developers and maintainers. It's quite pleasing to see a
software project that was so responsive to my bug report. To have a
fix to a fairly minor issue within the week is simply amazing.
Jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-11 0:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-09 23:28 Another reload bug Eric Botcazou
2003-04-10 21:11 ` Richard Henderson
2003-04-11 1:49 ` Thanks, GCC developers & maintainers (was Re: Another reload bug) Jeff Epler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).