Fix a disconcerting bug in Value::isUsedInBasicBlock, which gave wrong answers for blocks larger than 3 instrs.
Also add a unit test. PR15727.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179370 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/IR/Value.cpp b/lib/IR/Value.cpp
index adc702e..e9eb012 100644
--- a/lib/IR/Value.cpp
+++ b/lib/IR/Value.cpp
@@ -118,7 +118,7 @@
for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
if (std::find(I->op_begin(), I->op_end(), this) != I->op_end())
return true;
- if (MaxBlockSize-- == 0) // If the block is larger fall back to use_iterator
+ if (--MaxBlockSize == 0) // If the block is larger fall back to use_iterator
break;
}