public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wschmidt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/57993] [4.9 Regression] ICE: verify_ssa failed (definition in block n does not dominate use in block m)
Date: Fri, 26 Jul 2013 18:18:00 -0000	[thread overview]
Message-ID: <bug-57993-4-Vg2DzAlJhW@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-57993-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57993

--- Comment #6 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Here's the patch I'm currently testing, which corrects the problem for this
test case.  We'll see how it does on regressions.

Index: gcc/gimple-ssa-strength-reduction.c
===================================================================
--- gcc/gimple-ssa-strength-reduction.c    (revision 201267)
+++ gcc/gimple-ssa-strength-reduction.c    (working copy)
@@ -2179,6 +2179,18 @@ phi_add_costs (gimple phi, slsr_cand_t c, int one_
   int cost = 0;
   slsr_cand_t phi_cand = base_cand_from_table (gimple_phi_result (phi));

+  /* If we work our way back to a phi that isn't dominated by the hidden
+     basis, this isn't a candidate for replacement.  Indicate this by
+     returning an unreasonably high cost.  It's not easy to detect
+     these situations when determining the basis, so we defer the
+     decision until now.  */
+  basic_block phi_bb = gimple_bb (phi_cand->cand_stmt);
+  slsr_cand_t basis = lookup_cand (c->basis);
+  basic_block basis_bb = gimple_bb (basis->cand_stmt);
+
+  if (phi_bb == basis_bb || !dominated_by_p (CDI_DOMINATORS, phi_bb,
basis_bb))
+    return COST_INFINITE;
+
   for (i = 0; i < gimple_phi_num_args (phi); i++)
     {
       tree arg = gimple_phi_arg_def (phi, i);


  parent reply	other threads:[~2013-07-26 18:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 11:30 [Bug tree-optimization/57993] New: " antoine.balestrat at gmail dot com
2013-07-26 12:54 ` [Bug tree-optimization/57993] [4.9 Regression] " mpolacek at gcc dot gnu.org
2013-07-26 13:14 ` mpolacek at gcc dot gnu.org
2013-07-26 16:36 ` wschmidt at gcc dot gnu.org
2013-07-26 16:46 ` mpolacek at gcc dot gnu.org
2013-07-26 17:25 ` wschmidt at gcc dot gnu.org
2013-07-26 18:18 ` wschmidt at gcc dot gnu.org [this message]
2013-07-28  0:53 ` wschmidt at gcc dot gnu.org
2013-07-30  1:02 ` wschmidt at gcc dot gnu.org
2013-08-03 14:42 ` wschmidt at gcc dot gnu.org

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-57993-4-Vg2DzAlJhW@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).