[PATCH] Fix get_last_value_validate (PR rtl-optimization/41511)

Jakub Jelinek jakub@redhat.com
Fri Oct 2 18:56:00 GMT 2009


Hi!

DF_INSN_LUID is unique only within one basic block, but
get_last_value_validate might be called with an insn from different basic
block.  In that case the comparison of the luid with mem_last_set is
completely meaningless, and with -g vs. -g0 caused differences in generated
code.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux.

Ok for trunk?

2009-10-02  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/41511
	* combine.c (get_last_value_validate): For non-readonly MEMs
	assume they might have been modified even if insn is in another
	basic block.

--- gcc/combine.c.jj	2009-09-21 09:05:26.000000000 +0200
+++ gcc/combine.c	2009-10-02 18:13:02.000000000 +0200
@@ -12097,7 +12097,7 @@ get_last_value_validate (rtx *loc, rtx i
      no stores after it that might have clobbered the value.  We don't
      have alias info, so we assume any store invalidates it.  */
   else if (MEM_P (x) && !MEM_READONLY_P (x)
-	   && DF_INSN_LUID (insn) <= mem_last_set)
+	   && (tick != label_tick || DF_INSN_LUID (insn) <= mem_last_set))
     {
       if (replace)
 	*loc = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);

	Jakub



More information about the Gcc-patches mailing list