diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-05-08 21:23:39 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-05-08 21:23:39 +0000 |
commit | ae0254dabca242f69e2d534097df84f810c7a2d0 (patch) | |
tree | 210f5f4db45bcd4baa5a6efb4b587e12fd26fbdb /llvm/lib | |
parent | c67979bf4d301654e3863d0e3adc3f6a3d5bba29 (diff) | |
download | bcm5719-llvm-ae0254dabca242f69e2d534097df84f810c7a2d0.tar.gz bcm5719-llvm-ae0254dabca242f69e2d534097df84f810c7a2d0.zip |
Switch lowering: cluster adjacent fall-through cases even at -O0
It's cheap to do, and codegen is much faster if cases can be merged
into clusters.
llvm-svn: 236905
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 52d12fcea31..832437c33f4 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -8012,10 +8012,12 @@ void SelectionDAGBuilder::visitSwitch(const SwitchInst &SI) { MachineBasicBlock *DefaultMBB = FuncInfo.MBBMap[SI.getDefaultDest()]; - if (TM.getOptLevel() != CodeGenOpt::None) { - // Cluster adjacent cases with the same destination. - sortAndRangeify(Clusters); + // Cluster adjacent cases with the same destination. We do this at all + // optimization levels because it's cheap to do and will make codegen faster + // if there are many clusters. + sortAndRangeify(Clusters); + if (TM.getOptLevel() != CodeGenOpt::None) { // Replace an unreachable default with the most popular destination. // FIXME: Exploit unreachable default more aggressively. bool UnreachableDefault = |