public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/15265] New: delete_output_reload deletes necessary insn
@ 2004-05-03 15:21 matz at suse dot de
2004-05-05 20:26 ` [Bug optimization/15265] " joern dot rennecke at superh dot com
` (14 more replies)
0 siblings, 15 replies; 18+ messages in thread
From: matz at suse dot de @ 2004-05-03 15:21 UTC (permalink / raw)
To: gcc-bugs
With HEAD (and 3.3 for that matter) the following testcase generates wrong
code on amd64 with -O1 (!). With -O2 it's hidden.
------------------------------
extern float getcard();
extern void abort();
float def;
float f()
{
float card_bound = getcard();
if (card_bound == -9)
card_bound = def;
card_bound = ((card_bound) <= (def) ? (card_bound) : (def));
return card_bound;
}
float getcard() { return -9; }
int main()
{
def = 42;
if (f() != 42)
abort();
return 0;
}
-------------------------------
The problem is, that f() implements the compares like so:
call _Z7getcardv
movaps %xmm0, %xmm1
movss def(%rip), %xmm2
cmpeqss .LC0(%rip), %xmm1
andps %xmm1, %xmm2
andnps %xmm0, %xmm1
orps %xmm2, %xmm1
here %xmm1 contains the card_bound value after the "if (card_bound==-9)", but
movss def(%rip), %xmm2
cmpnless %xmm2, %xmm1
here it is overwritten with the mask of the "<=" compare, and
andps %xmm1, %xmm2
andnps %xmm0, %xmm1
here the original orig_bound value in %xmm0 is used again (the value from
before the compare to -9).
The problem is in delete_output_reload which deletes a necessary move insn.
It goes like this:
First we start with these two compare insns:
(insn 71 11 30 0 0x2a958bfa80 (parallel [
(set (reg/v:SF 59 [ card_bound ])
(if_then_else:SF (eq (reg/v:SF 59 [ card_bound ])
(mem/u/f:SF (symbol_ref/u:DI ("*.LC0")) [0 S4 A32]))
(mem/f:SF (symbol_ref:DI ("def")) [0 def+0 S4 A32])
(reg/v:SF 59 [ card_bound ])))
(clobber (scratch:SF))
(clobber (reg:CC 17 flags))
]) 674 {sse_movsfcc_eq})
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_UNUSED (scratch:SF)
(nil))))
....
(insn 42 75 50 0 0x2a958bfa80 (parallel [
(set (reg/v:SF 59 [ card_bound ])
(if_then_else:SF (ungt (reg/v:SF 59 [ card_bound ])
(mem/f:SF (symbol_ref:DI ("def")) [0 def+0 S4 A32]))
(mem/f:SF (symbol_ref:DI ("def")) [0 def+0 S4 A32])
(reg/v:SF 59 [ card_bound ])))
(clobber (scratch:SF))
(clobber (reg:CC 17 flags))
]) 673 {sse_movsfcc} (insn_list 71 (nil))
(expr_list:REG_UNUSED (scratch:SF)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(nil))))
The interesting reloads generated are the xmm0->xmm1 reloads in both insns:
Reloads for insn # 71
Reload 0: reload_in (SF) = (reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])
reload_out (SF) = (reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])
SSE_REGS, RELOAD_OTHER (opnum = 0)
reload_in_reg: (reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])
reload_out_reg: (reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])
reload_reg_rtx: (reg:SF 22 exmm1)
Reloads for insn # 42
Reload 0: reload_in (SF) = (reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])
reload_out (SF) = (reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])
SSE_REGS, RELOAD_OTHER (opnum = 0)
reload_in_reg: (reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])
reload_out_reg: (reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])
reload_reg_rtx: (reg:SF 22 exmm1)
Both are in-out reloads, hence for each insns there must be a xmm0-->xmm1
move before it and a xmm1-->xmm0 move after it. These are correctly done
initially, but when doing the input part for insn 42 it notices that
the output part of reload0 of #71 can be inherited (which is okay
as it contains indeed the correct value).
But insn #42 uses pseudo 59 (the one assigned to xmm0) more than once.
The reload is only for operand 0 (and by matching constraints for operand 2
which is the one in the compare). Hence after substitution #42 looks like so:
(insn 42 81 80 0 0x2a958bfa80 (parallel [
(set (reg:SF 22 exmm1)
(if_then_else:SF (ungt (reg:SF 22 exmm1)
(reg:SF 23 exmm2))
(reg:SF 23 exmm2)
(reg/v:SF 21 exmm0 [orig:59 card_bound ] [59])))
(clobber (reg:SF 23 exmm2))
(clobber (reg:CC 17 flags))
]) 673 {sse_movsfcc} (insn_list 71 (nil))
(nil))
Note how xmm0 here is still used (in operand 5 if I counted correct).
This is okay as per the constraints.
So, the output reload of #71 can be inherited but it can't be removed
because what it set up is still used by this insn (of course this makes
the inheritance useless).
There is code in delete_output_reload which I think should prevent this from
happening (the counting of n_inherited compared to n_occurences) but it
doesn't work here.
There are two occurences of 'xmm0' in non-destinations. But the way
n_inherited is counted leads also to 2 because the input and output part
of the reload in question are counted separately. I think this is non-sense.
Just because the same reload has in- _and_ out-part (and both are equal) does
not make it two occurences.
I have no idea why n_inherited is counted like it is, so am unsure how to
fix it. I verified my hypothesis with a simple
--------------------------
--- reload1.c 13 Apr 2004 23:27:43 -0000 1.433
+++ reload1.c 3 May 2004 15:12:17 -0000
@@ -7615,7 +7615,7 @@ delete_output_reload (rtx insn, int j, i
continue;
while (GET_CODE (reg2) == SUBREG)
reg2 = XEXP (reg2, 0);
- if (rtx_equal_p (reg2, reg))
+ if (0 && rtx_equal_p (reg2, reg))
n_inherited++;
}
else
---------------------------
which generates correct code for this example. I've CCed you, Joern,
because you seem to have last touched this function in a significant way
generally fiddling with reload inheritance. Unfortunately it was in 1998.
--
Summary: delete_output_reload deletes necessary insn
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: matz at suse dot de
CC: gcc-bugs at gcc dot gnu dot org,joern dot rennecke at
superh dot com
GCC build triplet: x86_64-suse-linux
GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
@ 2004-05-05 20:26 ` joern dot rennecke at superh dot com
2004-05-06 13:37 ` matz at suse dot de
` (13 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: joern dot rennecke at superh dot com @ 2004-05-05 20:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From joern dot rennecke at superh dot com 2004-05-05 20:26 -------
Subject: Re: New: delete_output_reload deletes necessary insn
> There is code in delete_output_reload which I think should prevent this from
> happening (the counting of n_inherited compared to n_occurences) but it
> doesn't work here.
>
> There are two occurences of 'xmm0' in non-destinations. But the way
> n_inherited is counted leads also to 2 because the input and output part
> of the reload in question are counted separately. I think this is non-sense.
> Just because the same reload has in- _and_ out-part (and both are equal) does
> not make it two occurences.
On the face of it, your argument makes sense. However, there are some
subtle issues with SUBREGs/SIGN_EXTENDs/ZERO_EXTENDs, auto-increment, and
address reloads where an operand can be visible multiple times.
Moreover, I think count_occurences should discount top-level occurences in
clobbers the same it does with top-level occurences in SET_DESTs.
I think what we need is some way to do low-level regression testing and
debugging of reload. A special-purpose language with an rtl interface
would be kind of nice, but I can't see anybody investing the time to make
this happen. Plus, it might be seen as a possible backend interface
for NON-GPL frontends.
So I suppose the feasible option is to write some code with gen_rtx_*
that is direcly linked against reload*.o and all the support modules.
We can use some macros and/or variables to express things like
'stack slot out of addressable range' or 'stack slot so far out of
addressable range that it needs a tertiary reload'.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
2004-05-05 20:26 ` [Bug optimization/15265] " joern dot rennecke at superh dot com
@ 2004-05-06 13:37 ` matz at suse dot de
2004-05-06 13:40 ` matz at suse dot de
` (12 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: matz at suse dot de @ 2004-05-06 13:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From matz at suse dot de 2004-05-06 13:37 -------
count_occurences should also ignore top-level clobbers, I agree. But that
is tangential to this issue and wouldn't fix it. The occurences of xmm0
are not in top-level destinations. There really are two of them here.
The problem is in the counting of n_inherited. But I don't know the exact
situation where one operand really must be counted twice, therefore I don't
see why it is implemented this way.
I.e. I have difficulties to understand the notion of "inherited multiple
times". In my mind a former output reload either is inherited or not.
It might be inherited by multiple reloads from the current insn indeed. But
this function and loop counting n_inherited only goes over one reload.
Even with SUBREGs or such I have these difficulties. For instance if there is
a "(set (subreg (reg X) 0) plus (subreg (reg X) 0) (subreg (reg X) 0))"
and reg X must be reloaded, but only (!) in the first operand of the plus,
which must match the destination.
This is the same situation I am facing in the testcase (assuming there also
was a former output reload of reg X). But the SUBREGs don't change this at
all. Still there are two occurences of the reload target register (in two
different operands), but only one needs to be reloaded. But the one to be
reloaded is counted twice which is the error I think.
Do you remember situations in which a reload target register needs to be
counted twice in an in-out reload?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
2004-05-05 20:26 ` [Bug optimization/15265] " joern dot rennecke at superh dot com
2004-05-06 13:37 ` matz at suse dot de
@ 2004-05-06 13:40 ` matz at suse dot de
2004-05-06 14:17 ` joern dot rennecke at superh dot com
` (11 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: matz at suse dot de @ 2004-05-06 13:40 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From matz at suse dot de 2004-05-06 13:40 -------
Ah, minor correction: the loop counting n_inherited goes over all reloads.
But this doesn't change anything, as (like in this case) there might be
that the current reload which is inherited is the only one dealing with
this certain reload register.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (2 preceding siblings ...)
2004-05-06 13:40 ` matz at suse dot de
@ 2004-05-06 14:17 ` joern dot rennecke at superh dot com
2004-05-27 9:38 ` [Bug rtl-optimization/15265] " amylaar at gcc dot gnu dot org
` (10 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: joern dot rennecke at superh dot com @ 2004-05-06 14:17 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From joern dot rennecke at superh dot com 2004-05-06 14:17 -------
Subject: Re: delete_output_reload deletes necessary insn
> Even with SUBREGs or such I have these difficulties. For instance if there is
> a "(set (subreg (reg X) 0) plus (subreg (reg X) 0) (subreg (reg X) 0))"
> and reg X must be reloaded, but only (!) in the first operand of the plus,
> which must match the destination.
For some SUBREGs, a USE and/or CLOBBER is placed into the instruction
stream to describe the operand as it looked prior to reloading.
I'm not saying that we must always do double counting; what I'm saying is
that when we eliminate I in some cases, we should check that there isn't
double counting of the operands to match it.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (3 preceding siblings ...)
2004-05-06 14:17 ` joern dot rennecke at superh dot com
@ 2004-05-27 9:38 ` amylaar at gcc dot gnu dot org
2004-05-27 9:48 ` amylaar at gcc dot gnu dot org
` (9 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2004-05-27 9:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From amylaar at gcc dot gnu dot org 2004-05-26 17:05 -------
sh-elf is one of the most (or maybe even the most) affected target
when code in this area of reload is changed. Regression tests are
not possible as long as gcc doesn't build.
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |15521
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (4 preceding siblings ...)
2004-05-27 9:38 ` [Bug rtl-optimization/15265] " amylaar at gcc dot gnu dot org
@ 2004-05-27 9:48 ` amylaar at gcc dot gnu dot org
2004-05-27 10:19 ` amylaar at gcc dot gnu dot org
` (8 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2004-05-27 9:48 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn|15521 |
OtherBugsDependingO| |15521
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (5 preceding siblings ...)
2004-05-27 9:48 ` amylaar at gcc dot gnu dot org
@ 2004-05-27 10:19 ` amylaar at gcc dot gnu dot org
2004-05-27 10:51 ` joern dot rennecke at superh dot com
` (7 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: amylaar at gcc dot gnu dot org @ 2004-05-27 10:19 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
BugsThisDependsOn| |15521
OtherBugsDependingO|15521 |
nThis| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (6 preceding siblings ...)
2004-05-27 10:19 ` amylaar at gcc dot gnu dot org
@ 2004-05-27 10:51 ` joern dot rennecke at superh dot com
2004-06-09 14:09 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: joern dot rennecke at superh dot com @ 2004-05-27 10:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From joern dot rennecke at superh dot com 2004-05-26 17:46 -------
Subject: RFC: reload unit tests (Was: New: delete_output_reload deletes necessary insn)
A problem with reload is that it is very hard to test specifically,
since C code test you write tends look differently at reload
time in different compiler versions. I therefore have set out
to feed raw rtl into reload, for cases which I recall required some
work on reload to get right in the past. It turns out that you actually
need quite a lot of initialization code just to feed rtl into reload.
I've made an executable that is linked basically like cc1, except I
replace main.o with my own code . This is purely for sh-elf at the
moment because I know some interesting test cases for this target,
and creating a new input language hased on rtl is a lot of extra work
and could raise FSF policy issues worse than we had for java bytecode
and precompiled headers. I am not averse to make this more multi-platform,
but there should be a clear consensus what it should look like first,
and some ideas for test cases specific to one or more other platforms
too.
Of course, declarations for the formerly static functions of toplev.c
should be moved into a heder file - or the new code moved into toplev.c .
This is still based on sources from the 10th May because the current
mainline doesn't build for sh-elf
(see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15521) .
2004-05-26 J"orn Rennecke <joern.rennecke@superh.com>
* Makefile.in (rld-tst): New rule.
* toplev.c (general_init, backend_init, lang_dependent_init):
no longer static.
(rld-debug.c): New file.
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1274
diff -p -r1.1274 Makefile.in
*** Makefile.in 28 Apr 2004 20:40:44 -0000 1.1274
--- Makefile.in 26 May 2004 17:17:42 -0000
*************** po/$(PACKAGE).pot: force options.c
*** 3909,3911 ****
--- 3909,3915 ----
$(MAKE) srcextra
AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \
$(XGETTEXT) $(PACKAGE) $(srcdir)
+
+ rld-tst$(exeext): rld-debug.o $(C_OBJS) libbackend.a $(LIBDEPS)
+ $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o rld-tst$(exeext) \
+ rld-debug.o $(C_OBJS) libbackend.a $(LIBS)
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.895
diff -p -r1.895 toplev.c
*** toplev.c 20 Apr 2004 09:27:41 -0000 1.895
--- toplev.c 26 May 2004 17:17:44 -0000
*************** Software Foundation, 59 Temple Place - S
*** 98,108 ****
declarations for e.g. AIX 4.x. */
#endif
! static void general_init (const char *);
static void do_compile (void);
static void process_options (void);
! static void backend_init (void);
! static int lang_dependent_init (const char *);
static void init_asm_output (const char *);
static void finalize (void);
--- 98,108 ----
declarations for e.g. AIX 4.x. */
#endif
! void general_init (const char *);
static void do_compile (void);
static void process_options (void);
! void backend_init (void);
! int lang_dependent_init (const char *);
static void init_asm_output (const char *);
static void finalize (void);
*************** default_tree_printer (pretty_printer * p
*** 2153,2159 ****
/* Initialization of the front end environment, before command line
options are parsed. Signal handlers, internationalization etc.
ARGV0 is main's argv[0]. */
! static void
general_init (const char *argv0)
{
const char *p;
--- 2153,2159 ----
/* Initialization of the front end environment, before command line
options are parsed. Signal handlers, internationalization etc.
ARGV0 is main's argv[0]. */
! void
general_init (const char *argv0)
{
const char *p;
*************** process_options (void)
*** 2490,2496 ****
}
/* Initialize the compiler back end. */
! static void
backend_init (void)
{
init_adjust_machine_modes ();
--- 2490,2496 ----
}
/* Initialize the compiler back end. */
! void
backend_init (void)
{
init_adjust_machine_modes ();
*************** backend_init (void)
*** 2522,2528 ****
}
/* Language-dependent initialization. Returns nonzero on success. */
! static int
lang_dependent_init (const char *name)
{
if (dump_base_name == 0)
--- 2522,2528 ----
}
/* Language-dependent initialization. Returns nonzero on success. */
! int
lang_dependent_init (const char *name)
{
if (dump_base_name == 0)
*** /dev/null Thu Aug 30 21:30:55 2001
--- rld-debug.c Wed May 26 18:25:17 2004
***************
*** 0 ****
--- 1,200 ----
+ /* reload unit test (currently only for sh-elf)
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Joern Rennecke <joern.rennecke@superh.com>
+
+ This file is part of GCC.
+
+ GCC is free software; you can redistribute it and/or modify it under the
+ terms of the GNU General Public License as published by the Free Software
+ Foundation; either version 2, or (at your option) any later version.
+
+ GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ details.
+
+ You should have received a copy of the GNU General Public License along
+ with GCC; see the file COPYING. If not, write to the Free Software
+ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+ #include "config.h"
+ #include "system.h"
+ #include "coretypes.h"
+ #include "tm.h"
+ #include "rtl.h"
+ #include "insn-config.h"
+ #include "reload.h"
+ #include "function.h"
+ #include "regs.h"
+ #include "tree.h"
+ #include "toplev.h"
+ #include "output.h" /* ??? For c_common_init_options */
+ #include "flags.h"
+ #include "c-common.h"
+ #include "debug.h"
+ #include "expr.h"
+ #include "opts.h"
+
+ extern void general_init (const char *);
+ extern void backend_init (void);
+ extern int lang_dependent_init (const char *);
+
+ static struct renumber_s { int from, to; } renumber[9];
+
+ static void
+ autoinc0 (void)
+ {
+ rtx pia = gen_reg_rtx (SImode);
+ rtx pda = gen_reg_rtx (SImode);
+ rtx pi = gen_rtx_POST_INC (Pmode, pia);
+ rtx pd = gen_rtx_PRE_DEC (Pmode, pda);
+
+ emit_insn (gen_movsi (gen_rtx_REG (SImode, R1_REG),
+ gen_rtx_MEM (SImode, copy_rtx (pi))));
+ emit_insn (gen_movsi (gen_rtx_REG (SImode, R2_REG),
+ gen_rtx_MEM (SImode, copy_rtx (pi))));
+ emit_insn (gen_movsi (gen_rtx_MEM (SImode, copy_rtx (pd)),
+ gen_rtx_REG (SImode, R2_REG)));
+ emit_insn (gen_movsi (gen_rtx_MEM (SImode, copy_rtx (pd)),
+ gen_rtx_REG (SImode, R1_REG)));
+ }
+
+ static void
+ autoinc1 (void)
+ {
+ assign_stack_temp (BLKmode, 100, 1);
+ autoinc0 ();
+ }
+
+ static void
+ autoinc2 (void)
+ {
+ assign_stack_temp (BLKmode, 40000, 1);
+ autoinc0 ();
+ }
+
+ static void
+ subreg0 (void)
+ {
+ rtx src = gen_reg_rtx (SImode);
+ emit_insn (gen_add2_insn (gen_rtx_REG (SImode, R1_REG), src));
+ emit_insn (gen_movhi (gen_rtx_REG (HImode, R2_REG),
+ gen_rtx_SUBREG (HImode, src,
+ BYTES_BIG_ENDIAN ? 2 : 0)));
+ }
+
+ static void
+ subreg1 (void)
+ {
+ rtx r1 = gen_reg_rtx (SImode);
+ rtx r2 = gen_reg_rtx (HImode);
+ rtx src = gen_reg_rtx (SImode);
+
+ assign_stack_temp (BLKmode, 8, 1);
+ renumber[0].from = REGNO (r1);
+ renumber[0].to = R1_REG;
+ emit_insn (gen_add2_insn (r1, src));
+ emit_insn (gen_movhi (r2,
+ gen_rtx_SUBREG (HImode, src,
+ BYTES_BIG_ENDIAN ? 2 : 0)));
+ }
+
+ static void
+ init_once (int argc, const char **argv)
+ {
+ general_init (argv[0]);
+ decode_options (argc, argv);
+
+ c_common_init_options (argc, argv);
+ debug_hooks = &do_nothing_debug_hooks;
+
+ backend_init ();
+
+ lang_dependent_init (NULL);
+
+ init_flow ();
+ }
+
+ static void
+ rld_debug (const char *fun_name, void (*fun_gen) (void))
+ {
+ rtx insns;
+ struct function this_fun;
+ struct expr_status this_expr;
+ tree fun_id, fun_type, block;
+ struct renumber_s *p;
+
+ printf ("Running test: %s\n", fun_name);
+ fun_id = get_identifier (fun_name);
+ fun_type = default_function_type;
+ current_function_decl = build_decl (FUNCTION_DECL, fun_id, fun_type);
+ block = make_node (BLOCK);
+ DECL_INITIAL (current_function_decl) = block;
+ memset (&this_fun, 0, sizeof this_fun);
+ this_fun.decl = current_function_decl;
+ cfun = &this_fun;
+ cfun->expr = &this_expr;
+ memset (&this_expr, 0, sizeof this_expr);
+ init_emit ();
+ memset (renumber, 0, sizeof renumber);
+
+ cfun->expr = &this_expr;
+ memset (&this_expr, 0, sizeof this_expr);
+
+ reload_completed = 0;
+ epilogue_completed = 0;
+ flow2_completed = 0;
+ no_new_pseudos = 0;
+
+ (*fun_gen) ();
+
+ insns = get_insns ();
+
+ instantiate_virtual_regs (current_function_decl, insns);
+
+ max_regno = max_reg_num ();
+
+ rtl_register_cfg_hooks ();
+ find_basic_blocks (insns, max_regno, NULL);
+ regclass_init ();
+ life_analysis (insns, NULL,
+ PROP_DEATH_NOTES | PROP_LOG_LINKS | PROP_REG_INFO);
+
+ no_new_pseudos = 1;
+ regclass (insns, max_regno, NULL);
+
+ /* Allocate the reg_renumber array. */
+ allocate_reg_info (max_regno, FALSE, TRUE);
+
+ for (p = renumber; p->from != p->to; p++)
+ reg_renumber[p->from] = p->to;
+ /* Allocate the reg_equiv_memory_loc array. */
+ reg_equiv_memory_loc = xcalloc (max_regno, sizeof (rtx)); /* FIXME */
+
+ build_insn_chain (insns);
+ reload (insns, 0);
+
+ debug_rtx_list(get_insns(),999);
+ }
+
+ static struct { const char *name; void (*gen_fun) (void); } test_list[]
+ = {
+ { "subreg inheritance", subreg1 },
+ { "auto-increment inheritance", autoinc0 },
+ { "auto-increment inheritance w/ medium stack temp", autoinc1 },
+ { "auto-increment inheritance w/ large stack temp", autoinc2 },
+ { "subreg inheritance", subreg0 },
+ };
+
+ int
+ main (int argc, const char **argv)
+ {
+ unsigned i;
+
+ optimize = 2;
+ flag_expensive_optimizations = 1;
+ init_once (argc, argv);
+ for (i = 0; i < ARRAY_SIZE (test_list); i++)
+ rld_debug (test_list[i].name, test_list[i].gen_fun);
+ exit (0);
+ }
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (7 preceding siblings ...)
2004-05-27 10:51 ` joern dot rennecke at superh dot com
@ 2004-06-09 14:09 ` pinskia at gcc dot gnu dot org
2004-10-05 0:56 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-09 14:09 UTC (permalink / raw)
To: gcc-bugs
--
Bug 15265 depends on bug 15521, which changed state.
Bug 15521 Summary: [3.5 Regression] sched1 extends life of hard registers on SMALL_REGISTER_CLASSES targets when exceptions are enabled
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15521
What |Old Value |New Value
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (8 preceding siblings ...)
2004-06-09 14:09 ` pinskia at gcc dot gnu dot org
@ 2004-10-05 0:56 ` pinskia at gcc dot gnu dot org
2005-08-11 13:07 ` rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-05 0:56 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (9 preceding siblings ...)
2004-10-05 0:56 ` pinskia at gcc dot gnu dot org
@ 2005-08-11 13:07 ` rguenth at gcc dot gnu dot org
2005-08-11 16:13 ` matz at suse dot de
` (3 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2005-08-11 13:07 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From rguenth at gcc dot gnu dot org 2005-08-11 13:07 -------
4.1.0, 4.0.2 and 3.4.5 work with all -O0 -O1 -O2 -O3.
gcc (GCC) 3.3.3 (SuSE Linux) and gcc 3.3.6 abort with -O1.
I guess this is RESOLVED FIXED as far as gcc bugzilla is concerned?
--
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |3.3.3 3.3.6
Known to work| |4.1.0 4.0.2 3.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (10 preceding siblings ...)
2005-08-11 13:07 ` rguenth at gcc dot gnu dot org
@ 2005-08-11 16:13 ` matz at suse dot de
2005-08-11 17:05 ` giovannibajo at libero dot it
` (2 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: matz at suse dot de @ 2005-08-11 16:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From matz at suse dot de 2005-08-11 16:13 -------
I don't think this is actually fixed in reload1.c. Perhaps it is hidden
by other changes, so that the particular miscompilation doesn't happen
anymore, but even HEAD reload1.c contains the questionable double counting
of inherited operands. Might be with enough work (perhaps by disabling
some tree-ssa passes, but retaining -O1) we can still make it fail with
mainline.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (11 preceding siblings ...)
2005-08-11 16:13 ` matz at suse dot de
@ 2005-08-11 17:05 ` giovannibajo at libero dot it
2005-08-12 9:08 ` bernds_cb1 at t-online dot de
2005-08-12 9:35 ` giovannibajo at libero dot it
14 siblings, 0 replies; 18+ messages in thread
From: giovannibajo at libero dot it @ 2005-08-11 17:05 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2005-08-11 17:05 -------
Bernd, do you believe this is taken care of by the reload branch?
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |bernds at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (12 preceding siblings ...)
2005-08-11 17:05 ` giovannibajo at libero dot it
@ 2005-08-12 9:08 ` bernds_cb1 at t-online dot de
2005-08-12 9:35 ` giovannibajo at libero dot it
14 siblings, 0 replies; 18+ messages in thread
From: bernds_cb1 at t-online dot de @ 2005-08-12 9:08 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bernds_cb1 at t-online dot de 2005-08-12 09:07 -------
The reload-branch takes apart all this code, so there's a good chance it's
fixed. That doesn't mean we shouldn't try to get it right in the mainline...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
` (13 preceding siblings ...)
2005-08-12 9:08 ` bernds_cb1 at t-online dot de
@ 2005-08-12 9:35 ` giovannibajo at libero dot it
14 siblings, 0 replies; 18+ messages in thread
From: giovannibajo at libero dot it @ 2005-08-12 9:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From giovannibajo at libero dot it 2005-08-12 09:35 -------
Sure, but it's a good start. I read on http://gcc.gnu.org/wiki/BerndSchmidt
that the reload-branch would need some testing/fixing on autoinc target. Maybe
Joern might be interested in giving a look at it.
Also integrating the reload unit-tester in the branch would be a good step
forward -- we really need a better way to test for reload features!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
[not found] <bug-15265-183@http.gcc.gnu.org/bugzilla/>
2005-10-27 16:47 ` pinskia at gcc dot gnu dot org
@ 2009-06-22 22:17 ` steven at gcc dot gnu dot org
1 sibling, 0 replies; 18+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-06-22 22:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from steven at gcc dot gnu dot org 2009-06-22 22:17 -------
Three and a half year of nothing. Dead horse.
=> Closing. If something shows up, open a new bug report please.
--
steven at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Known to work|4.1.0 4.0.2 3.4.5 |4.1.0 4.0.2 3.4.5 4.4.1
| |4.5.0
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
* [Bug rtl-optimization/15265] delete_output_reload deletes necessary insn
[not found] <bug-15265-183@http.gcc.gnu.org/bugzilla/>
@ 2005-10-27 16:47 ` pinskia at gcc dot gnu dot org
2009-06-22 22:17 ` steven at gcc dot gnu dot org
1 sibling, 0 replies; 18+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-27 16:47 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2005-10-27 16:47:16
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15265
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2009-06-22 22:17 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-03 15:21 [Bug optimization/15265] New: delete_output_reload deletes necessary insn matz at suse dot de
2004-05-05 20:26 ` [Bug optimization/15265] " joern dot rennecke at superh dot com
2004-05-06 13:37 ` matz at suse dot de
2004-05-06 13:40 ` matz at suse dot de
2004-05-06 14:17 ` joern dot rennecke at superh dot com
2004-05-27 9:38 ` [Bug rtl-optimization/15265] " amylaar at gcc dot gnu dot org
2004-05-27 9:48 ` amylaar at gcc dot gnu dot org
2004-05-27 10:19 ` amylaar at gcc dot gnu dot org
2004-05-27 10:51 ` joern dot rennecke at superh dot com
2004-06-09 14:09 ` pinskia at gcc dot gnu dot org
2004-10-05 0:56 ` pinskia at gcc dot gnu dot org
2005-08-11 13:07 ` rguenth at gcc dot gnu dot org
2005-08-11 16:13 ` matz at suse dot de
2005-08-11 17:05 ` giovannibajo at libero dot it
2005-08-12 9:08 ` bernds_cb1 at t-online dot de
2005-08-12 9:35 ` giovannibajo at libero dot it
[not found] <bug-15265-183@http.gcc.gnu.org/bugzilla/>
2005-10-27 16:47 ` pinskia at gcc dot gnu dot org
2009-06-22 22:17 ` steven at gcc dot gnu dot org
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).