This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ICE in noce_try_sign_mask, fallout from rtx_cost changes (PR target/37483)


Hi!

if_info->insn_b can be NULL (in the if (test) x = 0; => x = (test >> 31) & x;
case) and t could come either from insn_a's or insn_b's block, but more
importantly, we are considering evaluating t in if_info->test_bb, so IMHO we
should just use the target bb's speed/size state, not the bb of the branch
where it has been computed before (for insn_b == NULL that would need to
be test_bb anyway).

Ok for trunk?

2008-09-12  Jakub Jelinek  <jakub@redhat.com>

	PR target/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.

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

--- gcc/ifcvt.c.jj	2008-09-11 16:04:26.000000000 +0200
+++ gcc/ifcvt.c	2008-09-12 15:56:17.000000000 +0200
@@ -1904,7 +1904,7 @@ noce_try_sign_mask (struct noce_if_info 
      INSN_B which can happen for e.g. conditional stores to memory.  */
   b_unconditional = (if_info->insn_b == NULL_RTX
 		     || BLOCK_FOR_INSN (if_info->insn_b) == if_info->test_bb);
-  if (rtx_cost (t, SET, optimize_bb_for_speed_p (BLOCK_FOR_INSN (if_info->insn_b)))
+  if (rtx_cost (t, SET, optimize_bb_for_speed_p (if_info->test_bb))
       >= COSTS_N_INSNS (2)
       && (!b_unconditional
           || t != if_info->b))
--- gcc/testsuite/gcc.c-torture/compile/pr37483.c.jj	2008-09-12 15:58:40.000000000 +0200
+++ gcc/testsuite/gcc.c-torture/compile/pr37483.c	2008-09-12 15:58:07.000000000 +0200
@@ -0,0 +1,10 @@
+/* PR target/37483 */
+
+unsigned long long
+foo (unsigned count, int i)
+{
+  unsigned long long value;
+  if (i == 0)
+    value = (value & 0xFFFFFFFF) >> count;
+  return value;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]