Additional patch for optimization/7871

Ian Lance Taylor ian@wasabisystems.com
Fri Feb 27 12:39:00 GMT 2004


This patch for PR optimization/7871 is intended to incorporate Jim's
comments about the misleading LOG_LINKS which are introduced for
global registers and function calls.

This patch incorporates Eric's earlier patch, found here:
    http://gcc.gnu.org/ml/gcc-patches/2004-02/msg00119.html

This patch avoids creating LOG_LINKS for global registers to or from
call insns.  That seems to me to be the right approach here.  It's OK
to have LOG_LINKS in other cases, since the compiler will have all the
information it needs to do something.

I think we should check something in for this, particularly since
Eric's patch apparently already fixes all the known test cases.  I
checked the i386, m68k, and SPARC test cases with this combined patch,
and they all appear to be fixed as well.

I'm running the testsuite with this patch.  I'll report any unexpected
problems.

Ian


2004-02-27  Ian Lance Taylor  <ian@wasabisystems.com>

	PR optimization/7871
	* flow.c (mark_set_1): Don't add LOG_LINKS for global registers
	from or to call insns.	

2004-02-02  Eric Botcazou  <ebotcazou@libertysurf.fr>

	PR optimization/7871
	* flow.c (propagate_one_insn): Interpret calls as setting global
	registers, not merely clobbering them.


Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.581
diff -p -u -r1.581 flow.c
--- flow.c	24 Feb 2004 23:39:54 -0000	1.581
+++ flow.c	27 Feb 2004 09:11:05 -0000
@@ -1772,8 +1772,9 @@ propagate_one_insn (struct propagate_blo
 					      current_function_return_rtx,
 					      (rtx *) 0)))
 	      {
+		enum rtx_code code = global_regs[i] ? SET : CLOBBER;
 		/* We do not want REG_UNUSED notes for these registers.  */
-		mark_set_1 (pbi, CLOBBER, regno_reg_rtx[i], cond, insn,
+		mark_set_1 (pbi, code, regno_reg_rtx[i], cond, insn,
 			    pbi->flags & ~(PROP_DEATH_NOTES | PROP_REG_INFO));
 	      }
 	}
@@ -2799,10 +2800,18 @@ mark_set_1 (struct propagate_block_info 
 		     in ASM_OPERANDs.  If these registers get replaced,
 		     we might wind up changing the semantics of the insn,
 		     even if reload can make what appear to be valid
-		     assignments later.  */
+		     assignments later.
+
+		     We don't build a LOG_LINK for global registers to
+		     or from a function call.  We don't want to let
+		     combine think that it knows what is going on with
+		     global registers.  */
 		  if (y && (BLOCK_NUM (y) == blocknum)
 		      && (regno_first >= FIRST_PSEUDO_REGISTER
-			  || asm_noperands (PATTERN (y)) < 0))
+			  || (asm_noperands (PATTERN (y)) < 0
+			      && ! ((GET_CODE (insn) == CALL_INSN
+				     || GET_CODE (y) == CALL_INSN)
+				    && global_regs[regno_first]))))
 		    LOG_LINKS (y) = alloc_INSN_LIST (insn, LOG_LINKS (y));
 		}
 	    }



More information about the Gcc-patches mailing list