This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Another bootstrap failure on vax: label referred to in addr_vec deleted when basic block is moved to the fallthru position a
- To: jh at suse dot cz (Jan Hubicka)
- Subject: Re: Another bootstrap failure on vax: label referred to in addr_vec deleted when basic block is moved to the fallthru position a
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- Date: Sat, 29 Sep 2001 10:24:17 -0400 (EDT)
- Cc: gcc-bugs at gcc dot gnu dot org, jh at suse dot cz
> > Clearly, the label shouldn't have been deleted because there were still
> > references to it in the addr_diff_vec.
> This is weird.
> If there is jumptable juping to the label, there should be edge that prevents
> label from being deleted.
> Moment - is it the case where fallthru edge of jump table and one of
> destinations gets identical? In that case CFG code sees the edge as "FALLHTUR"
> and don't consider need to keep the label.
>
> The code checks for posibility of conditional jumps with equivalent destinations:
>
> if (b->pred->pred_next == NULL
> && (b->pred->flags & EDGE_FALLTHRU)
> && !(b->pred->flags & EDGE_COMPLEX)
> && GET_CODE (b->head) == CODE_LABEL
> && (!(mode & CLEANUP_PRE_SIBCALL)
> || !tail_recursion_label_p (b->head))
> /* If previous block ends with condjump jumping to next BB,
> we can't delete the label. */
> && (b->pred->src == ENTRY_BLOCK_PTR
> || !reg_mentioned_p (b->head, b->pred->src->end)))
> Here we need to add something like:
> && (!tablejump_p (b->pred->src->end)
> || !reg_mentioned_p (b->head, NEXT_INSN (JUMP_LABEL (b->pred->src->end))))
>
> I will try to send full patch tomorrow, but today I must leave.
Enclosed is the patch that I worked out to fix the problem. However, in
testing, I hit new problems:
1) vax:
stage1/xgcc -Bstage1/ -B/usr/local/vax-dec-ultrix4.3/bin/ -c -DIN_GCC -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/config -I../../gcc/../include ../../gcc/cpplex.c -o cpplex.o
../../gcc/cpplex.c: In function `cpp_parse_escape':
../../gcc/cpplex.c:1980: Internal compiler error in fixup_var_refs_1, at function.c:1932
2) pa:
gcc -o c++filt -DIN_GCC -g -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wtraditional -pedantic -Wno-long-long -DHAVE_CONFIG_H \
cxxmain.o underscore.o obstack.o -lintl ../libiberty/libiberty.a
cd ../../gcc && makeinfo -I doc -I doc/include -o doc/cpp.info doc/cpp.texi
cd ../../gcc && makeinfo -I doc -I doc/include -o doc/gcc.info doc/gcc.texi
doc/invoke.texi:3417: No matching `@end table'.
makeinfo: Removing output file `doc/gcc.info' due to errors; use --force to preserve.
I don't think I will get any more time this weekend to work on these problems.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2001-09-28 John David Anglin <dave@hiauly1.hia.nrc.ca>
* cfgcleanup.c (label_mentioned_p): New function.
(try_optimize_cfg): Use it.
--- cfgcleanup.c.orig Fri Sep 21 18:29:23 2001
+++ cfgcleanup.c Fri Sep 28 16:09:38 2001
@@ -52,6 +52,7 @@
rtx *, rtx *));
static bool delete_unreachable_blocks PARAMS ((void));
+static bool label_mentioned_p PARAMS ((rtx, rtx));
static bool tail_recursion_label_p PARAMS ((rtx));
static void merge_blocks_move_predecessor_nojumps PARAMS ((basic_block,
basic_block));
@@ -248,6 +249,22 @@
return changed;
}
+/* Return true if LABEL is mentioned in any insn from INSN up to
+ but not including the label. */
+
+static bool
+label_mentioned_p (label, insn)
+ rtx label, insn;
+{
+ rtx x;
+
+ for (x = insn; x != label; x = NEXT_INSN (x))
+ if (reg_mentioned_p (label, x))
+ return true;
+
+ return false;
+}
+
/* Return true if LABEL is used for tail recursion. */
static bool
@@ -1096,7 +1113,7 @@
/* If previous block ends with condjump jumping to next BB,
we can't delete the label. */
&& (b->pred->src == ENTRY_BLOCK_PTR
- || !reg_mentioned_p (b->head, b->pred->src->end)))
+ || !label_mentioned_p (b->head, b->pred->src->end)))
{
rtx label = b->head;
b->head = NEXT_INSN (b->head);