Commit e3104f55 by Adam Nemet Committed by Adam Nemet

combine.c (label_tick_ebb_start): Fix comment.

	* combine.c (label_tick_ebb_start): Fix comment.
	(combine_instructions): Set label_tick and label_tick_ebb_start before
	calling setup_incoming_promotions.  Start them from 1.  Increment
	label_tick instead of deriving it from the BB index.  Rather than
	comparing ticks use the block from the previous iteration to decide
	whether to start a new EBB.  Remove empty lines before function.

testsuite/
	* gcc.target/mips/truncate-6.c: New test.

From-SVN: r152567
parent a020110e
2009-10-08 Adam Nemet <anemet@caviumnetworks.com>
* combine.c (label_tick_ebb_start): Fix comment.
(combine_instructions): Set label_tick and label_tick_ebb_start before
calling setup_incoming_promotions. Start them from 1. Increment
label_tick instead of deriving it from the BB index. Rather than
comparing ticks use the block from the previous iteration to decide
whether to start a new EBB. Remove empty lines before function.
2009-10-08 Michael Matz <matz@suse.de> 2009-10-08 Michael Matz <matz@suse.de>
PR middle-end/41573 PR middle-end/41573
...@@ -321,7 +321,7 @@ static rtx *uid_log_links; ...@@ -321,7 +321,7 @@ static rtx *uid_log_links;
static int label_tick; static int label_tick;
/* Reset to label_tick for each label. */ /* Reset to label_tick for each extended basic block in scanning order. */
static int label_tick_ebb_start; static int label_tick_ebb_start;
...@@ -1010,9 +1010,6 @@ clear_log_links (void) ...@@ -1010,9 +1010,6 @@ clear_log_links (void)
if (INSN_P (insn)) if (INSN_P (insn))
free_INSN_LIST_list (&LOG_LINKS (insn)); free_INSN_LIST_list (&LOG_LINKS (insn));
} }
/* Main entry point for combiner. F is the first insn of the function. /* Main entry point for combiner. F is the first insn of the function.
NREGS is the first unused pseudo-reg number. NREGS is the first unused pseudo-reg number.
...@@ -1028,6 +1025,7 @@ combine_instructions (rtx f, unsigned int nregs) ...@@ -1028,6 +1025,7 @@ combine_instructions (rtx f, unsigned int nregs)
#endif #endif
rtx links, nextlinks; rtx links, nextlinks;
rtx first; rtx first;
basic_block last_bb;
int new_direct_jump_p = 0; int new_direct_jump_p = 0;
...@@ -1058,6 +1056,7 @@ combine_instructions (rtx f, unsigned int nregs) ...@@ -1058,6 +1056,7 @@ combine_instructions (rtx f, unsigned int nregs)
problems when, for example, we have j <<= 1 in a loop. */ problems when, for example, we have j <<= 1 in a loop. */
nonzero_sign_valid = 0; nonzero_sign_valid = 0;
label_tick = label_tick_ebb_start = 1;
/* Scan all SETs and see if we can deduce anything about what /* Scan all SETs and see if we can deduce anything about what
bits are known to be zero for some registers and how many copies bits are known to be zero for some registers and how many copies
...@@ -1067,18 +1066,23 @@ combine_instructions (rtx f, unsigned int nregs) ...@@ -1067,18 +1066,23 @@ combine_instructions (rtx f, unsigned int nregs)
for what bits are known to be set. */ for what bits are known to be set. */
setup_incoming_promotions (first); setup_incoming_promotions (first);
/* Allow the entry block and the first block to fall into the same EBB.
Conceptually the incoming promotions are assigned to the entry block. */
last_bb = ENTRY_BLOCK_PTR;
create_log_links (); create_log_links ();
label_tick_ebb_start = ENTRY_BLOCK_PTR->index;
FOR_EACH_BB (this_basic_block) FOR_EACH_BB (this_basic_block)
{ {
optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block); optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block);
last_call_luid = 0; last_call_luid = 0;
mem_last_set = -1; mem_last_set = -1;
label_tick = this_basic_block->index;
label_tick++;
if (!single_pred_p (this_basic_block) if (!single_pred_p (this_basic_block)
|| single_pred (this_basic_block)->index != label_tick - 1) || single_pred (this_basic_block) != last_bb)
label_tick_ebb_start = label_tick; label_tick_ebb_start = label_tick;
last_bb = this_basic_block;
FOR_BB_INSNS (this_basic_block, insn) FOR_BB_INSNS (this_basic_block, insn)
if (INSN_P (insn) && BLOCK_FOR_INSN (insn)) if (INSN_P (insn) && BLOCK_FOR_INSN (insn))
{ {
...@@ -1109,20 +1113,23 @@ combine_instructions (rtx f, unsigned int nregs) ...@@ -1109,20 +1113,23 @@ combine_instructions (rtx f, unsigned int nregs)
nonzero_sign_valid = 1; nonzero_sign_valid = 1;
/* Now scan all the insns in forward order. */ /* Now scan all the insns in forward order. */
label_tick = label_tick_ebb_start = 1;
label_tick_ebb_start = ENTRY_BLOCK_PTR->index;
init_reg_last (); init_reg_last ();
setup_incoming_promotions (first); setup_incoming_promotions (first);
last_bb = ENTRY_BLOCK_PTR;
FOR_EACH_BB (this_basic_block) FOR_EACH_BB (this_basic_block)
{ {
optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block); optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block);
last_call_luid = 0; last_call_luid = 0;
mem_last_set = -1; mem_last_set = -1;
label_tick = this_basic_block->index;
label_tick++;
if (!single_pred_p (this_basic_block) if (!single_pred_p (this_basic_block)
|| single_pred (this_basic_block)->index != label_tick - 1) || single_pred (this_basic_block) != last_bb)
label_tick_ebb_start = label_tick; label_tick_ebb_start = label_tick;
last_bb = this_basic_block;
rtl_profile_for_bb (this_basic_block); rtl_profile_for_bb (this_basic_block);
for (insn = BB_HEAD (this_basic_block); for (insn = BB_HEAD (this_basic_block);
insn != NEXT_INSN (BB_END (this_basic_block)); insn != NEXT_INSN (BB_END (this_basic_block));
......
2009-10-08 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/truncate-6.c: New test.
2009-10-08 Jason Merrill <jason@redhat.com> 2009-10-08 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/rv-deduce.C: New. * g++.dg/cpp0x/rv-deduce.C: New.
......
/* setup_incoming_promotions should detect x to be already sign-extended due
to PROMOTE_MODE. Thus the truncation should be removed by combine. Based
on gcc.c-torture/execute/pr34070-2.c. */
/* { dg-options "-O -mgp64" } */
/* { dg-final { scan-assembler-not "\tsll\t\[^\n\]*,0" } } */
NOMIPS16 int f(unsigned int x, int n, int *p)
{
if (p)
*p = 1;
return ((int)x) / (1 << n);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment