]> granicus.if.org Git - llvm/commit
[CodeGen] Omit range checks from jump tables when lowering switches with unreachable...
authorAyonam Ray <ayonam@rrlogic.co.in>
Wed, 6 Mar 2019 07:27:45 +0000 (07:27 +0000)
committerAyonam Ray <ayonam@rrlogic.co.in>
Wed, 6 Mar 2019 07:27:45 +0000 (07:27 +0000)
commitb71ba91724faf6b372daf6d4b98b1948a1cc6613
treeb9b3f13d93cfc6dfda2dbfad0646e29f59fa645d
parent5e6e8711f85e91ea33ad3b29a1d2ebe138dbf929
[CodeGen] Omit range checks from jump tables when lowering switches with unreachable default

During the lowering of a switch that would result in the generation of a
jump table, a range check is performed before indexing into the jump
table, for the switch value being outside the jump table range and a
conditional branch is inserted to jump to the default block. In case the
default block is unreachable, this conditional jump can be omitted. This
patch implements omitting this conditional branch for unreachable
defaults.

Differential Revision: https://reviews.llvm.org/D52002
Reviewers: Hans Wennborg, Eli Freidman, Roman Lebedev

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@355483 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h
test/CodeGen/AArch64/switch-unreachable-default.ll [new file with mode: 0644]
test/CodeGen/X86/pr38743.ll
test/CodeGen/X86/switch-jump-table.ll