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]

Fix PR optimization/7335


Loop hoisting and other kinds of flow analysis get confused when a
LCT_CONST libcall passes any of it's args by reference, that should
make it a LCT_PURE libcall and that is what this fix does to solve the
problem.

Installed on mainline and 3.2 branch.

2002-09-26  David S. Miller  <davem@redhat.com>

	PR optimization/7335
	* calls.c (emit_library_call_value_1): Passing args by reference
	converts a CONST function into a PURE one.

--- calls.c.~1~	Wed Sep 25 14:12:21 2002
+++ calls.c	Thu Sep 26 17:50:00 2002
@@ -3666,6 +3666,14 @@ emit_library_call_value_1 (retval, orgfu
 #endif
 	    ;
 
+	  /* If this was a CONST function, it is now PURE since
+	     it now reads memory.  */
+	  if (flags & ECF_CONST)
+	    {
+	      flags &= ~ECF_CONST;
+	      flags |= ECF_PURE;
+	    }
+
 	  if (GET_MODE (val) == MEM && ! must_copy)
 	    slot = val;
 	  else if (must_copy)


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