Commit b5fb36ee by Jakub Jelinek Committed by Adam Nemet

re PR rtl-optimization/37483 (Segfault in noce_try_sign_mask (ifcvt.c): b_unconditional)

	PR rtl-optimization/37483
	* ifcvt.c (noce_try_sign_mask): Use if_info->test_bb instead of
	if_info->insn_b's bb as argument to optimize_bb_for_speed_p.
	Rearrange code to better match the original comment.  Check
	t_unconditional first.  Improve comment.

testsuite/
	* gcc.c-torture/compile/pr37483.c: New test.
	* gcc.c-torture/compile/pr37395.c: New test.

Co-Authored-By: Adam Nemet <anemet@caviumnetworks.com>

From-SVN: r140403
parent 8c50b495
2008-09-16 Jakub Jelinek <jakub@redhat.com> 2008-09-16 Jakub Jelinek <jakub@redhat.com>
Adam Nemet <anemet@caviumnetworks.com>
PR rtl-optimization/37483
* ifcvt.c (noce_try_sign_mask): Use if_info->test_bb instead of
if_info->insn_b's bb as argument to optimize_bb_for_speed_p.
Rearrange code to better match the original comment. Check
t_unconditional first. Improve comment.
2008-09-16 Jakub Jelinek <jakub@redhat.com>
PR c/37529 PR c/37529
* gimplify.c (gimplify_expr) <case GOTO_EXPR>: If gimplification of * gimplify.c (gimplify_expr) <case GOTO_EXPR>: If gimplification of
......
...@@ -1869,7 +1869,7 @@ noce_try_sign_mask (struct noce_if_info *if_info) ...@@ -1869,7 +1869,7 @@ noce_try_sign_mask (struct noce_if_info *if_info)
rtx cond, t, m, c, seq; rtx cond, t, m, c, seq;
enum machine_mode mode; enum machine_mode mode;
enum rtx_code code; enum rtx_code code;
bool b_unconditional; bool t_unconditional;
cond = if_info->cond; cond = if_info->cond;
code = GET_CODE (cond); code = GET_CODE (cond);
...@@ -1898,16 +1898,19 @@ noce_try_sign_mask (struct noce_if_info *if_info) ...@@ -1898,16 +1898,19 @@ noce_try_sign_mask (struct noce_if_info *if_info)
if (GET_MODE (m) != mode) if (GET_MODE (m) != mode)
return FALSE; return FALSE;
/* This is only profitable if T is cheap, or T is unconditionally /* This is only profitable if T is unconditionally executed/evaluated in the
executed/evaluated in the original insn sequence. The latter original insn sequence or T is cheap. The former happens if B is the
happens if INSN_B was taken from TEST_BB, or if there was no non-zero (T) value and if INSN_B was taken from TEST_BB, or there was no
INSN_B which can happen for e.g. conditional stores to memory. */ INSN_B which can happen for e.g. conditional stores to memory. For the
b_unconditional = (if_info->insn_b == NULL_RTX cost computation use the block TEST_BB where the evaluation will end up
|| BLOCK_FOR_INSN (if_info->insn_b) == if_info->test_bb); after the transformation. */
if (rtx_cost (t, SET, optimize_bb_for_speed_p (BLOCK_FOR_INSN (if_info->insn_b))) t_unconditional =
>= COSTS_N_INSNS (2) (t == if_info->b
&& (!b_unconditional && (if_info->insn_b == NULL_RTX
|| t != if_info->b)) || BLOCK_FOR_INSN (if_info->insn_b) == if_info->test_bb));
if (!(t_unconditional
|| (rtx_cost (t, SET, optimize_bb_for_speed_p (if_info->test_bb))
< COSTS_N_INSNS (2))))
return FALSE; return FALSE;
start_sequence (); start_sequence ();
......
2008-09-16 Jakub Jelinek <jakub@redhat.com> 2008-09-16 Jakub Jelinek <jakub@redhat.com>
Adam Nemet <anemet@caviumnetworks.com>
PR rtl-optimization/37483
* gcc.c-torture/compile/pr37483.c: New test.
* gcc.c-torture/compile/pr37395.c: New test.
2008-09-16 Jakub Jelinek <jakub@redhat.com>
PR c/37529 PR c/37529
* gcc.dg/pr37529.c: New test. * gcc.dg/pr37529.c: New test.
......
/* PR target/37395 */
int
f (int j)
{
int i;
asm volatile ("" : "=r"(i));
if (i >= 0)
j = 0;
return j;
}
/* PR target/37483 */
unsigned long long
foo (unsigned count, int i)
{
unsigned long long value;
if (i == 0)
value = (value & 0xFFFFFFFF) >> count;
return value;
}
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