[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 --- Comment #9 from Jonathan Wakely --- Thanks!
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 Jan Hubicka changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #8 from Jan Hubicka --- Fixed.
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 --- Comment #7 from CVS Commits --- The master branch has been updated by Jan Hubicka : https://gcc.gnu.org/g:4526ec20f17a6182f754da9460d9d944dd123cc0 commit r12-5201-g4526ec20f17a6182f754da9460d9d944dd123cc0 Author: Jan Hubicka Date: Fri Nov 12 16:34:03 2021 +0100 Fix ICE in tree-ssa-structalias.c PR tree-optimization/103175 * ipa-modref.c (modref_lattice::merge): Add sanity check. (callee_to_caller_flags): Make flags adjustment sane. (modref_eaf_analysis::analyze_ssa_name): Likewise.
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 --- Comment #6 from David Binderman --- Created attachment 51773 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51773=edit gzipped C++ source code Another test case. Flag -O1 required.
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 --- Comment #5 from hubicka at kam dot mff.cuni.cz --- The sanity check verifies that functions acessing parameter indirectly also reads the parameter (otherwise the indirect reference can not happen). This patch moves the check earlier and removes some overactive flag cleaning on function call boundary which introduces the non-sential situation. I got bit paranoid here on how return value relates to escaping solution. as discussed on ML, matmul failure is simply the fact that the testcase verified missed optimization is still misssed. diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 72006251f29..a97021c6c60 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1681,6 +1681,13 @@ modref_lattice::merge (int f) { if (f & EAF_UNUSED) return false; + /* Check that flags seems sane: if function does not read the parameter + it can not access it indirectly. */ + gcc_checking_assert (!(f & EAF_NO_DIRECT_READ) + || ((f & EAF_NO_INDIRECT_READ) + && (f & EAF_NO_INDIRECT_CLOBBER) + && (f & EAF_NO_INDIRECT_ESCAPE) + && (f & EAF_NOT_RETURNED_INDIRECTLY))); if ((flags & f) != flags) { flags &= f; @@ -1874,27 +1881,13 @@ modref_eaf_analysis::merge_call_lhs_flags (gcall *call, int arg, argument if needed. */ static int -callee_to_caller_flags (int call_flags, bool ignore_stores, - modref_lattice ) +callee_to_caller_flags (int call_flags, bool ignore_stores) { /* call_flags is about callee returning a value that is not the same as caller returning it. */ call_flags |= EAF_NOT_RETURNED_DIRECTLY | EAF_NOT_RETURNED_INDIRECTLY; - /* TODO: We miss return value propagation. - Be conservative and if value escapes to memory - also mark it as escaping. */ - if (!ignore_stores && !(call_flags & EAF_UNUSED)) -{ - if (!(call_flags & EAF_NO_DIRECT_ESCAPE)) - lattice.merge (~(EAF_NOT_RETURNED_DIRECTLY -| EAF_NOT_RETURNED_INDIRECTLY -| EAF_UNUSED)); - if (!(call_flags & EAF_NO_INDIRECT_ESCAPE)) - lattice.merge (~(EAF_NOT_RETURNED_INDIRECTLY -| EAF_UNUSED)); -} - else + if (ignore_stores) call_flags |= ignore_stores_eaf_flags; return call_flags; } @@ -2033,15 +2026,9 @@ modref_eaf_analysis::analyze_ssa_name (tree name) if (!(call_flags & (EAF_NOT_RETURNED_DIRECTLY | EAF_UNUSED))) m_lattice[index].merge (~(EAF_NO_DIRECT_ESCAPE - | EAF_NO_INDIRECT_ESCAPE - | EAF_UNUSED)); - if (!(call_flags & (EAF_NOT_RETURNED_INDIRECTLY - | EAF_UNUSED))) - m_lattice[index].merge (~(EAF_NO_INDIRECT_ESCAPE | EAF_UNUSED)); call_flags = callee_to_caller_flags - (call_flags, false, - m_lattice[index]); + (call_flags, false); } m_lattice[index].merge (call_flags); } @@ -2057,8 +2044,7 @@ modref_eaf_analysis::analyze_ssa_name (tree name) !(call_flags & EAF_NOT_RETURNED_DIRECTLY), !(call_flags & EAF_NOT_RETURNED_INDIRECTLY)); call_flags = callee_to_caller_flags - (call_flags, ignore_stores, - m_lattice[index]); + (call_flags, ignore_stores); if (!(ecf_flags & (ECF_CONST | ECF_NOVOPS))) m_lattice[index].merge (call_flags); } @@ -2082,8 +2068,7 @@ modref_eaf_analysis::analyze_ssa_name (tree name) if (!(ecf_flags & (ECF_CONST | ECF_NOVOPS))) { call_flags = callee_to_caller_flags -(call_flags, ignore_stores, - m_lattice[index]); +(call_flags, ignore_stores); if (!record_ipa) m_lattice[index].merge (call_flags); else @@ -2105,8 +2090,7 @@ modref_eaf_analysis::analyze_ssa_name (tree name) else { call_flags = callee_to_caller_flags -(call_flags, ignore_stores, - m_lattice[index]); +
Re: [Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
The sanity check verifies that functions acessing parameter indirectly also reads the parameter (otherwise the indirect reference can not happen). This patch moves the check earlier and removes some overactive flag cleaning on function call boundary which introduces the non-sential situation. I got bit paranoid here on how return value relates to escaping solution. as discussed on ML, matmul failure is simply the fact that the testcase verified missed optimization is still misssed. diff --git a/gcc/ipa-modref.c b/gcc/ipa-modref.c index 72006251f29..a97021c6c60 100644 --- a/gcc/ipa-modref.c +++ b/gcc/ipa-modref.c @@ -1681,6 +1681,13 @@ modref_lattice::merge (int f) { if (f & EAF_UNUSED) return false; + /* Check that flags seems sane: if function does not read the parameter + it can not access it indirectly. */ + gcc_checking_assert (!(f & EAF_NO_DIRECT_READ) + || ((f & EAF_NO_INDIRECT_READ) + && (f & EAF_NO_INDIRECT_CLOBBER) + && (f & EAF_NO_INDIRECT_ESCAPE) + && (f & EAF_NOT_RETURNED_INDIRECTLY))); if ((flags & f) != flags) { flags &= f; @@ -1874,27 +1881,13 @@ modref_eaf_analysis::merge_call_lhs_flags (gcall *call, int arg, argument if needed. */ static int -callee_to_caller_flags (int call_flags, bool ignore_stores, - modref_lattice ) +callee_to_caller_flags (int call_flags, bool ignore_stores) { /* call_flags is about callee returning a value that is not the same as caller returning it. */ call_flags |= EAF_NOT_RETURNED_DIRECTLY | EAF_NOT_RETURNED_INDIRECTLY; - /* TODO: We miss return value propagation. - Be conservative and if value escapes to memory - also mark it as escaping. */ - if (!ignore_stores && !(call_flags & EAF_UNUSED)) -{ - if (!(call_flags & EAF_NO_DIRECT_ESCAPE)) - lattice.merge (~(EAF_NOT_RETURNED_DIRECTLY -| EAF_NOT_RETURNED_INDIRECTLY -| EAF_UNUSED)); - if (!(call_flags & EAF_NO_INDIRECT_ESCAPE)) - lattice.merge (~(EAF_NOT_RETURNED_INDIRECTLY -| EAF_UNUSED)); -} - else + if (ignore_stores) call_flags |= ignore_stores_eaf_flags; return call_flags; } @@ -2033,15 +2026,9 @@ modref_eaf_analysis::analyze_ssa_name (tree name) if (!(call_flags & (EAF_NOT_RETURNED_DIRECTLY | EAF_UNUSED))) m_lattice[index].merge (~(EAF_NO_DIRECT_ESCAPE - | EAF_NO_INDIRECT_ESCAPE - | EAF_UNUSED)); - if (!(call_flags & (EAF_NOT_RETURNED_INDIRECTLY - | EAF_UNUSED))) - m_lattice[index].merge (~(EAF_NO_INDIRECT_ESCAPE | EAF_UNUSED)); call_flags = callee_to_caller_flags - (call_flags, false, - m_lattice[index]); + (call_flags, false); } m_lattice[index].merge (call_flags); } @@ -2057,8 +2044,7 @@ modref_eaf_analysis::analyze_ssa_name (tree name) !(call_flags & EAF_NOT_RETURNED_DIRECTLY), !(call_flags & EAF_NOT_RETURNED_INDIRECTLY)); call_flags = callee_to_caller_flags - (call_flags, ignore_stores, - m_lattice[index]); + (call_flags, ignore_stores); if (!(ecf_flags & (ECF_CONST | ECF_NOVOPS))) m_lattice[index].merge (call_flags); } @@ -2082,8 +2068,7 @@ modref_eaf_analysis::analyze_ssa_name (tree name) if (!(ecf_flags & (ECF_CONST | ECF_NOVOPS))) { call_flags = callee_to_caller_flags -(call_flags, ignore_stores, - m_lattice[index]); +(call_flags, ignore_stores); if (!record_ipa) m_lattice[index].merge (call_flags); else @@ -2105,8 +2090,7 @@ modref_eaf_analysis::analyze_ssa_name (tree name) else { call_flags = callee_to_caller_flags -(call_flags, ignore_stores, - m_lattice[index]); +(call_flags, ignore_stores); if (!record_ipa)
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 --- Comment #4 from seurer at gcc dot gnu.org --- Also this one which fails but doesn't ICE g:d70ef65692fced7ab72e0aceeff7407e5a34d96d, r12-5113 make -k check-gcc-fortran RUNTESTFLAGS="dg.exp=gfortran.dg/inline_matmul_17.f90" FAIL: gfortran.dg/inline_matmul_17.f90 -O scan-tree-dump-times optimized "matmul_r4" 2
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 Richard Biener changed: What|Removed |Added Priority|P3 |P1
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 Andrew Pinski changed: What|Removed |Added CC||seurer at gcc dot gnu.org --- Comment #3 from Andrew Pinski --- *** Bug 103178 has been marked as a duplicate of this bug. ***
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 --- Comment #2 from Jonathan Wakely --- FAIL: 18_support/nested_exception/rethrow_if_nested.cc (test for excess errors) FAIL: 20_util/variant/exception_safety.cc (test for excess errors) FAIL: 20_util/variant/run.cc (test for excess errors) FAIL: std/ranges/adaptors/join.cc (test for excess errors)
[Bug tree-optimization/103175] [12 Regression] internal compiler error: in handle_call_arg, at tree-ssa-structalias.c:4139
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103175 Jonathan Wakely changed: What|Removed |Added Summary|internal compiler error: in |[12 Regression] internal |handle_call_arg, at |compiler error: in |tree-ssa-structalias.c:4139 |handle_call_arg, at ||tree-ssa-structalias.c:4139 Known to work||11.2.1 Build|powerpc64le-unknown-linux-g | |nu | Known to fail||12.0 Target|powerpc64le-unknown-linux-g | |nu | Host|powerpc64le-unknown-linux-g | |nu | CC||hubicka at gcc dot gnu.org Last reconfirmed||2021-11-10 Target Milestone|--- |12.0 Ever confirmed|0 |1 Status|UNCONFIRMED |NEW --- Comment #1 from Jonathan Wakely --- Affects at least powerpc64le-unknown-linux-gnu and x86_64-pc-linux-gnu Started with g:d70ef65692fced7ab72e0aceeff7407e5a34d96d "Make EAF flags more regular (and expressive)"