<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 - LoopStrengthReduce generates incorrect IR"
href="https://bugs.llvm.org/show_bug.cgi?id=32289">32289</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LoopStrengthReduce generates incorrect IR
</td>
</tr>
<tr>
<th>Product</th>
<td>new-bugs
</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>new bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>anna@azul.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=18100" name="attach_18100" title="Original IR">attachment 18100</a> <a href="attachment.cgi?id=18100&action=edit" title="Original IR">[details]</a></span>
Original IR
Steps to reproduce (on trunk):
opt -loop-reduce test2.ll -S > test2_lsr.ll
Source code snippet:
vMeth1(long longarg, int intarg) {
int ivar, jvar;
boolean bArr[]=new boolean[N];
ivar = 1;
do {
intarg += (((ivar * ivar) + intarg) - Test.instanceCount);
bArr[ivar] = (((Test.dFld - Test.instanceCount) /
(((long)(-(Test.fFld
* Test.instanceCount))) | 1)) !=
(--intarg));
Test.iArrFld[ivar] = (int)(intarg *= (int)longarg);
longarg += (++Test.iArrFld[ivar]);
} while (++ivar < 98);
jvar = 68;
while (--jvar > 0) {
intarg += (int)(intarg -= (int)(-(++Test.fFld)));
try {
intarg = (Test.iArrFld[jvar - 1] % -82);
} catch (ArithmeticException a_e) {}
}
sum += longarg + ivar + jvar;
}
This is in effect: sum += longarg + 98 + 0.
Both the loops above are transformed through LSR. When LSR is enabled, the
longarg value for the sum is calculated incorrectly.
I have attached the original and transformed IR, along with detailed comments
on how the value is calculated (and where the difference occurs).
The result (sum) is calculated in the `ResultBB`.</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>