diff options
author | Teresa Johnson <tejohnson@google.com> | 2017-06-28 13:07:37 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2017-06-28 13:07:37 +0000 |
commit | 538b8d25f03a55e6169247e45b3f43d0c87feaf6 (patch) | |
tree | 960fe5828b1f64123790667d08de016a2c001a60 /llvm/test/CodeGen | |
parent | b738ffa845493d8af0d08acaa7c8b2b91dd295b2 (diff) | |
download | bcm5719-llvm-538b8d25f03a55e6169247e45b3f43d0c87feaf6.tar.gz bcm5719-llvm-538b8d25f03a55e6169247e45b3f43d0c87feaf6.zip |
Add zero-length check to memcpy/memset load store loop expansion
Summary:
I was testing using this expansion logic in other cases besides
NVPTX, and found some runtime failures due to the lack of a check
for a zero length memcpy/memset before the loop. There is already
such a check in the memmove expansion code though.
Reviewers: hfinkel
Subscribers: jholewinski, wdng, llvm-commits
Differential Revision: https://reviews.llvm.org/D34707
llvm-svn: 306541
Diffstat (limited to 'llvm/test/CodeGen')
-rw-r--r-- | llvm/test/CodeGen/NVPTX/lower-aggr-copies.ll | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/NVPTX/lower-aggr-copies.ll b/llvm/test/CodeGen/NVPTX/lower-aggr-copies.ll index 192d4becb05..f522c6722ee 100644 --- a/llvm/test/CodeGen/NVPTX/lower-aggr-copies.ll +++ b/llvm/test/CodeGen/NVPTX/lower-aggr-copies.ll @@ -17,6 +17,8 @@ entry: ret i8* %dst ; IR-LABEL: @memcpy_caller +; IR: [[CMPREG:%[0-9]+]] = icmp eq i64 0, %n +; IR: br i1 [[CMPREG]], label %split, label %loadstoreloop ; IR: loadstoreloop: ; IR: [[LOADPTR:%[0-9]+]] = getelementptr inbounds i8, i8* %src, i64 ; IR-NEXT: [[VAL:%[0-9]+]] = load i8, i8* [[LOADPTR]] @@ -73,6 +75,8 @@ entry: ; IR-LABEL: @memset_caller ; IR: [[VAL:%[0-9]+]] = trunc i32 %c to i8 +; IR: [[CMPREG:%[0-9]+]] = icmp eq i64 0, %n +; IR: br i1 [[CMPREG]], label %split, label %loadstoreloop ; IR: loadstoreloop: ; IR: [[STOREPTR:%[0-9]+]] = getelementptr inbounds i8, i8* %dst, i64 ; IR-NEXT: store i8 [[VAL]], i8* [[STOREPTR]] |