summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authormkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-17 08:48:37 +0000
committermkuvyrkov <mkuvyrkov@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-17 08:48:37 +0000
commit6fcfdb19d48536721bed5e00b79c0942e8b8ee28 (patch)
treebad9e0947d0370b8e14e1ea87041d779fe235cdb /gcc
parent318a328178a8984bb2a0cc17e8c23ed21015b5fe (diff)
downloadgcc-6fcfdb19d48536721bed5e00b79c0942e8b8ee28.tar.gz
2006-08-17 Maxim Kuvyrkov <mkuvyrkov@ispras.ru>
PR rtl-optimization/28489 * sched-ebb.c (begin_schedule_ready): Create basic block at the right place. (advance_target_bb): Skip empty blocks. * haifa-sched.c (bb_note): Make global. * sched-int.h (bb_note): Add prototype. 2006-08-17 Maxim Kuvyrkov <mkuvyrkov@ispras.ru> PR rtl-optimization/28489 * gcc.c-torture/compile/pr28489.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116214 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/haifa-sched.c3
-rw-r--r--gcc/sched-ebb.c18
-rw-r--r--gcc/sched-int.h1
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr28489.c48
6 files changed, 78 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e8c816ad804..240bddba2fd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2006-08-17 Maxim Kuvyrkov <mkuvyrkov@ispras.ru>
+
+ PR rtl-optimization/28489
+ * sched-ebb.c (begin_schedule_ready): Create basic block
+ at the right place.
+ (advance_target_bb): Skip empty blocks.
+ * haifa-sched.c (bb_note): Make global.
+ * sched-int.h (bb_note): Add prototype.
+
2006-08-16 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/27865
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 3111ee9e76a..78adee5723a 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -593,7 +593,6 @@ static void free_glat (void);
static void sched_remove_insn (rtx);
static void clear_priorities (rtx);
static void add_jump_dependencies (rtx, rtx);
-static rtx bb_note (basic_block);
static void calc_priorities (rtx);
#ifdef ENABLE_CHECKING
static int has_edge_p (VEC(edge,gc) *, int);
@@ -4549,7 +4548,7 @@ add_jump_dependencies (rtx insn, rtx jump)
}
/* Return the NOTE_INSN_BASIC_BLOCK of BB. */
-static rtx
+rtx
bb_note (basic_block bb)
{
rtx note;
diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
index d7a3db9b61d..b220348da7b 100644
--- a/gcc/sched-ebb.c
+++ b/gcc/sched-ebb.c
@@ -166,7 +166,8 @@ begin_schedule_ready (rtx insn, rtx last)
gcc_assert (NOTE_INSN_BASIC_BLOCK_P (BB_END (bb)));
}
else
- bb = create_basic_block (insn, 0, last_bb);
+ /* Create an empty unreachable block after the INSN. */
+ bb = create_basic_block (NEXT_INSN (insn), NULL_RTX, last_bb);
/* split_edge () creates BB before E->DEST. Keep in mind, that
this operation extends scheduling region till the end of BB.
@@ -728,10 +729,19 @@ advance_target_bb (basic_block bb, rtx insn)
else
return 0;
}
- else if (bb != last_bb)
- return bb->next_bb;
else
- gcc_unreachable ();
+ /* Return next non empty block. */
+ {
+ do
+ {
+ gcc_assert (bb != last_bb);
+
+ bb = bb->next_bb;
+ }
+ while (bb_note (bb) == BB_END (bb));
+
+ return bb;
+ }
}
/* Fix internal data after interblock movement of jump instruction.
diff --git a/gcc/sched-int.h b/gcc/sched-int.h
index bee8a98fff6..3ce0379ce43 100644
--- a/gcc/sched-int.h
+++ b/gcc/sched-int.h
@@ -637,6 +637,7 @@ extern void * xrecalloc (void *, size_t, size_t, size_t);
extern void unlink_bb_notes (basic_block, basic_block);
extern void add_block (basic_block, basic_block);
extern void attach_life_info (void);
+extern rtx bb_note (basic_block);
#ifdef ENABLE_CHECKING
extern void check_reg_live (bool);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5824e853317..9f3eb37b034 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-17 Maxim Kuvyrkov <mkuvyrkov@ispras.ru>
+
+ PR rtl-optimization/28489
+ * gcc.c-torture/compile/pr28489.c: New test.
+
2006-08-17 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28710
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr28489.c b/gcc/testsuite/gcc.c-torture/compile/pr28489.c
new file mode 100644
index 00000000000..766880fef25
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr28489.c
@@ -0,0 +1,48 @@
+typedef int c_int;
+union c_insn
+{
+ void (*op) ();
+ c_int *mem;
+ c_int imm;
+};
+static union c_insn c_stack[((0x100 + 4) * 4)];
+static struct c_ident *c_funcs;
+static void (*c_op_bz) ();
+static void c_direct (union c_insn *addr);
+c_compile (int (*ext_getchar) (), void (*ext_rewind) (),
+ struct c_ident *externs)
+{
+ c_direct (((void *) 0));
+}
+static void
+c_direct (union c_insn *addr)
+{
+ union c_insn *pc = addr;
+ union c_insn *sp = c_stack;
+ c_int imm = 0;
+ static void *ops[] = {
+ &&op_index, &&op_assign, &&op_add_a, &&op_sub_a, &&op_mul_a, &&op_div_a,
+ &&op_mod_a, &&op_or_a, &&op_xor_a, &&op_and_a, &&op_shl_a, &&op_shr_a,
+ };
+ {
+ c_op_bz = &&op_bz;
+ }
+ goto *(pc++)->op;
+op_bz:if (imm)
+ {
+ }
+op_push_imm_imm:(sp - 2)->imm = imm;
+ goto *(pc - 1)->op;
+op_index:imm = *((sp - 3)->mem += imm);
+op_assign:*(sp - 3)->mem = imm;
+op_add_a:imm = *(sp - 3)->mem += imm;
+op_sub_a:imm = *(sp - 3)->mem -= imm;
+op_mul_a:imm = *(sp - 3)->mem *= imm;
+op_div_a:imm = *(sp - 3)->mem /= imm;
+op_mod_a:imm = *(sp - 3)->mem %= imm;
+op_or_a:imm = *(sp - 3)->mem |= imm;
+op_xor_a:imm = *(sp - 3)->mem ^= imm;
+op_and_a:imm = *(sp - 3)->mem &= imm;
+op_shl_a:imm = *(sp - 3)->mem <<= imm;
+op_shr_a:imm = *(sp - 3)->mem >>= imm;
+}