public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] PR81747, ICE in operator[]
@ 2017-08-09 11:28 Alan Modra
  2017-08-16  9:40 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2017-08-09 11:28 UTC (permalink / raw)
  To: gcc-patches

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PR81747, ICE in operator[]
  2017-08-09 11:28 [PATCH] PR81747, ICE in operator[] Alan Modra
@ 2017-08-16  9:40 ` Alan Modra
  2017-08-24 21:28   ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2017-08-16  9:40 UTC (permalink / raw)
  To: gcc-patches

Ping?

On Wed, Aug 09, 2017 at 08:58:31PM +0930, Alan Modra wrote:
> 	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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PR81747, ICE in operator[]
  2017-08-16  9:40 ` Alan Modra
@ 2017-08-24 21:28   ` Jeff Law
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Law @ 2017-08-24 21:28 UTC (permalink / raw)
  To: Alan Modra, gcc-patches

On 08/15/2017 09:27 PM, Alan Modra wrote:
> Ping?
> 
> On Wed, Aug 09, 2017 at 08:58:31PM +0930, Alan Modra wrote:
>> 	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.
OK.  Sorry I didn't see this one in my queue.  Thanks for pinging it.

jeff

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-24 21:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-09 11:28 [PATCH] PR81747, ICE in operator[] Alan Modra
2017-08-16  9:40 ` Alan Modra
2017-08-24 21:28   ` Jeff Law

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).