<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 --- - InstCombine: mul -> shl shouldn't preserve NSW"
href="http://llvm.org/bugs/show_bug.cgi?id=21242">21242</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>InstCombine: mul -> shl shouldn't preserve NSW
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</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>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nunoplopes@sapo.pt
</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>The transformation in InstCombineMulDivRem.cpp, lines 156-187, shouldn't
preserve NSW.
Here's why:
Pre: isPowerOf2(C1)
%r = mul nsw %x, C1
=>
%r = shl nsw %x, log2(C1)
Done: 1
ERROR: Domain of poisoness of Target is smaller than Source's for i2 %r
Example:
%x i2 = 1 (0x1)
C1 i2 = 2 (0x2)
Source value: 2 (0x2)
Target value: poison
The multiplication doesn't overflow (1*-2 = -2), but the shift does (goes from
positive 1 to negative -2).
A fix is to propagate only NUW, and discard NSW.</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>