Module Name:    src
Committed By:   martin
Date:           Sun Jun 17 13:43:30 UTC 2012

Modified Files:
        src/external/gpl3/gcc/dist/gcc: ChangeLog reload.c reload1.c

Log Message:
Apply upstream revision 175141: setjmp vs. unchanged register values;
should fix PR toolchain/45837.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/gpl3/gcc/dist/gcc/ChangeLog
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/reload.c \
    src/external/gpl3/gcc/dist/gcc/reload1.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/ChangeLog
diff -u src/external/gpl3/gcc/dist/gcc/ChangeLog:1.2 src/external/gpl3/gcc/dist/gcc/ChangeLog:1.3
--- src/external/gpl3/gcc/dist/gcc/ChangeLog:1.2	Fri Dec  2 09:44:48 2011
+++ src/external/gpl3/gcc/dist/gcc/ChangeLog	Sun Jun 17 13:43:30 2012
@@ -5,6 +5,17 @@
 	* config/pa/pa.h (LEGITIMATE_CONSTANT_P): Return false for
 	TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC symbol references.
 
+2011-06-17  Hans-Peter Nilsson  <h...@axis.com>
+
+	Backport from mainline
+	2011-06-17  Hans-Peter Nilsson  <h...@axis.com>
+
+	PR rtl-optimization/48542
+	* reload.c (find_equiv_reg): Stop looking when finding a
+	setjmp-type call.
+	* reload1.c (reload_as_needed): Invalidate all reload
+	registers when crossing a setjmp-type call.
+
 2011-04-28  Release Manager
 
 	* GCC 4.5.3 released.

Index: src/external/gpl3/gcc/dist/gcc/reload.c
diff -u src/external/gpl3/gcc/dist/gcc/reload.c:1.1.1.1 src/external/gpl3/gcc/dist/gcc/reload.c:1.2
--- src/external/gpl3/gcc/dist/gcc/reload.c:1.1.1.1	Tue Jun 21 01:20:14 2011
+++ src/external/gpl3/gcc/dist/gcc/reload.c	Sun Jun 17 13:43:30 2012
@@ -6795,6 +6795,15 @@ find_equiv_reg (rtx goal, rtx insn, enum
 	  || num > PARAM_VALUE (PARAM_MAX_RELOAD_SEARCH_INSNS))
 	return 0;
 
+      /* Don't reuse register contents from before a setjmp-type
+	 function call; on the second return (from the longjmp) it
+	 might have been clobbered by a later reuse.  It doesn't
+	 seem worthwhile to actually go and see if it is actually
+	 reused even if that information would be readily available;
+	 just don't reuse it across the setjmp call.  */
+      if (CALL_P (p) && find_reg_note (p, REG_SETJMP, NULL_RTX))
+	return 0;
+
       if (NONJUMP_INSN_P (p)
 	  /* If we don't want spill regs ...  */
 	  && (! (reload_reg_p != 0
Index: src/external/gpl3/gcc/dist/gcc/reload1.c
diff -u src/external/gpl3/gcc/dist/gcc/reload1.c:1.1.1.1 src/external/gpl3/gcc/dist/gcc/reload1.c:1.2
--- src/external/gpl3/gcc/dist/gcc/reload1.c:1.1.1.1	Tue Jun 21 01:19:55 2011
+++ src/external/gpl3/gcc/dist/gcc/reload1.c	Sun Jun 17 13:43:30 2012
@@ -4487,6 +4487,13 @@ reload_as_needed (int live_known)
 	{
 	  AND_COMPL_HARD_REG_SET (reg_reloaded_valid, call_used_reg_set);
 	  AND_COMPL_HARD_REG_SET (reg_reloaded_valid, reg_reloaded_call_part_clobbered);
+
+	  /* If this is a call to a setjmp-type function, we must not
+	     reuse any reload reg contents across the call; that will
+	     just be clobbered by other uses of the register in later
+	     code, before the longjmp.  */
+	  if (find_reg_note (insn, REG_SETJMP, NULL_RTX))
+	    CLEAR_HARD_REG_SET (reg_reloaded_valid);
 	}
     }
 

Reply via email to