summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2012-05-26 21:19:12 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2012-05-26 21:19:12 +0000
commit5aad872f8c4d85112172057fb5bf9a7f64013c6c (patch)
tree1d422debfe3da179889f004e2be295b5e516c137 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parentf2beccf6b4e9eb59b5080ae866e8d59a38679f15 (diff)
downloadbcm5719-llvm-5aad872f8c4d85112172057fb5bf9a7f64013c6c.tar.gz
bcm5719-llvm-5aad872f8c4d85112172057fb5bf9a7f64013c6c.zip
SDAGBuilder: Don't create an invalid iterator when there is only one switch case.
Found by libstdc++'s debug mode. llvm-svn: 157522
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 0d37c62660d..f8cbcaa0d65 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1984,10 +1984,10 @@ bool SelectionDAGBuilder::handleSmallSwitchRange(CaseRec& CR,
}
}
}
-
// Rearrange the case blocks so that the last one falls through if possible.
Case &BackCase = *(CR.Range.second-1);
- if (NextBlock && Default != NextBlock && BackCase.BB != NextBlock) {
+ if (Size > 1 &&
+ NextBlock && Default != NextBlock && BackCase.BB != NextBlock) {
// The last case block won't fall through into 'NextBlock' if we emit the
// branches in this order. See if rearranging a case value would help.
// We start at the bottom as it's the case with the least weight.
OpenPOWER on IntegriCloud