public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "chenglulu at loongson dot cn" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/109192] [13 Regression] timeout with -O3 since r13-5579
Date: Tue, 28 Mar 2023 08:07:18 +0000	[thread overview]
Message-ID: <bug-109192-4-NMA8NkyTPv@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109192-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109192

--- Comment #13 from chenglulu <chenglulu at loongson dot cn> ---
(In reply to CVS Commits from comment #9)
> The master branch has been updated by Andrew Macleod <amacleod@gcc.gnu.org>:
> 
> https://gcc.gnu.org/g:0963cb5fde158cce986523a90fa9edc51c881f31
> 
> commit r13-6787-g0963cb5fde158cce986523a90fa9edc51c881f31
> Author: Andrew MacLeod <amacleod@redhat.com>
> Date:   Mon Mar 20 16:11:12 2023 -0400
> 
>     Terminate GORI calculations if a relation is not relevant.
>     
>     We currently allow VARYING lhs GORI calculations to continue if there is
>     a relation present in the hope it will eventually better refine a result.
>     This adds a check that the relation is relevant to the outgoing range
>     calculation first.  If it is not relevant, stop calculating.
>     
>             PR tree-optimization/109192
>             * gimple-range-gori.cc (gori_compute::compute_operand_range):
>             Terminate gori calculations if a relation is not relevant.
>             * value-relation.h (value_relation::set_relation): Allow
>             equality between op1 and op2 if they are the same.

After applying this patch, the zheev.fppized.f file in the compilation
attachment under the LoongArch and riscv64 architecture will report ICE. The
error message is as follows:

$ riscv64-linux-gnu-gfortran -c -o zheev.fppized.o -O3
-fno-aggressive-loop-optimizations -std=legacy zheev.fppized.f

during GIMPLE pass: dom
zheev.fppized.f:4968:23:

 4968 |       SUBROUTINE DLAMC2( BETA, T, RND, EPS, EMIN, RMIN, EMAX, RMAX )
      |                       ^
internal compiler error: in in_chain_p, at gimple-range-gori.cc:119
0x25683f3 range_def_chain::in_chain_p(tree_node*, tree_node*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:119
0x2569e66 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:667
0x256bfd4 gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:1174
0x256a408 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:726
0x256c648 gori_compute::compute_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:1254
0x256c744 gori_compute::compute_operand1_and_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:1274
0x256a3b7 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:723
0x256ccfc gori_compute::outgoing_edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:1384
0x255e2dc ranger_cache::edge_range(vrange&, edge_def*, tree_node*,
ranger_cache::rfd_mode)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-cache.cc:964
0x255e465 ranger_cache::range_on_edge(vrange&, edge_def*, tree_node*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-cache.cc:1001
0x2563ba9 fur_edge::get_operand(vrange&, tree_node*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-fold.cc:131
0x25652a5 fold_using_range::range_of_range_op(vrange&,
gimple_range_op_handler&, fur_source&)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-fold.cc:558
0x2564cf8 fold_using_range::fold_stmt(vrange&, gimple*, fur_source&,
tree_node*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-fold.cc:489
0x256420c fold_range(vrange&, gimple*, edge_def*, range_query*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-fold.cc:326
0x256cf5f gori_compute::outgoing_edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-gori.cc:1411
0x2560449 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-cache.cc:1524
0x255f069 ranger_cache::fill_block_cache(tree_node*, basic_block_def*,
basic_block_def*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-cache.cc:1212
0x255e5c7 ranger_cache::block_range(vrange&, basic_block_def*, tree_node*,
bool)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range-cache.cc:1039
0x2558761 gimple_ranger::range_on_entry(vrange&, basic_block_def*, tree_node*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range.cc:156
0x2558588 gimple_ranger::range_of_expr(vrange&, tree_node*, gimple*)
       
/home/chenglulu/work/loongisa-toolchain/gcc-upstream/gcc/gimple-range.cc:130
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

I chased the code and found that the error was caused by the fact that
vrel_ptr->op1() or vrel_ptr->op2() was empty.
So I think the following modification should be done:

diff --git a/gcc/gimple-range-gori.cc b/gcc/gimple-range-gori.cc
index 2f8d4704ea4..5c25f1635f8 100644
--- a/gcc/gimple-range-gori.cc
+++ b/gcc/gimple-range-gori.cc
@@ -658,7 +658,7 @@ gori_compute::compute_operand_range (vrange &r, gimple
*stmt,
   // the result.
   if (lhs.varying_p ())
     {
-      if (!vrel_ptr)
+      if (!vrel_ptr || (!vrel_ptr->op1 () || !vrel_ptr->op2 ()))
        return false;
       // If there is a relation (ie: x != y) , it can only be relevant if
       // a) both elements are in the defchain

  parent reply	other threads:[~2023-03-28  8:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19 10:20 [Bug c/109192] New: timeout with -g -O3 -fno-var-tracking ? dcb314 at hotmail dot com
2023-03-19 16:56 ` [Bug middle-end/109192] timeout with " dcb314 at hotmail dot com
2023-03-19 17:18 ` dcb314 at hotmail dot com
2023-03-19 17:18 ` dcb314 at hotmail dot com
2023-03-19 19:11 ` [Bug tree-optimization/109192] [13 Regression] timeout with -O3 -fno-var-tracking since r13-5579 pinskia at gcc dot gnu.org
2023-03-20 10:25 ` [Bug tree-optimization/109192] [13 Regression] timeout with -O3 " rguenth at gcc dot gnu.org
2023-03-20 10:35 ` rguenth at gcc dot gnu.org
2023-03-20 20:20 ` amacleod at redhat dot com
2023-03-21 10:33 ` rguenth at gcc dot gnu.org
2023-03-21 14:15 ` cvs-commit at gcc dot gnu.org
2023-03-21 14:15 ` amacleod at redhat dot com
2023-03-21 14:20 ` rguenth at gcc dot gnu.org
2023-03-28  7:52 ` chenglulu at loongson dot cn
2023-03-28  8:07 ` chenglulu at loongson dot cn [this message]
2023-03-28 13:22 ` amacleod at redhat dot com
2023-03-30  1:04 ` chenglulu at loongson dot cn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109192-4-NMA8NkyTPv@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).