+2004-10-29 Roger Sayle <roger@eyesopen.com>
+
+ PR rtl-optimization/17581
+ * cselib.c (cselib_process_insn): The last instruction of a libcall
+ block, with the REG_RETVAL note, should be considered in the libcall.
+ * gcse.c (do_local_cprop): Allow constants to be propagated outside
+ of libcall blocks.
+ (adjust_libcall_notes): Use simplify_replace_rtx instead of
+ replace_rtx to avoid creating invalid RTL in REG_RETVAL notes.
+
2004-10-30 Kazu Hirata <kazu@cs.umass.edu>
* tree-phinodes.c (create_phi_node): Don't zero PHI_REWRITTEN.
if (find_reg_note (insn, REG_LIBCALL, NULL))
cselib_current_insn_in_libcall = true;
- if (find_reg_note (insn, REG_RETVAL, NULL))
- cselib_current_insn_in_libcall = false;
cselib_current_insn = insn;
/* Forget everything at a CODE_LABEL, a volatile asm, or a setjmp. */
&& GET_CODE (PATTERN (insn)) == ASM_OPERANDS
&& MEM_VOLATILE_P (PATTERN (insn))))
{
+ if (find_reg_note (insn, REG_RETVAL, NULL))
+ cselib_current_insn_in_libcall = false;
clear_table ();
return;
}
if (! INSN_P (insn))
{
+ if (find_reg_note (insn, REG_RETVAL, NULL))
+ cselib_current_insn_in_libcall = false;
cselib_current_insn = 0;
return;
}
if (GET_CODE (XEXP (x, 0)) == CLOBBER)
cselib_invalidate_rtx (XEXP (XEXP (x, 0), 0));
+ if (find_reg_note (insn, REG_RETVAL, NULL))
+ cselib_current_insn_in_libcall = false;
cselib_current_insn = 0;
if (n_useless_values > MAX_USELESS_VALUES)
rtx this_rtx = l->loc;
rtx note;
- if (l->in_libcall)
+ /* Don't CSE non-constant values out of libcall blocks. */
+ if (l->in_libcall && ! CONSTANT_P (this_rtx))
continue;
if (gcse_constant_p (this_rtx))
return true;
}
}
- XEXP (note, 0) = replace_rtx (XEXP (note, 0), oldreg, newval);
+ XEXP (note, 0) = simplify_replace_rtx (XEXP (note, 0), oldreg, newval);
insn = end;
}
return true;
+2004-10-29 Roger Sayle <roger@eyesopen.com>
+
+ PR rtl-optimization/17581
+ * gcc.dg/pr17581-1.c: New test case.
+
2004-10-28 Nathan Sidwell <nathan@codesourcery.com>
* g++.dg/conversion/dr195.C: Adjust expected errors for DR195 not
--- /dev/null
+/* PR rtl-optimization/17581 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int foo(int x)
+{
+ unsigned long long tmp = 0;
+
+ switch(x) {
+ case 21:
+ tmp |= 1;
+ tmp |= 2;
+ tmp |= 8;
+ break;
+ default:
+ break;
+ }
+
+ return (int)tmp;
+}
+
+int main()
+{
+ if (foo(21) != 11)
+ abort ();
+ return 0;
+}
+