This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed] PR20557: Use can_duplicate_block_p in duplicate_computed_gotos
- From: Roger Sayle <roger at eyesopen dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Mar 2005 15:12:04 -0700 (MST)
- Subject: [Committed] PR20557: Use can_duplicate_block_p in duplicate_computed_gotos
The following patch resolves PR20557 which is an ICE-on-valid regression
on mainline. The issue is related to PR rtl-optimization/20117 where we'd
try to duplicate a basic block in duplicate_computed_gotos. Unfortunately,
Kaz Kojima's fix to 20117 wasn't correct, there are other reasons for a
basic block to be non-duplicable other than it containing a noncopyable
insn. This patch corrects/tweaks Kaz's solution to correctly call
can_duplicate_block_p instead.
The following patch has been tested on both i686-pc-linux-gnu and
hppa2.0w-hp-hpux11.00 with a full "make bootstrap", all default languages
and regression tested with a top-level "make -k check" with no new
failures.
Committed to mainline CVS.
2005-03-21 Roger Sayle <roger@eyesopen.com>
PR middle-end/20557
* bb-reorder.c (duplicate_computed_gotos): Use can_duplicate_block_p
to determine whether a block can be duplicated, rather than test
whether the block contains noncopyable insns ourselves.
Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
retrieving revision 1.94
diff -c -3 -p -r1.94 bb-reorder.c
*** bb-reorder.c 11 Mar 2005 09:04:47 -0000 1.94
--- bb-reorder.c 21 Mar 2005 02:41:39 -0000
*************** duplicate_computed_gotos (void)
*** 2047,2070 ****
int size = 0;
FOR_BB_INSNS (bb, insn)
! {
! if (INSN_P (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;
! }
! if (size <= max_size)
bitmap_set_bit (candidates, bb->index);
}
}
--- 2047,2061 ----
int size = 0;
FOR_BB_INSNS (bb, insn)
! if (INSN_P (insn))
! {
! size += get_attr_length (insn);
! if (size > max_size)
! break;
! }
! if (size <= max_size
! && can_duplicate_block_p (bb))
bitmap_set_bit (candidates, bb->index);
}
}
Roger
--