diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2e20ef298f1c1a49b7b8d251e14986a771d68772..678601a586d325418498275b4e38e22e4ad19f1e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-09-18  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* alias.c (memory_modified_1): Deconstify.
+	(memory_modified_in_insn_p): Don't use const_note_stores.
+	* rtl.h (const_note_stores): Delete.
+	* rtlanal.c (const_note_stores): Likewise.
+
 2007-09-18  Richard Sandiford  <rsandifo@nildram.co.uk>
 
 	* dse.c (find_shift_sequence): Temporarily revert to forbidding
diff --git a/gcc/alias.c b/gcc/alias.c
index 870fbc47adb381fd86249c0259159e6e015cd6e6..1ba1ce366d85521e76f40d8bd59d4508e78f7e48 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -167,7 +167,7 @@ static rtx adjust_offset_for_component_ref (tree, rtx);
 static int nonoverlapping_memrefs_p (const_rtx, const_rtx);
 static int write_dependence_p (const_rtx, const_rtx, int);
 
-static void memory_modified_1 (const_rtx, const_rtx, const void *);
+static void memory_modified_1 (rtx, const_rtx, void *);
 static void record_alias_subset (alias_set_type, alias_set_type);
 
 /* Set up all info needed to perform alias analysis on memory references.  */
@@ -2356,7 +2356,7 @@ init_alias_target (void)
    to be memory reference.  */
 static bool memory_modified;
 static void
-memory_modified_1 (const_rtx x, const_rtx pat ATTRIBUTE_UNUSED, const void *data)
+memory_modified_1 (rtx x, const_rtx pat ATTRIBUTE_UNUSED, void *data)
 {
   if (MEM_P (x))
     {
@@ -2374,7 +2374,7 @@ memory_modified_in_insn_p (const_rtx mem, const_rtx insn)
   if (!INSN_P (insn))
     return false;
   memory_modified = false;
-  const_note_stores (PATTERN (insn), memory_modified_1, mem);
+  note_stores (PATTERN (insn), memory_modified_1, CONST_CAST_RTX(mem));
   return memory_modified;
 }
 
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 64dc3bc85988e75ab045ab0ff0f03c21bbaa4654..579f8cdb2cb42887404216f2d007c28d2661d18c 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1723,7 +1723,6 @@ extern int refers_to_regno_p (unsigned int, unsigned int, const_rtx, rtx *);
 extern int reg_overlap_mentioned_p (const_rtx, const_rtx);
 extern const_rtx set_of (const_rtx, const_rtx);
 extern void note_stores (const_rtx, void (*) (rtx, const_rtx, void *), void *);
-extern void const_note_stores (const_rtx, void (*) (const_rtx, const_rtx, const void *), const void *);
 extern void note_uses (rtx *, void (*) (rtx *, void *), void *);
 extern int dead_or_set_p (const_rtx, const_rtx);
 extern int dead_or_set_regno_p (const_rtx, unsigned int);
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index a47c36f0b099c8e86e5cbf824fdf261a348c6db0..da1ceb4adbdf539e48b044893d21e01363bf3fc2 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1412,49 +1412,41 @@ reg_overlap_mentioned_p (const_rtx x, const_rtx in)
   If the item being stored in or clobbered is a SUBREG of a hard register,
   the SUBREG will be passed.  */
 
-#define NOTE_STORES_BODY(NOTE_STORES_FN) do { \
-  int i; \
-  if (GET_CODE (x) == COND_EXEC) \
-    x = COND_EXEC_CODE (x); \
-  if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER) \
-    { \
-      rtx dest = SET_DEST (x); \
-      while ((GET_CODE (dest) == SUBREG \
-	      && (!REG_P (SUBREG_REG (dest)) \
-		  || REGNO (SUBREG_REG (dest)) >= FIRST_PSEUDO_REGISTER)) \
-	     || GET_CODE (dest) == ZERO_EXTRACT \
-	     || GET_CODE (dest) == STRICT_LOW_PART) \
-	dest = XEXP (dest, 0); \
-      /* If we have a PARALLEL, SET_DEST is a list of EXPR_LIST expressions, \
-	 each of whose first operand is a register.  */ \
-      if (GET_CODE (dest) == PARALLEL) \
-	{ \
-	  for (i = XVECLEN (dest, 0) - 1; i >= 0; i--) \
-	    if (XEXP (XVECEXP (dest, 0, i), 0) != 0) \
-	      (*fun) (XEXP (XVECEXP (dest, 0, i), 0), x, data); \
-	} \
-      else \
-	(*fun) (dest, x, data); \
-    } \
-  else if (GET_CODE (x) == PARALLEL) \
-    for (i = XVECLEN (x, 0) - 1; i >= 0; i--) \
-      NOTE_STORES_FN (XVECEXP (x, 0, i), fun, data); \
-} while (0)
-
 void
 note_stores (const_rtx x, void (*fun) (rtx, const_rtx, void *), void *data)
 {
-  NOTE_STORES_BODY(note_stores);
-}
+  int i;
 
-void
-const_note_stores (const_rtx x, void (*fun) (const_rtx, const_rtx, const void *), const void *data)
-{
-  NOTE_STORES_BODY(const_note_stores);
-}
+  if (GET_CODE (x) == COND_EXEC)
+    x = COND_EXEC_CODE (x);
 
-#undef NOTE_STORES_BODY
+  if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER)
+    {
+      rtx dest = SET_DEST (x);
+
+      while ((GET_CODE (dest) == SUBREG
+	      && (!REG_P (SUBREG_REG (dest))
+		  || REGNO (SUBREG_REG (dest)) >= FIRST_PSEUDO_REGISTER))
+	     || GET_CODE (dest) == ZERO_EXTRACT
+	     || GET_CODE (dest) == STRICT_LOW_PART)
+	dest = XEXP (dest, 0);
+
+      /* If we have a PARALLEL, SET_DEST is a list of EXPR_LIST expressions,
+	 each of whose first operand is a register.  */
+      if (GET_CODE (dest) == PARALLEL)
+	{
+	  for (i = XVECLEN (dest, 0) - 1; i >= 0; i--)
+	    if (XEXP (XVECEXP (dest, 0, i), 0) != 0)
+	      (*fun) (XEXP (XVECEXP (dest, 0, i), 0), x, data);
+	}
+      else
+	(*fun) (dest, x, data);
+    }
 
+  else if (GET_CODE (x) == PARALLEL)
+    for (i = XVECLEN (x, 0) - 1; i >= 0; i--)
+      note_stores (XVECEXP (x, 0, i), fun, data);
+}
 
 /* Like notes_stores, but call FUN for each expression that is being
    referenced in PBODY, a pointer to the PATTERN of an insn.  We only call