<html>
<head>
<base href="https://bugs.llvm.org/">
</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 tracking of undefined to remove branches."
href="https://bugs.llvm.org/show_bug.cgi?id=41815">41815</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Value tracking of undefined to remove branches.
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>slandden@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>The following code does not need a branch, because uninitialized memory has
undefined contents, and certainly shouldn't have one when the popcnt
instruction is supported:
struct get_sparse_ret {
size_t index;
bool godefault;
};
struct get_sparse_ret
__getsparse(size_t key, struct sparse_table_entry *map) {
struct get_sparse_ret ret;
if ((((key * 64) / 64) * 64) * 16 > map[0].length) {
ret.godefault = true;
return ret;
}
ret = __getsparseinbounds(key, map);
return ret;
}
I could put the if after the function call, but that wouldn't specify that I
don't care about the first return value if the second return value is true (and
C doesn't have an undefined I can set it to to communicate that).</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>