diff options
author | Nate Begeman <natebegeman@mac.com> | 2006-05-08 16:51:36 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2006-05-08 16:51:36 +0000 |
commit | d7a19102d185b62050474465df106c56c4352b5b (patch) | |
tree | 8ca9bb421fef394ac8094741efcc946814437642 /llvm/lib/CodeGen | |
parent | 9733bde74c61d7ea5989ce979480de85cef74224 (diff) | |
download | bcm5719-llvm-d7a19102d185b62050474465df106c56c4352b5b.tar.gz bcm5719-llvm-d7a19102d185b62050474465df106c56c4352b5b.zip |
Make emission of jump tables a bit less conservative; they are now required
to be only 31.25% dense, rather than 75% dense.
llvm-svn: 28165
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 4ea83508bf1..e9ac44693ad 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/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 |