public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] PR81747, ICE in operator[]
Date: Wed, 09 Aug 2017 11:28:00 -0000	[thread overview]
Message-ID: <20170809112831.GH16312@bubble.grove.modra.org> (raw)

The testcase in this PR is failing in cse2 when processing the
following basic block.

(note 31 30 389 9 [bb 9] NOTE_INSN_BASIC_BLOCK)
(jump_insn 389 31 39 9 (parallel [
            (set (pc)
                (if_then_else (ne (reg:DI 138)
                        (const_int 1 [0x1]))
                    (label_ref:DI 39)
                    (pc)))
            (set (reg:DI 138)
                (plus:DI (reg:DI 138)
                    (const_int -1 [0xffffffffffffffff])))
            (clobber (scratch:CC))
            (clobber (scratch:DI))
        ]) "/home/alan/src/tmp/pr81747.c":19 832 {ctrdi_internal1}
     (int_list:REG_BR_PROB 38000 (nil))
 -> 39)
;;  succ:       13 [always (guessed)]  (FALLTHRU,LOOP_EXIT)

The insn is rather odd.  It meets single_set by virtue of reg 138
being dead, and since the branch destination is the fall-through, the
whole basic block could be deleted..

Regardless of whether this insn should have been deleted earlier, it
seems wrong to try to infer anything about the condition based on the
jump destination when we have a degenerate conditional jump that
branches to its fall-through.

Bootstrapped and regression tested powerpc64le-linux.  OK?

	PR rtl-optimization/81747
	* cse.c (cse_extended_basic_block): Don't attempt to record
	equivalences for degenerate conditional jumps that branch
	to their fall-through.

diff --git a/gcc/cse.c b/gcc/cse.c
index 6a968d1..85be372 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -6640,6 +6640,7 @@ cse_extended_basic_block (struct cse_basic_block_data *ebb_data)
 	 equivalences due to the condition being tested.  */
       insn = BB_END (bb);
       if (path_entry < path_size - 1
+	  && EDGE_COUNT (bb->succs) == 2
 	  && JUMP_P (insn)
 	  && single_set (insn)
 	  && any_condjump_p (insn))

-- 
Alan Modra
Australia Development Lab, IBM

             reply	other threads:[~2017-08-09 11:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 11:28 Alan Modra [this message]
2017-08-16  9:40 ` Alan Modra
2017-08-24 21:28   ` Jeff Law

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=20170809112831.GH16312@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=gcc-patches@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).