<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 --- - Wrong folding of xor in DAGCombiner"
href="http://llvm.org/bugs/show_bug.cgi?id=20542">20542</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Wrong folding of xor in DAGCombiner
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Other
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</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>nrink@broadcom.com
</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>Created <span class=""><a href="attachment.cgi?id=12858" name="attach_12858" title="Added check for argument's bit width to 'visitXOR' in DAGCombiner.">attachment 12858</a> <a href="attachment.cgi?id=12858&action=edit" title="Added check for argument's bit width to 'visitXOR' in DAGCombiner.">[details]</a></span>
Added check for argument's bit width to 'visitXOR' in DAGCombiner.
The DAGCombiner tries to fold 'xor %tmp, 1' into '!%tmp' (read: "not %tmp").
This is valid only if the type of %tmp is i1.
Example code that triggers this problem:
1 @g_609 = global i32 42
2
3 define i32 @main() #0 {
4 entry:
5 %0 = load i32* @g_609, align 4
6 %cmp = icmp slt i32 %0, 1
7 %sub = sext i1 %cmp to i32
8 %xor = xor i32 %sub, 1
9 ret i32 %xor
10 }
NOTE: The problem occurs only if the first argument of the 'xor' is a
'select_cc' node. Since X86 does not lower 'select_cc', this problem cannot be
reproduced on X86.
Suggested patch attached.</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>