[LLVMbugs] [Bug 18374] New: Loop reroller fails to reroll loop with variable upper bound on 64-bit targets
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Jan 3 15:43:35 PST 2014
http://llvm.org/bugs/show_bug.cgi?id=18374
Bug ID: 18374
Summary: Loop reroller fails to reroll loop with variable upper
bound on 64-bit targets
Product: tools
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: opt
Assignee: unassignedbugs at nondot.org
Reporter: dpeixott at codeaurora.org
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 11813
--> http://llvm.org/bugs/attachment.cgi?id=11813&action=edit
test.c
Given this loop:
$ cat test.c
void foo(int *A, int *B, int n) {
for (int i = 0; i < n; i+=4) {
A[i+0] = B[i+0] * 4;
A[i+1] = B[i+1] * 4;
A[i+2] = B[i+2] * 4;
A[i+3] = B[i+3] * 4;
}
}
The loop reroller fails to reroll the loop on the 64-bit targets I tested
(x86_64 and AArch64).
$ clang -target x86_64-none-linux test.c -S -o- -O1 -emit-llvm -o test.ll
$ opt -loop-reroll -S -debug-only=loop-reroll -stats
It works correctly on 32-bit targets (tested i386 and armv7).
Looking at the bitcode, I suspect the problem is that the induction variable is
extended to 64-bits, but the loop bound remains 32-bits. The induction variable
is truncated inside the loop body to 32-bits. I think this makes SCEV unable to
compute the number of times the backedge is taken.
If I change the "int n" to a "long n" the loop is successfully rerolled.
--
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/20140103/6bf49c2f/attachment.html>
More information about the llvm-bugs
mailing list