public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Bergner <bergner@vnet.ibm.com>
To: Richard Biener <rguenther@suse.de>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	       Bill Schmidt <wschmidt@linux.vnet.ibm.com>,
	       Jakub Jelinek <jakub@redhat.com>
Subject: Re: [PATCH, v3] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch
Date: Mon, 08 May 2017 18:26:00 -0000	[thread overview]
Message-ID: <57f5cf26-28cf-2579-a6df-cab9c02af19b@vnet.ibm.com> (raw)
In-Reply-To: <2B12773A-43AF-4223-A006-04DC46B31070@suse.de>

On 05/08/2017 12:44 PM, Richard Biener wrote:

>>> On Wed, 26 Apr 2017, Peter Bergner wrote:
>>>> One difference from the last patch is that I am no longer setting
>>>> default_label to NULL when we emit a decision tree.  I noticed that
>>>> the decision tree code seemed to generate slightly better code for
>>>> some of my unit tests if I left it alone.  This simplified the
>>>> patch somewhat by removing the changes to emit_case_nodes().
>> [snip]
>>> Can you do the gimple_unreachable_bb_p check earlier in
>>> expand_case so it covers the emit_case_decision_tree path as well
>>> (and verify that works, of course)?  So basically right at
>>>
>>>    /* Find the default case target label.  */
>>>    default_label = jump_target_rtx
>>>        (CASE_LABEL (gimple_switch_default_label (stmt)));
>>>    edge default_edge = EDGE_SUCC (bb, 0);
>>>    int default_prob = default_edge->probability;
>>>
>>> handle this case.
>> That is what the previous patch did, but as I mention above,
>> we generate slightly better code for some test cases (other
>> tests seemed to generate the same code) if we don't attempt
>> to handle the decision tree case.  I'll note that the current
>> unpatched compiler already knows how to remove unreachable
>> case statement blocks when we expand to a decision tree.
>>
>> I can add that code back if you think that it will have a
>> positive benefit for some test case I haven't tried yet.

Any comment on the above?

Peter


  reply	other threads:[~2017-05-08 18:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  0:29 [PATCH] " Peter Bergner
2017-04-13  8:14 ` Richard Biener
2017-04-13 11:07   ` Jakub Jelinek
2017-04-13 20:06   ` Peter Bergner
2017-04-20  8:08     ` Richard Biener
2017-04-20 14:21       ` Peter Bergner
2017-04-27  5:08         ` [PATCH, v3] " Peter Bergner
2017-04-27 12:46           ` Bernhard Reutner-Fischer
2017-04-27 15:16             ` Peter Bergner
2017-05-03 13:43           ` Richard Biener
2017-05-08 16:51             ` Peter Bergner
2017-05-08 17:57               ` Richard Biener
2017-05-08 18:26                 ` Peter Bergner [this message]
2017-05-08 20:55                   ` Peter Bergner
2017-05-09  7:57                     ` Richard Biener

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=57f5cf26-28cf-2579-a6df-cab9c02af19b@vnet.ibm.com \
    --to=bergner@vnet.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    --cc=wschmidt@linux.vnet.ibm.com \
    /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).