[PATCH] D52002: Switch optimization for known maximum switch values

Hans Wennborg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 18 03:00:38 PDT 2018


hans added a comment.

In https://reviews.llvm.org/D52002#1238026, @ayonam wrote:

> In https://reviews.llvm.org/D52002#1237991, @hans wrote:
>
> > The default is unreachable here because it would "fall off" the end of the function without returning, which is undefined behaviour. So the switch lowering should be able to remove the range check for the jump table.
>
>
> On second thoughts, I realize that the default may not be unreachable in the case that I mentioned since the block beyond the switch block would then be treated as the default.  Am I right?


Yes, if there are statements after the block, that would be treated as the default and it would not be unreachable.


Repository:
  rL LLVM

https://reviews.llvm.org/D52002





More information about the llvm-commits mailing list