builtins.c (get_memory_rtx): Properly set MEM alias set and attributes.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Sat, 3 Nov 2001 15:33:45 +0000 (15:33 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 3 Nov 2001 15:33:45 +0000 (10:33 -0500)
* builtins.c (get_memory_rtx): Properly set MEM alias set and
attributes.

From-SVN: r46732

gcc/ChangeLog
gcc/builtins.c

index c7349b3222a27e5d1ddd6aafe9c5f695532f7fef..de15b86295fb0e8986c9679b45a1ac0d95cb665e 100644 (file)
@@ -1,3 +1,8 @@
+Sat Nov  3 10:37:56 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * builtins.c (get_memory_rtx): Properly set MEM alias set and
+       attributes.
+
 2001-11-03  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * doc/extend.texi, doc/gcc.texi, doc/install.texi, doc/tm.texi:
index d1eeda9f5f2b5dab39cd2905153f8688ae698ce3..ca7eb667b1da203c18ff4d20348cd5cf221043a9 100644 (file)
@@ -731,7 +731,6 @@ get_memory_rtx (exp)
 #endif
 
   mem = gen_rtx_MEM (BLKmode, memory_address (BLKmode, addr));
-  set_mem_attributes (mem, exp, 0);
 
   /* Get an expression we can use to find the attributes to assign to MEM.
      If it is an ADDR_EXPR, use the operand.  Otherwise, dereference it if
@@ -742,14 +741,17 @@ get_memory_rtx (exp)
     exp = TREE_OPERAND (exp, 0);
 
   if (TREE_CODE (exp) == ADDR_EXPR)
-    exp = TREE_OPERAND (exp, 0);
+    {
+      exp = TREE_OPERAND (exp, 0);
+      set_mem_attributes (mem, exp, 0);
+    }
   else if (POINTER_TYPE_P (TREE_TYPE (exp)))
-    exp = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (exp)), exp);
-  else
-    return mem;
+    {
+      exp = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (exp)), exp);
+      /* memcpy, memset and other builtin stringops can alias with anything.  */
+      set_mem_alias_set (mem, 0);
+    }
 
-  /* memcpy, memset and other builtin stringops can alias with anything.  */
-  set_mem_alias_set (mem, 0);
   return mem;
 }
 \f