[PATCH] D87971: [MemLoc] Support lllvm.memcpy.inline in MemoryLocation::getForArgument
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 19 10:32:15 PDT 2020
xbolva00 created this revision.
xbolva00 added a reviewer: fhahn.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
xbolva00 requested review of this revision.
https://reviews.llvm.org/D87971
Files:
llvm/lib/Analysis/MemoryLocation.cpp
llvm/test/Transforms/DeadStoreElimination/MSSA/memintrinsics.ll
llvm/test/Transforms/DeadStoreElimination/MSSA/memset-and-memcpy.ll
Index: llvm/test/Transforms/DeadStoreElimination/MSSA/memset-and-memcpy.ll
===================================================================
--- llvm/test/Transforms/DeadStoreElimination/MSSA/memset-and-memcpy.ll
+++ llvm/test/Transforms/DeadStoreElimination/MSSA/memset-and-memcpy.ll
@@ -94,19 +94,29 @@
}
define void @test_memset_memcpy_inline(i8* noalias %P, i8* noalias %Q) {
+; CHECK-LABEL: @test_memset_memcpy_inline(
+; CHECK-NEXT: tail call void @llvm.memcpy.inline.p0i8.p0i8.i64(i8* align 1 [[P:%.*]], i8* align 1 [[Q:%.*]], i64 12, i1 false)
+; CHECK-NEXT: ret void
+;
tail call void @llvm.memset.p0i8.i64(i8* %P, i8 42, i64 8, i1 false)
tail call void @llvm.memcpy.inline.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 12, i1 false)
- ret void
+ ret void
}
define void @test_store_memcpy_inline(i8* noalias %P, i8* noalias %Q) {
+; CHECK-LABEL: @test_store_memcpy_inline(
+; CHECK-NEXT: [[P_4:%.*]] = getelementptr i8, i8* [[P:%.*]], i64 4
+; CHECK-NEXT: store i8 4, i8* [[P_4]], align 1
+; CHECK-NEXT: tail call void @llvm.memcpy.inline.p0i8.p0i8.i64(i8* align 1 [[P]], i8* align 1 [[Q:%.*]], i64 4, i1 false)
+; CHECK-NEXT: ret void
+;
store i8 0, i8* %P
%P.1 = getelementptr i8, i8* %P, i64 1
store i8 1, i8* %P.1
%P.4 = getelementptr i8, i8* %P, i64 4
store i8 4, i8* %P.4
tail call void @llvm.memcpy.inline.p0i8.p0i8.i64(i8* align 1 %P, i8* align 1 %Q, i64 4, i1 false)
- ret void
+ ret void
}
declare void @llvm.memcpy.inline.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64 immarg, i1 immarg)
Index: llvm/test/Transforms/DeadStoreElimination/MSSA/memintrinsics.ll
===================================================================
--- llvm/test/Transforms/DeadStoreElimination/MSSA/memintrinsics.ll
+++ llvm/test/Transforms/DeadStoreElimination/MSSA/memintrinsics.ll
@@ -2,6 +2,7 @@
; RUN: opt -S -dse < %s | FileCheck %s
declare void @llvm.memcpy.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i1) nounwind
+declare void @llvm.memcpy.inline.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i1) nounwind
declare void @llvm.memmove.p0i8.p0i8.i8(i8* nocapture, i8* nocapture, i8, i1) nounwind
declare void @llvm.memset.p0i8.i8(i8* nocapture, i8, i8, i1) nounwind
@@ -97,3 +98,17 @@
ret void
}
+
+define void @test7() {
+; CHECK-LABEL: @test7(
+; CHECK-NEXT: ret void
+;
+ %A = alloca i8
+ %B = alloca i8
+
+ store i8 0, i8* %A ;; Written to by memcpy
+
+ call void @llvm.memcpy.inline.p0i8.p0i8.i8(i8* %A, i8* %B, i8 -1, i1 false)
+
+ ret void
+}
Index: llvm/lib/Analysis/MemoryLocation.cpp
===================================================================
--- llvm/lib/Analysis/MemoryLocation.cpp
+++ llvm/lib/Analysis/MemoryLocation.cpp
@@ -158,6 +158,7 @@
break;
case Intrinsic::memset:
case Intrinsic::memcpy:
+ case Intrinsic::memcpy_inline:
case Intrinsic::memmove:
assert((ArgIdx == 0 || ArgIdx == 1) &&
"Invalid argument index for memory intrinsic");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87971.292975.patch
Type: text/x-patch
Size: 3040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200919/d6cd98dd/attachment.bin>
More information about the llvm-commits
mailing list