This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Put optimization/7871 patches on gcc 3.3 and 3.4 branches


I propose putting the patch for optimization/7871 onto the 3.3 and 3.4
branches.  I've confirmed that the x86 and m68k test cases in that PR
are currently broken on both branches, and that this patch fixes those
test cases on both branches.  I believe that this patch is reasonably
safe, as it only affects global register variables.

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-27  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.572.4.1
diff -p -u -r1.572.4.1 flow.c
--- flow.c	12 Feb 2004 15:30:44 -0000	1.572.4.1
+++ flow.c	28 Feb 2004 02:55:56 -0000
@@ -1739,8 +1739,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));
 	      }
 	}
@@ -2756,10 +2757,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));
 		}
 	    }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]