tree-optimization/116785 - relax volatile handling in PTA

Message ID 20240927125058.2BF2F1386E@imap1.dmz-prg2.suse.org
State Committed
Commit 85f5d0642184b68b38bf3daee5a1d04b753850b1
Headers
Series tree-optimization/116785 - relax volatile handling in PTA |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 fail Test failed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Test passed

Commit Message

Richard Biener Sept. 27, 2024, 12:50 p.m. UTC
  When there's volatile qualified stores we do not have to treat the
destination as pointing to ANYTHING.  It's only when reading from
it that we want to treat the resulting pointers as pointing to ANYTHING.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Richard.

	PR tree-optimization/116785
	* tree-ssa-structalias.cc (get_constraint_for_1): Only
	volatile qualified reads produce ANYTHING.
---
 gcc/tree-ssa-structalias.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/gcc/tree-ssa-structalias.cc b/gcc/tree-ssa-structalias.cc
index d6a53f801f0..54c4818998d 100644
--- a/gcc/tree-ssa-structalias.cc
+++ b/gcc/tree-ssa-structalias.cc
@@ -3646,7 +3646,7 @@  get_constraint_for_1 (tree t, vec<ce_s> *results, bool address_p,
       }
     case tcc_reference:
       {
-	if (TREE_THIS_VOLATILE (t))
+	if (!lhs_p && TREE_THIS_VOLATILE (t))
 	  /* Fall back to anything.  */
 	  break;
 
@@ -3751,7 +3751,7 @@  get_constraint_for_1 (tree t, vec<ce_s> *results, bool address_p,
       }
     case tcc_declaration:
       {
-	if (VAR_P (t) && TREE_THIS_VOLATILE (t))
+	if (!lhs_p && VAR_P (t) && TREE_THIS_VOLATILE (t))
 	  /* Fall back to anything.  */
 	  break;
 	get_constraint_for_ssa_var (t, results, address_p);