[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

Jan Hubicka  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Jan Hubicka  ---
Fixed.

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

--- Comment #5 from CVS Commits  ---
The master branch has been updated by Jan Hubicka :

https://gcc.gnu.org/g:4d2d5565a0953eaa829d10006baf007cf33bab89

commit r12-5217-g4d2d5565a0953eaa829d10006baf007cf33bab89
Author: Jan Hubicka 
Date:   Fri Nov 12 23:55:50 2021 +0100

Fix wrong code with pure functions

I introduced bug into find_func_aliases_for_call in handling pure
functions.
Instead of reading global memory pure functions are believed to write
global
memory.  This results in misoptimization of the testcase at -O1.

The change to pta-callused.c updates the template for new behaviour of the
constraint generation. We copy nonlocal memory to calluse which is correct
but
also not strictly necessary because later we take care to add nonlocal_p
flag
manually.

gcc/ChangeLog:

PR tree-optimization/103209
* tree-ssa-structalias.c (find_func_aliases_for_call): Fix
use of handle_rhs_call

gcc/testsuite/ChangeLog:

PR tree-optimization/103209
* gcc.dg/tree-ssa/pta-callused.c: Update template.
* gcc.c-torture/execute/pr103209.c: New test.

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

--- Comment #4 from Martin Liška  ---
Wow, what a bug :P

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

--- Comment #3 from Jan Hubicka  ---
This is bug I introduced to tree-ssa-structalias where I reversed order of
flags which deterine global memory read and writes. So pure functions are
handled as functions writting global memory but not reading it.  I am very
surprised it took so long to show as wrong code.

diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 153ddf57a61..34fd47fdf47 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4996,7 +4996,7 @@ find_func_aliases_for_call (struct function *fn, gcall
*t)
 reachable from their arguments, but they are not an escape
 point for reachable memory of their arguments.  */
   else if (flags & (ECF_PURE|ECF_LOOPING_CONST_OR_PURE))
-   handle_rhs_call (t, , implicit_pure_eaf_flags, true, false);
+   handle_rhs_call (t, , implicit_pure_eaf_flags, false, true);
   /* If the call is to a replaceable operator delete and results
 from a delete expression as opposed to a direct call to
 such operator, then the effects for PTA (in particular

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

Jan Hubicka  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org
 Status|NEW |ASSIGNED

--- Comment #2 from Jan Hubicka  ---
mine.

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P1
   Target Milestone|--- |12.0

[Bug tree-optimization/103209] [12 Regression] wrong code at -O1 on x86_64-linux-gnu since r12-4324-g008e7397dad971c0

2021-11-12 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103209

Martin Liška  changed:

   What|Removed |Added

   Last reconfirmed||2021-11-12
 Status|UNCONFIRMED |NEW
Summary|[12 Regression] wrong code  |[12 Regression] wrong code
   |at -O1 on x86_64-linux-gnu  |at -O1 on x86_64-linux-gnu
   ||since
   ||r12-4324-g008e7397dad971c0
 Ever confirmed|0   |1
 CC||hubicka at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org

--- Comment #1 from Martin Liška  ---
Started with r12-4324-g008e7397dad971c0.