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]

Re: Fix PR optimization/7520


On Fri, Sep 20, 2002 at 12:17:21AM +0200, Eric Botcazou wrote:
> Note that the testcase is pathological: it returns without a value from
> within a function that expects a return value. So a register (pseudo first,
> eax at the end) is used without being previously set. That's why its
> liveness propagates backwards up to the CLOBBER.

Try this.


r~



Index: emit-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/emit-rtl.c,v
retrieving revision 1.295
diff -u -p -r1.295 emit-rtl.c
--- emit-rtl.c	17 Sep 2002 04:15:12 -0000	1.295
+++ emit-rtl.c	19 Sep 2002 22:42:59 -0000
@@ -3020,11 +3020,34 @@ int
 active_insn_p (insn)
      rtx insn;
 {
-  return (GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN
-	  || (GET_CODE (insn) == INSN
-	      && (! reload_completed
-		  || (GET_CODE (PATTERN (insn)) != USE
-		      && GET_CODE (PATTERN (insn)) != CLOBBER))));
+  if (GET_CODE (insn) == CALL_INSN || GET_CODE (insn) == JUMP_INSN)
+    return true;
+  if (GET_CODE (insn) == INSN)
+    {
+      if (reload_completed)
+	{
+	  rtx pat = PATTERN (insn);
+
+	  /* After reload, remaining USE insns are noops.  */
+	  if (GET_CODE (pat) == USE)
+	    return false;
+
+	  if (GET_CODE (pat) == CLOBBER)
+	    {
+	      /* ??? Don't skip past the clobber of the return register.
+		 If we eliminate it, we risk a variety of life analysis
+		 problems on broken code.  */
+	      if (GET_CODE (XEXP (pat, 0)) == REG
+		  && REG_FUNCTION_VALUE_P (XEXP (pat, 0)))
+		return true;
+
+	      /* Otherwise, clobbers don't do anything either.  */
+	      return false;
+	    }
+	}
+      return true;
+    }
+  return false;
 }
 
 rtx


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