diff options
author | Ayonam Ray <ayonam@rrlogic.co.in> | 2019-03-06 07:27:45 +0000 |
---|---|---|
committer | Ayonam Ray <ayonam@rrlogic.co.in> | 2019-03-06 07:27:45 +0000 |
commit | 6025fa8e30071730b3239b322cdf64b680eb3aa9 (patch) | |
tree | 80afd3acede2bfb81c3d659e109611b1b30af3f4 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | |
parent | a75c4df5242fb5b0b2d69b459533f3067aeecfe9 (diff) | |
download | bcm5719-llvm-6025fa8e30071730b3239b322cdf64b680eb3aa9.tar.gz bcm5719-llvm-6025fa8e30071730b3239b322cdf64b680eb3aa9.zip |
[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
llvm-svn: 355483
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h index e84214dbf5e..09dd7afd925 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h @@ -277,11 +277,12 @@ private: const Value *SValue; MachineBasicBlock *HeaderBB; bool Emitted; + bool OmitRangeCheck; JumpTableHeader(APInt F, APInt L, const Value *SV, MachineBasicBlock *H, - bool E = false) + bool E = false, bool ORC = false) : First(std::move(F)), Last(std::move(L)), SValue(SV), HeaderBB(H), - Emitted(E) {} + Emitted(E), OmitRangeCheck(ORC) {} }; using JumpTableBlock = std::pair<JumpTableHeader, JumpTable>; |