[llvm-commits] [llvm] r157522 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sat May 26 14:19:12 PDT 2012
Author: d0k
Date: Sat May 26 16:19:12 2012
New Revision: 157522
URL: http://llvm.org/viewvc/llvm-project?rev=157522&view=rev
Log:
SDAGBuilder: Don't create an invalid iterator when there is only one switch case.
Found by libstdc++'s debug mode.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=157522&r1=157521&r2=157522&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sat May 26 16:19:12 2012
@@ -1984,10 +1984,10 @@
}
}
}
-
// 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.
More information about the llvm-commits
mailing list