summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2014-11-29 21:17:05 +0000
committerHans Wennborg <hans@hanshq.net>2014-11-29 21:17:05 +0000
commit6c42d1a5de2345adb3e21b59f3e10d4ea781d0c4 (patch)
tree6ce3a5e38cf306fd8bfb9558e68688cf18e61d1a /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parent2bfd9129f400c4f3b9d108dcb6be798d2fbfc6dc (diff)
downloadbcm5719-llvm-6c42d1a5de2345adb3e21b59f3e10d4ea781d0c4.tar.gz
bcm5719-llvm-6c42d1a5de2345adb3e21b59f3e10d4ea781d0c4.zip
Switch lowering: Fix broken 'Figure out which block is next' code
This doesn't seem to have worked in a long time, but other optimizations would clean it up. llvm-svn: 222961
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 8f582f1aeb6..196d26d50ed 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -2694,6 +2694,9 @@ void SelectionDAGBuilder::visitSwitch(const SwitchInst &SI) {
// Figure out which block is immediately after the current one.
MachineBasicBlock *NextBlock = nullptr;
+ if (SwitchMBB + 1 != FuncInfo.MF->end())
+ NextBlock = SwitchMBB + 1;
+
MachineBasicBlock *Default = FuncInfo.MBBMap[SI.getDefaultDest()];
// If there is only the default destination, branch to it if it is not the
OpenPOWER on IntegriCloud