eraman added a comment. Submitted the second part. Instead of the third part, I think it is better to just return when Cost > Threshold instead of breaking out of the loop. Moving the check inside if (SingleBB && TI->getNumSuccessors() > 1) reduces the readability IMO. http://reviews.llvm.org/D17584