[PATCH/RFA] Don't duplicate noncopyable insns
Kaz Kojima
kkojima@rr.iij4u.or.jp
Wed Feb 16 19:59:00 GMT 2005
Hi,
2 tests of libjava began to fail on sh4-unknown-linux-gnu from
20050202 mainline because of the duplicated labels. It seems
2005-02-01 Steven Bosscher <stevenb@suse.de>
PR optimization/15242
* params.def (PARAM_MAX_GOTO_DUPLICATION_INSNS): New param.
* basic-block.h (duplicate_computed_gotos): Add prototype.
* bb-reorder.c (duplicate_computed_gotos): New function to
duplicate sufficiently small blocks ending in a computed jump.
...
causes it. duplicate_computed_gotos may duplicate a block but
unfortunately SH has noncopyable insns in PIC case. The attached
patch takes noncopyable insns into account.
This problem may cause a latent bug for alpha and s390 which
also have noncopyable insns, though I'm not sure about it.
The patch is tesetd with bootstrap and make -k check with no new
failures for sh4-unknown-linux-gnu and i686-unknown-linux-gnu.
Regards,
kaz
--
2005-02-16 Kaz Kojima <kkojima@gcc.gnu.org>
* bb-reorder.c (duplicate_computed_gotos): Don't duplicate
the block including noncopyable insn.
diff -uprN ORIG/gcc/gcc/bb-reorder.c LOCAL/gcc/gcc/bb-reorder.c
--- ORIG/gcc/gcc/bb-reorder.c 2005-02-16 11:25:59.000000000 +0900
+++ LOCAL/gcc/gcc/bb-reorder.c 2005-02-16 15:11:26.743995515 +0900
@@ -2050,7 +2050,17 @@ duplicate_computed_gotos (void)
FOR_BB_INSNS (bb, insn)
{
if (INSN_P (insn))
- size += get_attr_length (insn);
+ {
+ /* If the insn isn't copyable, don't duplicate
+ the block. */
+ if (targetm.cannot_copy_insn_p
+ && targetm.cannot_copy_insn_p (insn))
+ {
+ size = max_size + 1;
+ break;
+ }
+ size += get_attr_length (insn);
+ }
if (size > max_size)
break;
}
More information about the Gcc-patches
mailing list