[llvm-bugs] [Bug 34336] New: Loop-idiom recognition rewrites a loop into memset instead of unrolling it when using LTO
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Aug 27 02:27:11 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34336
Bug ID: 34336
Summary: Loop-idiom recognition rewrites a loop into memset
instead of unrolling it when using LTO
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Scalar Optimizations
Assignee: unassignedbugs at nondot.org
Reporter: phosek at chromium.org
CC: llvm-bugs at lists.llvm.org
This was observed when building our libc with LTO for aarch64 (we haven't seen
the same issue on x86_64), specifically in _dl_start function.
The source snippet is the following:
#define DYN_CNT 32
size_t i, dyn[DYN_CNT];
for (i = 0; i < DYN_CNT; i++)
dyn[i] = 0;
In the non-LTO build, this loop is unrolled as expected:
caa24: ad0003e0 stp q0, q0, [sp]
caa28: ad0103e0 stp q0, q0, [sp,#32]
caa2c: ad0203e0 stp q0, q0, [sp,#64]
caa30: ad0303e0 stp q0, q0, [sp,#96]
caa34: ad0403e0 stp q0, q0, [sp,#128]
caa38: ad0503e0 stp q0, q0, [sp,#160]
caa3c: ad0603e0 stp q0, q0, [sp,#192]
caa40: ad0703e0 stp q0, q0, [sp,#224]
In the LTO build, the loops is turned into a PLT call:
e1814: 940015a3 bl e6ea0 <memset at plt>
Since this code is at the beginning of _dl_start before any relocations have
been performed, this causes segfault.
--
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/20170827/b737cd0c/attachment.html>
More information about the llvm-bugs
mailing list