<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Value::isUsedInBasicBlock is buggy."
href="http://llvm.org/bugs/show_bug.cgi?id=15727">15727</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Value::isUsedInBasicBlock is buggy.
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Core LLVM classes
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>fjia@cs.ucsd.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>I happened to use Value::isUsedInBasicBlock(const BasicBlock *BB) const.
I noticed that the function always returns false when the basic block size is
larger than 3. So I checked the source of Value.c and found there is a bug
there.
113 unsigned MaxBlockSize = 3;
114 for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E;
++I) {
115 if (std::find(I->op_begin(), I->op_end(), this) != I->op_end())
116 return true;
117 if (MaxBlockSize-- == 0) // If the block is larger fall back to
use_iterator
118 break;
119 }
120
121 if (MaxBlockSize != 0) // We scanned the entire block and found no use.
122 return false;
If block size is larger than 3, in line 117, the loop is breaked out, and
MaxBlockSize = -1. In line 121, MaxBlockSize != 0 is true, and false is
returned. This explains why the function always returns false when the block
size is larger than 3.
The potential bug fix is
117 if (--MaxBlockSize == 0) // If ...
Thanks!</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>