Index: cse.c
===================================================================
--- cse.c	(revision 161371)
+++ cse.c	(working copy)
@@ -2669,25 +2669,15 @@ exp_equiv_p (const_rtx x, const_rtx y, i
     case MEM:
       if (for_gcse)
 	{
-	  /* A volatile mem should not be considered equivalent to any
-	     other.  */
-	  if (MEM_VOLATILE_P (x) || MEM_VOLATILE_P (y))
-	    return 0;
-
 	  /* Can't merge two expressions in different alias sets, since we
 	     can decide that the expression is transparent in a block when
-	     it isn't, due to it being set with the different alias set.
-
-	     Also, can't merge two expressions with different MEM_ATTRS.
-	     They could e.g. be two different entities allocated into the
-	     same space on the stack (see e.g. PR25130).  In that case, the
-	     MEM addresses can be the same, even though the two MEMs are
-	     absolutely not equivalent.
+	     it isn't, due to it being set with the different alias set.  */
+	  if (MEM_ALIAS_SET (x) != MEM_ALIAS_SET (y))
+	    return 0;
 
-	     But because really all MEM attributes should be the same for
-	     equivalent MEMs, we just use the invariant that MEMs that have
-	     the same attributes share the same mem_attrs data structure.  */
-	  if (MEM_ATTRS (x) != MEM_ATTRS (y))
+	  /* A volatile mem should not be considered equivalent to any
+	     other.  */
+	  if (MEM_VOLATILE_P (x) || MEM_VOLATILE_P (y))
 	    return 0;
 	}
       break;
