<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 - miss to recognize two equal variables"
href="https://bugs.llvm.org/show_bug.cgi?id=48148">48148</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>miss to recognize two equal variables
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>chenzheng1030@hotmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>```
define i64 @foo1(i16 %0, i64 %1, i64 %2) {
entry:
%cmp1 = icmp ult i16 %0, 43
%cond1 = select i1 %cmp1, i64 %1, i64 %2
%cmp2 = icmp ugt i16 %0, 42
%cond2 = select i1 %cmp2, i64 %2, i64 %1
%ret = xor i64 %cond1, %cond2
ret i64 %ret
}
```
we should be able to recognize that `%cond1` and `%cond2` are the same, so the
function should just return zero.
Comments from Sanjay Patel:
This looks like a missed canonicalization (instcombine):
<a href="https://alive2.llvm.org/ce/z/oUDr6C">https://alive2.llvm.org/ce/z/oUDr6C</a>
We should choose one of those forms - maybe we need to refine
InstCombiner::isCanonicalPredicate()? This could be tricky because we have many
different kinds of cmp+select canonicalizations that we already try. We will
need to make sure that we do not invert some other transform and cause an
infinite-loop.</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>