summaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2006-05-08 16:51:36 +0000
committerNate Begeman <natebegeman@mac.com>2006-05-08 16:51:36 +0000
commit17c275ff2ce9e94d647e781f6dac6320d088f899 (patch)
treefb99cb061951d929f2c397040a633b79867040ff /lib/CodeGen
parent403be7eafc8922c20d7e8253bc8d6d0abd0448cb (diff)
downloadllvm-17c275ff2ce9e94d647e781f6dac6320d088f899.tar.gz
llvm-17c275ff2ce9e94d647e781f6dac6320d088f899.tar.bz2
llvm-17c275ff2ce9e94d647e781f6dac6320d088f899.tar.xz
Make emission of jump tables a bit less conservative; they are now required
to be only 31.25% dense, rather than 75% dense. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 4ea83508bf..e9ac44693a 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -880,9 +880,9 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) {
const BasicBlock *LLVMBB = CurMBB->getBasicBlock();
Reloc::Model Relocs = TLI.getTargetMachine().getRelocationModel();
- // If the switch has more than 5 blocks, and at least 75% dense, then emit a
- // jump table rather than lowering the switch to a binary tree of conditional
- // branches.
+ // If the switch has more than 5 blocks, and at least 31.25% dense, and the
+ // target supports indirect branches, then emit a jump table rather than
+ // lowering the switch to a binary tree of conditional branches.
// FIXME: Make this work with PIC code
if (TLI.isOperationLegal(ISD::BRIND, TLI.getPointerTy()) &&
(Relocs == Reloc::Static || Relocs == Reloc::DynamicNoPIC) &&
@@ -891,7 +891,7 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) {
uint64_t Last = cast<ConstantIntegral>(Cases.back().first)->getRawValue();
double Density = (double)Cases.size() / (double)((Last - First) + 1ULL);
- if (Density >= 0.75) {
+ if (Density >= 0.3125) {
// Create a new basic block to hold the code for loading the address
// of the jump table, and jumping to it. Update successor information;
// we will either branch to the default case for the switch, or the jump