jump.c (squeeze_notes): Return true if no real insns were found.

* jump.c (squeeze_notes): Return true if no real insns were found.
	* rtl.h (squeeze_notes): Adjust prototype.
	* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): If
	squeeze_notes finds no real instructions, abort.
	(merge_blocks_move_successor_nojumps): Likewise.
	* loop.c (find_and_verify_loops): Likewise.
	* stmt.c (expand_end_case): Likewise.
	* ifcvt.c (dead_or_predicable): Return TRUE if squeeze_notes doesn't
	find any real instructions.

	* gcc.c-torture/compile/20011114-4.c: New test.

From-SVN: r47048
This commit is contained in:
Jakub Jelinek 2001-11-15 11:28:52 +01:00 committed by Jakub Jelinek
parent 36a68fe705
commit 2b7d71b2b9
9 changed files with 71 additions and 11 deletions

View file

@ -1,3 +1,15 @@
2001-11-15 Jakub Jelinek <jakub@redhat.com>
* jump.c (squeeze_notes): Return true if no real insns were found.
* rtl.h (squeeze_notes): Adjust prototype.
* cfgcleanup.c (merge_blocks_move_predecessor_nojumps): If
squeeze_notes finds no real instructions, abort.
(merge_blocks_move_successor_nojumps): Likewise.
* loop.c (find_and_verify_loops): Likewise.
* stmt.c (expand_end_case): Likewise.
* ifcvt.c (dead_or_predicable): Return TRUE if squeeze_notes doesn't
find any real instructions.
2001-11-15 Neil Booth <neil@daikokuya.demon.co.uk>
* c-common.c: Include c-lex.h.

View file

@ -329,7 +329,8 @@ merge_blocks_move_predecessor_nojumps (a, b)
and adjust the block trees appropriately. Even better would be to have
a tighter connection between block trees and rtl so that this is not
necessary. */
squeeze_notes (&a->head, &a->end);
if (squeeze_notes (&a->head, &a->end))
abort ();
/* Scramble the insn chain. */
if (a->end != PREV_INSN (b->head))
@ -393,7 +394,8 @@ merge_blocks_move_successor_nojumps (a, b)
and adjust the block trees appropriately. Even better would be to have
a tighter connection between block trees and rtl so that this is not
necessary. */
squeeze_notes (&b->head, &b->end);
if (squeeze_notes (&b->head, &b->end))
abort ();
/* Scramble the insn chain. */
reorder_insns_nobb (b->head, b->end, a->end);

View file

@ -2659,7 +2659,8 @@ dead_or_predicable (test_bb, merge_bb, other_bb, new_dest, reversep)
if (end == merge_bb->end)
merge_bb->end = PREV_INSN (head);
squeeze_notes (&head, &end);
if (squeeze_notes (&head, &end))
return TRUE;
reorder_insns (head, end, PREV_INSN (earliest));
}

View file

@ -541,9 +541,10 @@ duplicate_loop_exit_test (loop_start)
/* Move all block-beg, block-end, loop-beg, loop-cont, loop-vtop, loop-end,
notes between START and END out before START. START and END may be such
notes. Returns the values of the new starting and ending insns, which
may be different if the original ones were such notes. */
may be different if the original ones were such notes.
Return true if there were only such notes and no real instructions. */
void
bool
squeeze_notes (startp, endp)
rtx* startp;
rtx* endp;
@ -584,15 +585,15 @@ squeeze_notes (startp, endp)
last = insn;
}
/* There were no real instructions, and we can't represent an empty
range. Die. */
/* There were no real instructions. */
if (start == past_end)
abort ();
return true;
end = last;
*startp = start;
*endp = end;
return false;
}
/* Return the label before INSN, or put a new label there. */

View file

@ -2748,7 +2748,8 @@ find_and_verify_loops (f, loops)
/* Include the BARRIER after INSN and copy the
block after LOC. */
squeeze_notes (&new_label, &last_insn_to_move);
if (squeeze_notes (&new_label, &last_insn_to_move))
abort ();
reorder_insns (new_label, last_insn_to_move, loc);
/* All those insns are now in TARGET_LOOP. */

View file

@ -1340,7 +1340,7 @@ extern void mark_jump_label PARAMS ((rtx, rtx, int));
extern void cleanup_barriers PARAMS ((void));
/* In jump.c */
extern void squeeze_notes PARAMS ((rtx *, rtx *));
extern bool squeeze_notes PARAMS ((rtx *, rtx *));
extern rtx delete_related_insns PARAMS ((rtx));
extern void delete_jump PARAMS ((rtx));
extern void delete_barrier PARAMS ((rtx));

View file

@ -5598,7 +5598,8 @@ expand_end_case (orig_index)
before_case = NEXT_INSN (before_case);
end = get_last_insn ();
squeeze_notes (&before_case, &end);
if (squeeze_notes (&before_case, &end))
abort ();
reorder_insns (before_case, end,
thiscase->data.case_stmt.start);
}

View file

@ -1,3 +1,7 @@
2001-11-15 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/compile/20011114-4.c: New test.
2001-11-15 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/other/init1.C: New test.

View file

@ -0,0 +1,38 @@
static inline int foo (long x)
{
register int a = 0;
register unsigned b;
do
{
b = (x & 0x7f);
x = (x >> 7) | ~(-1L >> 7);
a += 1;
}
while ((x != 0 || (b & 0x40) != 0) && (x != -1 || (b & 0x40) == 0));
return a;
}
static inline int bar (unsigned long x)
{
register int a = 0;
register unsigned b;
do
{
b = (x & 0x7f);
x >>= 7;
a++;
}
while (x != 0);
return a;
}
int
baz (unsigned long x, int y)
{
if (y)
return foo ((long) x);
else
return bar (x);
}