diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 10b3104d6b6..264e4e0df44 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1112,8 +1112,10 @@ static bool BlockIsSimpleEnoughToThreadThrough(BasicBlock *BB) { // If this basic block contains anything other than a PHI (which controls the // branch) and branch itself, bail out. FIXME: improve this in the future. - for (BasicBlock::iterator BBI = BB->begin(); &*BBI != BI; ++BBI, ++Size) { + for (BasicBlock::iterator BBI = BB->begin(); &*BBI != BI; ++BBI) { if (Size > 10) return false; // Don't clone large BB's. + if (!isa(BBI)) + ++Size; // We can only support instructions that are do not define values that are // live outside of the current basic block.