diff mbox series

Fix typo in ipa-modref

Message ID 20210329181151.GA17139@kam.mff.cuni.cz
State New
Headers show
Series Fix typo in ipa-modref | expand

Commit Message

Jan Hubicka March 29, 2021, 6:11 p.m. UTC
Hi,
this patch fixes if (deref) that is reversed in merge_call_lhs_flags.
I re-run stats on cc1plus that seems comparable to last run.

Bootstrapped/regtested x86_64-linux.

Alias oracle query stats:                                                       
  refs_may_alias_p: 66575703 disambiguations, 76462658 queries                  
  ref_maybe_used_by_call_p: 364568 disambiguations, 67280898 queries            
  call_may_clobber_ref_p: 217587 disambiguations, 221304 queries                
  nonoverlapping_component_refs_p: 0 disambiguations, 36514 queries             
  nonoverlapping_refs_since_match_p: 17351 disambiguations, 61127 must overlaps, 79253 queries
  aliasing_component_refs_p: 64537 disambiguations, 2076259 queries             
  TBAA oracle: 24082735 disambiguations 57590168 queries                        
               11651231 are in alias set 0                                      
               10865812 queries asked about the same object                     
               132 queries asked about the same alias set                       
               0 access volatile                                                
               9473619 are dependent in the DAG                                 
               1516639 are aritificially in conflict with void *                
                                                                                
Modref stats:                                                                   
  modref use: 13892 disambiguations, 409262 queries                             
  modref clobber: 1358267 disambiguations, 15950909 queries                     
  3287388 tbaa queries (0.206094 per modref query)                              
  519328 base compares (0.032558 per modref query)                              
                                                                                
PTA query stats:                                                                
  pt_solution_includes: 11809203 disambiguations, 19340135 queries              
  pt_solutions_intersect: 1217666 disambiguations, 13770732 queries             

gcc/ChangeLog:

2021-03-29  Jan Hubicka  <hubicka@ucw.cz>

	* ipa-modref.c (merge_call_lhs_flags): Correct handling of deref.
	(analyze_ssa_name_flags): Fix typo in comment.

gcc/testsuite/ChangeLog:

2021-03-29  Jan Hubicka  <hubicka@ucw.cz>

	* gcc.c-torture/compile/pr99751.c: New test.

Comments

Richard Biener March 29, 2021, 6:42 p.m. UTC | #1
On March 29, 2021 8:11:51 PM GMT+02:00, Jan Hubicka <hubicka@ucw.cz> wrote:
>Hi,
>this patch fixes if (deref) that is reversed in merge_call_lhs_flags.
>I re-run stats on cc1plus that seems comparable to last run.
>
>Bootstrapped/regtested x86_64-linux.
>
>Alias oracle query stats:                                              
>        
>refs_may_alias_p: 66575703 disambiguations, 76462658 queries           
>      
>ref_maybe_used_by_call_p: 364568 disambiguations, 67280898 queries     
>      
>call_may_clobber_ref_p: 217587 disambiguations, 221304 queries         
>      
>nonoverlapping_component_refs_p: 0 disambiguations, 36514 queries      
>      
>nonoverlapping_refs_since_match_p: 17351 disambiguations, 61127 must
>overlaps, 79253 queries
>aliasing_component_refs_p: 64537 disambiguations, 2076259 queries      
>      
>TBAA oracle: 24082735 disambiguations 57590168 queries                 
>      
>      11651231 are in alias set 0                                      
>      10865812 queries asked about the same object                     
>      132 queries asked about the same alias set                       
>      0 access volatile                                                
>      9473619 are dependent in the DAG                                 
>      1516639 are aritificially in conflict with void *                
>                                                                       
>Modref stats:                                                          
>        
>modref use: 13892 disambiguations, 409262 queries                      
>      
>modref clobber: 1358267 disambiguations, 15950909 queries              
>      
>3287388 tbaa queries (0.206094 per modref query)                       
>      
>519328 base compares (0.032558 per modref query)                       
>      
>                                                                       
>PTA query stats:                                                       
>        
>pt_solution_includes: 11809203 disambiguations, 19340135 queries       
>      
>pt_solutions_intersect: 1217666 disambiguations, 13770732 queries      
>      
>
>gcc/ChangeLog:
>
>2021-03-29  Jan Hubicka  <hubicka@ucw.cz>
>
>	* ipa-modref.c (merge_call_lhs_flags): Correct handling of deref.
>	(analyze_ssa_name_flags): Fix typo in comment.
>
>gcc/testsuite/ChangeLog:
>
>2021-03-29  Jan Hubicka  <hubicka@ucw.cz>
>
>	* gcc.c-torture/compile/pr99751.c: New test.

Why compile torture?

>diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
>index 7aaf53be8f4..5f33bb5b410 100644
>--- a/gcc/ipa-modref.c
>+++ b/gcc/ipa-modref.c
>@@ -1545,9 +1545,9 @@ merge_call_lhs_flags (gcall *call, int arg, int
>index, bool deref,
>       tree lhs = gimple_call_lhs (call);
>       analyze_ssa_name_flags (lhs, lattice, depth + 1, ipa);
>       if (deref)
>-	lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]);
>-      else
> 	lattice[index].merge_deref (lattice[SSA_NAME_VERSION (lhs)], false);
>+      else
>+	lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]);
>     }
>   /* In the case of memory store we can do nothing.  */
>   else
>@@ -1621,7 +1621,7 @@ analyze_ssa_name_flags (tree name,
>vec<modref_lattice> &lattice, int depth,
>       else if (gcall *call = dyn_cast <gcall *> (use_stmt))
> 	{
> 	  tree callee = gimple_call_fndecl (call);
>-	  /* Return slot optiomization would require bit of propagation;
>+	  /* Return slot optimization would require bit of propagation;
> 	     give up for now.  */
> 	  if (gimple_call_return_slot_opt_p (call)
> 	      && gimple_call_lhs (call) != NULL_TREE
>diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99751.c
>b/gcc/testsuite/gcc.c-torture/compile/pr99751.c
>new file mode 100644
>index 00000000000..f1d5101c359
>--- /dev/null
>+++ b/gcc/testsuite/gcc.c-torture/compile/pr99751.c
>@@ -0,0 +1,20 @@
>+int *ptr1 = 0, **ptr2 = &ptr1;
>+
>+int *identity(int *p)
>+{
>+  return p;
>+}
>+
>+void store_to_c(int *p)
>+{
>+  *ptr2 = identity(p);
>+}
>+
>+int main()
>+{
>+  int f;
>+  store_to_c(&f);
>+  if (ptr1 != &f)
>+    __builtin_abort();
>+  return 0;
>+}
Jan Hubicka March 29, 2021, 6:56 p.m. UTC | #2
> >gcc/testsuite/ChangeLog:
> >
> >2021-03-29  Jan Hubicka  <hubicka@ucw.cz>
> >
> >	* gcc.c-torture/compile/pr99751.c: New test.
> 
> Why compile torture?

Ah, sorry, it was meant to be execute. I will move the test.

Honza
Jan Hubicka March 29, 2021, 7:08 p.m. UTC | #3
> > >gcc/testsuite/ChangeLog:
> > >
> > >2021-03-29  Jan Hubicka  <hubicka@ucw.cz>
> > >
> > >	* gcc.c-torture/compile/pr99751.c: New test.
> > 
> > Why compile torture?
> 
> Ah, sorry, it was meant to be execute. I will move the test.

It is now renamed as
https://gcc.gnu.org/g:7b6ca93b2d57ead352cd5cc3e10be4c33dda674b

        PR ipa/99751
        * gcc.c-torture/compile/pr99751.c: Rename from ...
        * gcc.c-torture/execute/pr99751.c: ... to this.

diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99751.c b/gcc/testsuite/gcc.c-torture/execute/pr99751.c
similarity index 100%
rename from gcc/testsuite/gcc.c-torture/compile/pr99751.c
rename to gcc/testsuite/gcc.c-torture/execute/pr99751.c
> 
> Honza
diff mbox series

Patch

diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c
index 7aaf53be8f4..5f33bb5b410 100644
--- a/gcc/ipa-modref.c
+++ b/gcc/ipa-modref.c
@@ -1545,9 +1545,9 @@  merge_call_lhs_flags (gcall *call, int arg, int index, bool deref,
       tree lhs = gimple_call_lhs (call);
       analyze_ssa_name_flags (lhs, lattice, depth + 1, ipa);
       if (deref)
-	lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]);
-      else
 	lattice[index].merge_deref (lattice[SSA_NAME_VERSION (lhs)], false);
+      else
+	lattice[index].merge (lattice[SSA_NAME_VERSION (lhs)]);
     }
   /* In the case of memory store we can do nothing.  */
   else
@@ -1621,7 +1621,7 @@  analyze_ssa_name_flags (tree name, vec<modref_lattice> &lattice, int depth,
       else if (gcall *call = dyn_cast <gcall *> (use_stmt))
 	{
 	  tree callee = gimple_call_fndecl (call);
-	  /* Return slot optiomization would require bit of propagation;
+	  /* Return slot optimization would require bit of propagation;
 	     give up for now.  */
 	  if (gimple_call_return_slot_opt_p (call)
 	      && gimple_call_lhs (call) != NULL_TREE
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr99751.c b/gcc/testsuite/gcc.c-torture/compile/pr99751.c
new file mode 100644
index 00000000000..f1d5101c359
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr99751.c
@@ -0,0 +1,20 @@ 
+int *ptr1 = 0, **ptr2 = &ptr1;
+
+int *identity(int *p)
+{
+  return p;
+}
+
+void store_to_c(int *p)
+{
+  *ptr2 = identity(p);
+}
+
+int main()
+{
+  int f;
+  store_to_c(&f);
+  if (ptr1 != &f)
+    __builtin_abort();
+  return 0;
+}