This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: scheduling vs variable arrays (revised)
- From: Dale Johannesen <dalej at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 12 Aug 2002 16:08:59 -0700
- Subject: Patch: scheduling vs variable arrays (revised)
This adds a memory clobber following a block containing variable arrays,
to prevent the scheduler from moving references to such arrays below
the stack pop. (As suggested by Richard Henderson, thanks.)
Bootstrapped on Darwin.
The main change from last time is this: only mem:BLK clobbers are
preserved
in reload1.c. Lreg adds other clobbers which are not in the places control
flow permits clobbers, so these must be removed as before. All these
clobbers
appear to be register-sized (they come from this code:
/* If a memory reference remains (either as a MEM or a pseudo that
did not get a hard register), yet we can't make an optional
reload, check if this is actually a pseudo register reference;
we then need to emit a USE and/or a CLOBBER so that reload
inheritance will do the right thing. */
in find_reloads) so preserving mem:BLK clobbers only ought to work, and
does for my bootstrap.
After reading the posts by Richard Henderson and Geoff Keating I'm quite
confused as to whether the clobber should use SCRATCH or reg_stack_pointer.
Both ways bootstrap for me, so let me know. (but I am unable to try Ada).
I'm unable to provide a completely reproducible test case. The attached
case currently fails reliably with -Os on Darwin x86, but is sensitive to
the incoming value of EBP%16, so this is a long way from portable. The
reason for the failure is this code:
movl -16(%ebp), %esp ; pop of variable arrays
pushl %eax ; clobbers (%esi)
pushl (%esi) ; dangling reference to variable array
call L_baz$stub
2002-08-12 Dale Johannesen <dalej@apple.com>
* explow.c (emit_stack_restore): Emit a memory clobber
preceding the stack pop, to prevent the scheduler from
moving refs to variable arrays below this pop.
* reload1.c (reload): Preserve this clobber for sched2.
* doc/rtl.texi: Document clobber (mem:BLK (scratch)).
Attachment:
diffs.patch
Description: Binary data
Attachment:
bogus.c
Description: Text document