[LLVMbugs] [Bug 24056] New: memcpy and memmove are lowered the same way
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jul 7 14:22:56 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=24056
Bug ID: 24056
Summary: memcpy and memmove are lowered the same way
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Backend: PTX
Assignee: unassignedbugs at nondot.org
Reporter: eliben at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
In NVPTXLowerAggrCopies, NVPTX lowers llvm.memcpy and llvm.memmove in exactly
the same way, by producing load-store loops counting up. Here's a sample
lowering to PTX:
ld.param.u64 %rd2, [_Z11foo_memmovePfS_j_param_0];
ld.param.u64 %rd3, [_Z11foo_memmovePfS_j_param_1];
ld.param.u32 %rd1, [_Z11foo_memmovePfS_j_param_2];
mov.u64 %rd9, 0;
LBB1_1:
add.s64 %rd7, %rd2, %rd9;
ld.u8 %rs1, [%rd7];
add.s64 %rd8, %rd3, %rd9;
st.u8 [%rd8], %rs1;
add.s64 %rd9, %rd9, 1;
setp.lt.u64 %p1, %rd9, %rd1;
@%p1 bra LBB1_1;
ret;
This is incorrect for memmove, which guarantees to work correctly when the
ranges of source and destination overlap. If source starts lower than dest and
there's an overlap, the result will be incorrect.
--
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/20150707/caa31caa/attachment.html>
More information about the llvm-bugs
mailing list