This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/35045] [4.3 Regression] gcc-4.3 generates wrong code on i386 with -O3
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Feb 2008 14:08:32 -0000
- Subject: [Bug target/35045] [4.3 Regression] gcc-4.3 generates wrong code on i386 with -O3
- References: <bug-35045-8932@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #16 from rguenth at gcc dot gnu dot org 2008-02-01 14:08 -------
The problem is that we retain
(insn 38 32 61 4 test-cacoshf.c:16 (clobber (reg/i:SC 0 ax)) -1 (nil))
after postreload and gcse rightfully assumes such clobbers are removed
(and hoists over them). They are supposed to be removed by reload1.c:reload()
which does
/* Make a pass over all the insns and delete all USEs which we inserted
only to tag a REG_EQUAL note on them. Remove all REG_DEAD and REG_UNUSED
notes. Delete all CLOBBER insns, except those that refer to the return
value and the special mem:BLK CLOBBERs added to prevent the scheduler
from misarranging variable-array code, and simplify (subreg (reg))
operands. Also remove all REG_RETVAL and REG_LIBCALL notes since they
are no longer useful or accurate. Strip and regenerate REG_INC notes
that may have been moved around. */
...
&& (!REG_P (XEXP (PATTERN (insn), 0))
|| ! REG_FUNCTION_VALUE_P (XEXP (PATTERN (insn), 0)))))
{
delete_insn (insn);
continue;
}
where the exception for return value clobbers was added by rth with
r30401 | rth | 1999-11-05 01:35:10 +0100 (Fri, 05 Nov 1999) | 9 lines
* function.c (diddle_return_value): New.
(expand_function_end): Use it.
* stmt.c (expand_null_return): Likewise.
(expand_value_return): Likewise.
* reg-stack.c (subst_stack_regs_pat): Handle clobbers at top-level.
* reload1.c (reload): Don't remove return value clobbers.
seemingly as an optimization(?) with stmt.c:expand_null_return():
void
expand_null_return (void)
{
/* If this function was declared to return a value, but we
didn't, clobber the return registers so that they are not
propagated live to the rest of the function. */
clobber_return_register ();
which doesn't make sense to me (_which_ rest of the function?). Maybe
this refers to missed optimizations with the RTL inliner?
Removing this restriction from reload fixes this problem.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35045