This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove bogus optimization from may_alias_p

This removes a test where one subtest is always false and the
other one is always true if unmodifiable_var_p (var) is true,
which is obviously bogus.  On the trunk this causes false
TBAA pruning of points-to sets.

Bootstrapped and tested on x86_64-unknown-linux-gnu for the trunk
and the gcc-4_3-branch.  Committed to trunk and the branch.


2008-10-19  Richard Guenther  <>

	* tree-ssa-alias.c (may_alias_p): Remove bogus shortcut.

Index: gcc/tree-ssa-alias.c
--- gcc/tree-ssa-alias.c	(revision 141225)
+++ gcc/tree-ssa-alias.c	(working copy)
@@ -2985,16 +2985,6 @@ may_alias_p (tree ptr, alias_set_type me
       return false;
-  /* If either MEM or VAR is a read-only global and the other one
-     isn't, then PTR cannot point to VAR.  */
-  if ((unmodifiable_var_p (mem) && !unmodifiable_var_p (var))
-      || (unmodifiable_var_p (var) && !unmodifiable_var_p (mem)))
-    {
-      alias_stats.alias_noalias++;
-      alias_stats.simple_resolved++;
-      return false;
-    }
   /* If the pointed to memory has alias set zero, or the pointer
      is ref-all, or the pointer decl is marked that no TBAA is to
      be applied, the MEM can alias VAR.  */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]