<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 --- - Reassociate wrongly preserves nsw in mul->mul transform" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23675&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=yto5xbrfAY1FVsYKbxY37rAxx09hUroeajNqS3rAJjY&s=HqcUhXPjPoYH1Oq-I0plPtgGfW6-xYUYRLJbb_rRpYI&e=">23675</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Reassociate wrongly preserves nsw in mul->mul transform
</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>Keywords</th>
<td>miscompilation
</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>david.majnemer@gmail.com, llvmbugs@cs.uiuc.edu, regehr@cs.utah.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>$ cat a.ll
define i4 @func1821422(i2, i1, i4, i2, i1, i4, i2, i1, i4, i2, i1, i4) {
%13 = mul nsw i4 -2, %2
%14 = add i4 %13, 3
ret i4 %14
}
$ opt -S -reassociate a.ll
define i4 @func1821422(i2, i1, i4, i2, i1, i4, i2, i1, i4, i2, i1, i4) {
%13 = mul nsw i4 %2, 2
%14 = sub i4 3, %13
ret i4 %14
}
$ alive.py b.opt
----------------------------------------
Optimization: 1
Precondition: true
%13 = mul nsw i4 -2, %2
%14 = add i4 %13, 3
ret i4 %14
=>
%p13 = mul nsw i4 %2, 2
%p14 = sub i4 3, %p13
ret i4 %p14
ERROR: Domain of poisoness of Target is smaller than Source's for i4 ret_
Example:
%2 i4 = 0x4 (4)
%13 i4 = 0x8 (8, -8)
%14 i4 = 0xB (11, -5)
%p13 i4 = 0x8 (8, -8)
%p14 i4 = 0xB (11, -5)
Source value: 0xB (11, -5)
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>