https://bugs.llvm.org/show_bug.cgi?id=38242
Bug ID: 38242
Summary: Missed chance for auto vectorization
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedb...@nondot.org
Reporter: david.bolvan...@gmail.com
CC: llvm-bugs@lists.llvm.org
Code:
typedef struct {
int *arr;
unsigned size;
} attr_t;
int foo(attr_t *e, int x) {
int s = e->size;
for (unsigned i = 0; i < s; ++i) {
e->arr[i] = i + x;
}
};
Clang -O3
foo(attr_t*, int):
mov rax, qword ptr [rdi]
xor ecx, ecx
.LBB0_1:
lea edx, [rsi + rcx]
mov edi, ecx
mov dword ptr [rax + 4*rdi], edx
add ecx, 1
jmp .LBB0_1
GCC can vectorize it well.
Godbolt:
https://godbolt.org/g/ytE3UW
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs