diff mbox

PR rtl-optimization/49884: get_last_value checks register mode before returning value

Message ID j0rapq$rnv$1@dough.gmane.org
State New
Headers show

Commit Message

Paulo J. Matos July 28, 2011, 9:40 a.m. UTC
Hello,

This is an attempt to fix 49884. get_last_value checks the register mode 
before returning any value. If the register was set using a different 
mode than the one we are currently inquiring about then we avoid making 
a wrong guess about the current value and return 0.

PMatos

2011-07-28  Paulo J. Matos  <paulo.matos@csr.com>

	PR rtl-optimization/49884
	* combine.c (get_last_value): For registers whose
	value was set using a different mode than the one
	we are currently inquiring about we return 0.
diff mbox

Patch

diff --git a/gcc/combine.c b/gcc/combine.c
index 4dbf022..5885f2a 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -12746,6 +12746,11 @@  get_last_value (const_rtx x)
       && DF_INSN_LUID (rsp->last_set) >= subst_low_luid)
     return 0;
 
+  /* If the value was set to the register when this was using a different mode
+     then we can't use it. */
+  if(rsp->last_set_mode != GET_MODE(x))
+    return 0;
+
   /* If the value has all its registers valid, return it.  */
   if (get_last_value_validate (&value, rsp->last_set, rsp->last_set_label, 0))
     return value;