[llvm-bugs] [Bug 32289] New: LoopStrengthReduce generates incorrect IR
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 15 11:41:08 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=32289
Bug ID: 32289
Summary: LoopStrengthReduce generates incorrect IR
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: anna at azul.com
CC: llvm-bugs at lists.llvm.org
Created attachment 18100
--> https://bugs.llvm.org/attachment.cgi?id=18100&action=edit
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`.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170315/66438321/attachment.html>
More information about the llvm-bugs
mailing list