]> 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 10:01:02 +0000 (10:01 +0000)
committerAyonam Ray <ayonam@rrlogic.co.in>
Wed, 6 Mar 2019 10:01:02 +0000 (10:01 +0000)
commit62fa6d90b1b60ca6fa7e5e90af1ce015655ac5c4
tree16e0093aec2b88618ddac75a1a961e67b9585fbe
parent46b09a3368af1be5005d31fd1d70bad08df352f9
[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@355490 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