Patchwork [committed] TILE-Gx: fix prologue register usage

login
register
mail settings
Submitter Walter Lee
Date March 27, 2013, 6:49 a.m.
Message ID <201303270649.r2R6nNIA008433@farm-0001.internal.tilera.com>
Download mbox | patch
Permalink /patch/231601/
State New
Headers show

Comments

Walter Lee - March 27, 2013, 6:49 a.m.
This patch fixes a bug that causes the prologue to use more temporary
registers than necessary.  Backported to 4.7 and 4.8.

	* config/tilegx/tilegx.c (tilegx_expand_prologue): Avoid
	double-decrement of next_scratch_regno.

Patch

--- gcc/config/tilegx/tilegx.c	(revision 197134)
+++ gcc/config/tilegx/tilegx.c	(working copy)
@@ -3999,11 +3999,10 @@  tilegx_expand_prologue (void)
 
 	if (r == NULL_RTX)
 	  {
-	    rtx p = compute_frame_addr (offset, &next_scratch_regno);
-	    r = gen_rtx_REG (Pmode, next_scratch_regno--);
-	    reg_save_addr[which_scratch] = r;
-
-	    emit_insn (gen_rtx_SET (VOIDmode, r, p));
+	    int prev_scratch_regno = next_scratch_regno;
+	    r = compute_frame_addr (offset, &next_scratch_regno);
+	    if (prev_scratch_regno != next_scratch_regno)
+	      reg_save_addr[which_scratch] = r;
 	  }
 	else
 	  {