[PATCH] Improving LowerSwitch behavior for contiguous ranges
Marcello Maggioni
hayarms at gmail.com
Wed Jun 11 08:32:52 PDT 2014
Looks like it gives the same result
2014-06-11 14:18 GMT+01:00 Joerg Sonnenberger <joerg at britannica.bec.de>:
> On Wed, Jun 11, 2014 at 02:05:23AM +0100, Marcello Maggioni wrote:
> > Hello Joerg,
> >
> > by unreachable default you mean something like this?
> >
> > int foo(int a) {
> > switch (a) {
> > case 0:
> > return 10;
> > case 1:
> > return 20;
> > case 2:
> > return 2;
> > case 8:
> > return 3;
> > case 9:
> > return 4;
> > case 10:
> > return 5;
> > default:
> > abort();
> > }
> > }
>
> More like explicit __builtin_unreachable(), since abort() still has side
> effects. Practical use case is switching over an enum.
>
> Joerg
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/b158da22/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cfg_unswitched_unrch.dot
Type: application/msword
Size: 3764 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/b158da22/attachment.dot>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_unswitched_unrch.ll
Type: application/octet-stream
Size: 2596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140611/b158da22/attachment.obj>
More information about the llvm-commits
mailing list