LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File aliasing12.diff of Package gcc33 (Project openSUSE:Factory)

Index: gcc/rtl.h
===================================================================
--- gcc/rtl.h.orig	2009-11-20 13:04:57.000000000 +0100
+++ gcc/rtl.h	2009-11-20 13:05:54.000000000 +0100
@@ -151,7 +151,8 @@ struct rtx_def GTY((chain_next ("RTX_NEX
      In a CODE_LABEL, part of the two-bit alternate entry field.  */
   unsigned int jump : 1;
   /* In a CODE_LABEL, part of the two-bit alternate entry field.
-     1 in a MEM if it cannot trap.  */
+     1 in a MEM if it cannot trap.
+     1 in a SYMBOL_REF which refers to a read-only object.  */
   unsigned int call : 1;
   /* 1 in a REG, MEM, or CONCAT if the value is set at most once, anywhere.
      1 in a SUBREG if it references an unsigned object whose mode has been
@@ -1275,6 +1276,10 @@ do {						\
 #define SYMBOL_REF_WEAK(RTX)						\
   (RTL_FLAG_CHECK1("SYMBOL_REF_WEAK", (RTX), SYMBOL_REF)->integrated)
 
+/* 1 if RTX is a symbol_ref for a readonly object.  */
+#define SYMBOL_REF_READONLY(RTX)					\
+  (RTL_FLAG_CHECK1("SYMBOL_REF_READONLY", (RTX), SYMBOL_REF)->call)
+
 /* Define a macro to look for REG_INC notes,
    but save time on machines where they never exist.  */
 
Index: gcc/alias.c
===================================================================
--- gcc/alias.c.orig	2009-11-20 13:05:49.000000000 +0100
+++ gcc/alias.c	2009-11-20 13:05:54.000000000 +0100
@@ -2080,7 +2080,7 @@ true_dependence (mem, mem_mode, x, varie
      int (*varies) PARAMS ((rtx, int));
 {
   rtx x_addr, mem_addr;
-  rtx base;
+  rtx base, mem_base;
 
   if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
     return 1;
@@ -2118,9 +2118,12 @@ true_dependence (mem, mem_mode, x, varie
   mem_addr = get_addr (XEXP (mem, 0));
 
   base = find_base_term (x_addr);
+  mem_base = find_base_term (mem_addr);
   if (base && (GET_CODE (base) == LABEL_REF
 	       || (GET_CODE (base) == SYMBOL_REF
-		   && CONSTANT_POOL_ADDRESS_P (base))))
+		   && ((SYMBOL_REF_READONLY (base)
+			&& !rtx_equal_p (base, mem_base))
+		       || CONSTANT_POOL_ADDRESS_P (base)))))
     return 0;
 
   if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c.orig	2009-11-20 13:04:57.000000000 +0100
+++ gcc/varasm.c	2009-11-20 13:05:54.000000000 +0100
@@ -941,6 +941,8 @@ make_decl_rtl (decl, asmspec)
   SYMBOL_REF_WEAK (XEXP (x, 0)) = DECL_WEAK (decl);
   if (TREE_CODE (decl) != FUNCTION_DECL)
     set_mem_attributes (x, decl, 1);
+  if (RTX_UNCHANGING_P (x))
+    SYMBOL_REF_READONLY (XEXP (x, 0)) = 1;
   SET_DECL_RTL (decl, x);
 
   /* Optionally set flags or add text to the name to record information
@@ -2746,6 +2748,8 @@ output_constant_def (exp, defer)
 		       gen_rtx_SYMBOL_REF (Pmode, desc->label));
 
       set_mem_attributes (rtl, exp, 1);
+      if (RTX_UNCHANGING_P (rtl))
+        SYMBOL_REF_READONLY (XEXP (rtl, 0)) = 1;
       set_mem_alias_set (rtl, 0);
       set_mem_alias_set (rtl, const_alias_set);
 
@@ -3322,6 +3326,7 @@ force_const_mem (mode, x)
   set_mem_alias_set (def, const_alias_set);
   set_mem_attributes (def, (*lang_hooks.types.type_for_mode) (mode, 0), 1);
   RTX_UNCHANGING_P (def) = 1;
+  SYMBOL_REF_READONLY (XEXP (def, 0)) = 1;
 
   /* Add label to symbol hash table.  */
   hash = SYMHASH (XSTR (XEXP (def, 0), 0));