backport: re PR rtl-optimization/54455 (ICE: RTL check: expected elt 3 type 'B', have '0' (rtx barrier) in compute_bb_for_insn, at cfgrtl.c:418)

2012-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2012-09-06  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/54455
	* sel-sched-ir.c (maybe_tidy_empty_bb): Give up if previous fallthru
	bb ends up with asm goto referencing bb's label.

	* gcc.dg/54455.c: New test.

From-SVN: r191060
This commit is contained in:
Jakub Jelinek 2012-09-07 11:35:21 +02:00 committed by Jakub Jelinek
parent ab1c58629a
commit 13c3bd95b2
4 changed files with 59 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2012-09-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2012-09-06 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/54455
* sel-sched-ir.c (maybe_tidy_empty_bb): Give up if previous fallthru
bb ends up with asm goto referencing bb's label.
2012-09-07 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Backport from mainline.

View File

@ -1,5 +1,5 @@
/* Instruction scheduling pass. Selective scheduler and pipeliner.
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GCC.
@ -3680,6 +3680,22 @@ maybe_tidy_empty_bb (basic_block bb)
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & EDGE_COMPLEX)
return false;
else if (e->flags & EDGE_FALLTHRU)
{
rtx note;
/* If prev bb ends with asm goto, see if any of the
ASM_OPERANDS_LABELs don't point to the fallthru
label. Do not attempt to redirect it in that case. */
if (JUMP_P (BB_END (e->src))
&& (note = extract_asm_operands (PATTERN (BB_END (e->src)))))
{
int i, n = ASM_OPERANDS_LABEL_LENGTH (note);
for (i = 0; i < n; ++i)
if (XEXP (ASM_OPERANDS_LABEL (note, i), 0) == BB_HEAD (bb))
return false;
}
}
free_data_sets (bb);

View File

@ -1,3 +1,11 @@
2012-09-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2012-09-06 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/54455
* gcc.dg/54455.c: New test.
2012-09-06 Andrew Pinski <apinski@cavium.com>
PR tree-opt/54494

View File

@ -0,0 +1,25 @@
/* PR rtl-optimization/54455 */
/* { dg-do compile } */
/* { dg-options "-O1 -fschedule-insns -fselective-scheduling --param max-sched-extend-regions-iters=2" } */
extern void fn1 (void), fn2 (void);
static inline __attribute__((always_inline)) int
foo (int *x, long y)
{
asm goto ("" : : "r" (x), "r" (y) : "memory" : lab);
return 0;
lab:
return 1;
}
void
bar (int *x)
{
if (foo (x, 23))
fn1 ();
else
fn2 ();
foo (x, 2);
}