This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Remove bogus optimization from may_alias_p
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 19 Oct 2008 19:09:08 +0200 (CEST)
- Subject: [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.
Richard.
2008-10-19 Richard Guenther <rguenther@suse.de>
* 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. */