[llvm-commits] [llvm] r157525 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sun May 27 02:44:53 PDT 2012
Author: d0k
Date: Sun May 27 04:44:52 2012
New Revision: 157525
URL: http://llvm.org/viewvc/llvm-project?rev=157525&view=rev
Log:
SDAGBuilder: Avoid iterator invalidation harder.
vector.begin()-1 is invalid too.
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=157525&r1=157524&r2=157525&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Sun May 27 04:44:52 2012
@@ -1991,7 +1991,7 @@
// 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.
- for (CaseItr I = CR.Range.second-2, E = CR.Range.first-1; I != E; --I) {
+ for (CaseItr I = CR.Range.second-2, E = CR.Range.first; I >= E; --I) {
if (I->BB == NextBlock) {
std::swap(*I, BackCase);
break;
More information about the llvm-commits
mailing list