<html>
<head>
<base href="https://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 wrongly preserves mul nsw" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23635&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=LnUbVtpg112PFsEcMa3dv7j6qASwizDDzkTnC2755N4&s=OsZQHMynbXAmy8o0q79pIcu9ViWqcxFTfrs07yiVy2I&e=">23635</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Instcombine wrongly preserves mul 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>$ cat a.ll
define i2 @func34669005(i2, i1, i4, i2, i1, i4, i2, i1, i4, i2, i1, i4) {
%13 = mul nsw i2 %0, %3
%14 = mul nsw i2 %6, %0
%15 = sub nuw nsw i2 %13, %14
ret i2 %15
}
$ opt.exe -instcombine -S a.ll
define i2 @func34669005(i2, i1, i4, i2, i1, i4, i2, i1, i4, i2, i1, i4) {
%13 = sub i2 %3, %6
%14 = mul nsw i2 %13, %0
ret i2 %14
}
$ ./alive.py a.opt
----------------------------------------
%13 = mul nsw i2 %0, %3
%14 = mul nsw i2 %6, %0
%15 = sub nuw nsw i2 %13, %14
ret i2 %15
=>
%p13 = sub i2 %3, %6
%p14 = mul nsw i2 %p13, %0
ret i2 %p14
ERROR: Domain of poisoness of Target is smaller than Source's for i2 ret_
Example:
%0 i2 = 0x3 (3, -1)
%3 i2 = 0x1 (1)
%6 i2 = 0x3 (3, -1)
%13 i2 = 0x3 (3, -1)
%14 i2 = 0x1 (1)
%15 i2 = 0x2 (2, -2)
%p13 i2 = 0x2 (2, -2)
%p14 i2 = 0x2 (2, -2)
Source value: 0x2 (2, -2)
Target value: poison</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>