[PATCH] problems with bb-reorder.c rewrite
Richard Earnshaw
rearnsha@arm.com
Sat Mar 15 17:05:00 GMT 2003
> Michael Hayes <m.hayes@elec.canterbury.ac.nz> writes:
>
> |> Richard Henderson writes:
> |> > On Sat, Mar 08, 2003 at 03:42:34PM +1300, Michael Hayes wrote:
> |> > > * function.c (thread_prologue_and_epilogue_insns): Use redirect_jump
> |> > > for conditional return.
> |> >
> |> > Exactly. Thanks.
> |>
> |> Ta. I've committed this to 3.3 and head.
>
> Breaks bootstrap on ia64 (both branches):
>
> stage1/xgcc -Bstage1/ -B/usr/local/ia64-suse-linux/bin/ -c -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -fno-common -Werror -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config -I../../gcc/../include ../../gcc/ifcvt.c -o ifcvt.o
> ../../gcc/ifcvt.c: In function `count_bb_insns':
> ../../gcc/ifcvt.c:134: internal compiler error: Segmentation fault
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
I get an abort on arm-netbsd as well, though for a different reason (I
think). It seems that this change has made generation of conditional
return instructions more aggressive, and so we trip a latent bug in
if-conversion.
in find_if_case_1 we convert a sequence of the form
bb n
(cond a (return))
bb p
(insn)
(jump x)
into
bb n
(cond ~a (insn))
(cond ~a (jump x))
bb p
(return)
but in doing so we delete the original bb p and then add another one with
the same bb number. However, when we deleted the old p we removed the
dominance information; but when we insert the new p we don't update the
dominance information. Consequently when we try to convert the return
into a conditional one (with a second call to find_if_case_1) we abort
when trying to delete a dominance entry that doesn't exist.
This can be fixed with the following patch. Richard, does this look ok?
I'm not particularly familiar with the way the dominance code works:
<date> Richard Earnshaw <rearnsha@arm.com>
* ifcvt.c (find_if_case_1): If we add a new bb, update the dominance
information.
-------------- next part --------------
Index: ifcvt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ifcvt.c,v
retrieving revision 1.112
diff -p -r1.112 ifcvt.c
*** ifcvt.c 24 Jan 2003 02:59:58 -0000 1.112
--- ifcvt.c 15 Mar 2003 16:58:05 -0000
*************** find_if_case_1 (test_bb, then_edge, else
*** 2741,2746 ****
--- 2741,2748 ----
{
new_bb->index = then_bb_index;
BASIC_BLOCK (then_bb_index) = new_bb;
+ if (post_dominators)
+ add_to_dominance_info (post_dominators, new_bb);
}
/* We've possibly created jump to next insn, cleanup_cfg will solve that
later. */
More information about the Gcc-patches
mailing list