diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-26 21:19:12 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-05-26 21:19:12 +0000 |
commit | 5db954dab9a9e3c57c6e5194bf902a34a458d555 (patch) | |
tree | 1200f314ef11dabddb88922be41581fcfa5e33fa /lib | |
parent | c511b2a5a1b91f08be6572ca7d7215c261176bc4 (diff) | |
download | external_llvm-5db954dab9a9e3c57c6e5194bf902a34a458d555.zip external_llvm-5db954dab9a9e3c57c6e5194bf902a34a458d555.tar.gz external_llvm-5db954dab9a9e3c57c6e5194bf902a34a458d555.tar.bz2 |
SDAGBuilder: Don't create an invalid iterator when there is only one switch case.
Found by libstdc++'s debug mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157522 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 0d37c62..f8cbcaa 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/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. |