public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1839] Improve ptr_derefs_may_alias_p for the case of &STRING_CST
@ 2022-07-26 10:09 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-07-26 10:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:67248ad043b366d30e97cb6c192593057e798805

commit r13-1839-g67248ad043b366d30e97cb6c192593057e798805
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Jul 26 11:02:13 2022 +0200

    Improve ptr_derefs_may_alias_p for the case of &STRING_CST
    
    When the first pointer happens to be a pointer to a STRING_CST we
    give up too early since the 2nd pointer handling could still end
    up with a DECL for example which can disambiguate against a STRING_CST
    just fine.
    
            * tree-ssa-alias.cc (ptr_derefs_may_alias_p): If ptr1
            points to a constant continue checking ptr2.

Diff:
---
 gcc/tree-ssa-alias.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-ssa-alias.cc b/gcc/tree-ssa-alias.cc
index 390cd875074..b4c65da5718 100644
--- a/gcc/tree-ssa-alias.cc
+++ b/gcc/tree-ssa-alias.cc
@@ -349,7 +349,9 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2)
       else if (base
 	       && DECL_P (base))
 	return ptr_deref_may_alias_decl_p (ptr2, base);
-      else
+      /* Try ptr2 when ptr1 points to a constant.  */
+      else if (base
+	       && !CONSTANT_CLASS_P (base))
 	return true;
     }
   if (TREE_CODE (ptr2) == ADDR_EXPR)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-26 10:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 10:09 [gcc r13-1839] Improve ptr_derefs_may_alias_p for the case of &STRING_CST Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).