This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, v3] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch
On Mon, 8 May 2017, Peter Bergner wrote:
> On 05/08/2017 01:20 PM, Peter Bergner wrote:
> > 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 should be more careful with my description here. The patch does
> affect both unreachable case statements for both decision trees as
> well as jump tables, and that leads to improved code for both
> decision trees as well as jump tables.
>
> What I meant to say above, is that the current handling of unreachable
> default case statements in the unpatched compiler seems to lead to
> slightly better code for some test cases than attempting to handle
> default_label == NULL in the decision tree code. It was for that
> reason, I placed the code in expand_case() only in the jump table
> path. The fact it made the patch smaller was a bonus, since I didn't
> need to protect emit_case_nodes() from a NULL default_label.
Ah, ok.
> As I said, if you think it will help some test case I haven't tried yet,
> I can add that support back.
Well, let's to that incremental then, if at all.
Thanks,
Richard.
- References:
- Re: [PATCH, v3] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch
- Re: [PATCH, v3] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch
- Re: [PATCH, v3] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch
- Re: [PATCH, v3] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch
- Re: [PATCH, v3] Fix PR51513, switch statement with default case containing __builtin_unreachable leads to wild branch