[PATCH] Re: Use simplify_replace_rtx rather than wrap_constant

Jakub Jelinek jakub@redhat.com
Wed Oct 21 17:13:00 GMT 2009


On Wed, Oct 21, 2009 at 06:36:23PM +0200, Jakub Jelinek wrote:
> Even trivial testcases like -g -O2:
> void foo (void)
> {
>   int var = -1;
> }
> regress, so IMHO it is very important regression.
> The dumps are identical until the last pass before vartrack, so it is just
> vartrack where things broke.

Here is a fix for that I'm going to bootstrap/regtest.  So far just tested
that it fixes this little testcase and all guality.exp regressions.
The second hunk is just a little optimization, it is wasteful to call the
sometimes expensive function when we know we'll ignore what it returns
anyway.

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

	* var-tracking.c (emit_note_insn_var_location): If vt_expand_loc
	returned VOIDmode rtx, get mode from var->var_part[i].loc_chain->loc.
	Don't call the second vt_expand_loc unnecessarily when location is not
	a register nor memory.

--- gcc/var-tracking.c.jj	2009-10-21 18:41:33.000000000 +0200
+++ gcc/var-tracking.c	2009-10-21 18:54:55.000000000 +0200
@@ -6403,6 +6403,8 @@ emit_note_insn_var_location (void **varp
 	}
       loc[n_var_parts] = loc2;
       mode = GET_MODE (loc[n_var_parts]);
+      if (mode == VOIDmode)
+	mode = GET_MODE (var->var_part[i].loc_chain->loc);
       initialized = var->var_part[i].loc_chain->init;
       last_limit = offsets[n_var_parts] + GET_MODE_SIZE (mode);
 
@@ -6413,6 +6415,7 @@ emit_note_insn_var_location (void **varp
 	  break;
       if (j < var->n_var_parts
 	  && wider_mode != VOIDmode
+	  && (REG_P (loc[n_var_parts]) || MEM_P (loc[n_var_parts]))
 	  && (loc2 = vt_expand_loc (var->var_part[j].loc_chain->loc, vars))
 	  && GET_CODE (loc[n_var_parts]) == GET_CODE (loc2)
 	  && mode == GET_MODE (loc2)


	Jakub



More information about the Gcc-patches mailing list