[llvm-bugs] [Bug 28036] New: LoopStrengthReduce does not choose the optimum IV
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 7 02:31:27 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28036
Bug ID: 28036
Summary: LoopStrengthReduce does not choose the optimum IV
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: arnaud.degrandmaison at arm.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
Created attachment 16484
--> https://llvm.org/bugs/attachment.cgi?id=16484&action=edit
C testcase
The following trivial testcase:
void foo(int * restrict a, int * restrict b, int * restrict c, unsigned LEN) {
for (unsigned i = 0; i < LEN; i++)
c[i] = a[i] + b[i];
}
Compile with : clang -target aarch64-linux-gnu -O2 -Wall -S -o - test2.c
We get:
.LBB0_3:
and x8, x9, #0x1fffffff8
cbz x8, .LBB0_7
add x10, x0, #16
add x11, x1, #16
add x12, x2, #16
mov x13, x8
.LBB0_5:
ldp q0, q1, [x10, #-16]
ldp q2, q3, [x11, #-16]
sub x13, x13, #8
add x10, x10, #32
add x11, x11, #32
add v0.4s, v2.4s, v0.4s
add v1.4s, v3.4s, v1.4s
stp q0, q1, [x12, #-16]
add x12, x12, #32
cbnz x13, .LBB0_5
But I would have expected something like:
.LBB0_3:
and x8, x9, #0x1fffffff8
cbz x8, .LBB0_7
mov x13, x8
.LBB0_5:
ldp q0, q1, [x0], #32
ldp q2, q3, [x1], #32
sub x13, x13, #8
add v0.4s, v2.4s, v0.4s
add v1.4s, v3.4s, v1.4s
stp q0, q1, [x2], #32
cbnz x13, .LBB0_5
LoopStrengthReduce is transforming the code to a state which prevents using
writeback at all.
--
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/20160607/7a8effee/attachment-0001.html>
More information about the llvm-bugs
mailing list