@@ -1931,6 +1931,28 @@ dom_normalize_single_rhs (tree expr)
return fold_build2 (MEM_REF, TREE_TYPE (expr), base, offset);
}
+ case MEM_REF:
+ {
+ /* Make the target of the pointer equal to the result type of the MEM_REF.
+ (This is not generally equivalent as it has different aliasing
+ properties but has the same value and so finds more equivalences.) */
+
+ tree off = TREE_OPERAND (expr, 1);
+
+ gcc_assert (POINTER_TYPE_P (TREE_TYPE (off)));
+ tree ptr_target_type = TREE_TYPE (TREE_TYPE (off));
+
+ if (ptr_target_type == TREE_TYPE (expr))
+ return NULL_TREE;
+
+ tree nref = copy_node (expr);
+ TREE_OPERAND (nref, 1) = copy_node (off);
+
+ TREE_TYPE (TREE_OPERAND (nref, 1)) =
+ build_pointer_type (TREE_TYPE (expr));
+
+ return nref;
+ }
default:
return NULL_TREE;
}