[llvm] ac60263 - [MemoryLocation] Handle memset_pattern{4,8,16} in getForDest.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 14 06:41:53 PST 2021
Author: Florian Hahn
Date: 2021-12-14T14:41:28Z
New Revision: ac60263ad173dbd2eba6e0c8d892d8c3dcc5306c
URL: https://github.com/llvm/llvm-project/commit/ac60263ad173dbd2eba6e0c8d892d8c3dcc5306c
DIFF: https://github.com/llvm/llvm-project/commit/ac60263ad173dbd2eba6e0c8d892d8c3dcc5306c.diff
LOG: [MemoryLocation] Handle memset_pattern{4,8,16} in getForDest.
memset_pattern{4,8,16} writes to the first argument. Use getForDest
to return the corresponding MemoryLocation.
Reviewed By: ab
Differential Revision: https://reviews.llvm.org/D114906
Added:
Modified:
llvm/lib/Analysis/MemoryLocation.cpp
llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp
index c74b6258f780e..bfe33efe772f9 100644
--- a/llvm/lib/Analysis/MemoryLocation.cpp
+++ b/llvm/lib/Analysis/MemoryLocation.cpp
@@ -137,6 +137,9 @@ MemoryLocation::getForDest(const CallBase *CB, const TargetLibraryInfo &TLI) {
LibFunc LF;
if (TLI.getLibFunc(*CB, LF) && TLI.has(LF)) {
switch (LF) {
+ case LibFunc_memset_pattern4:
+ case LibFunc_memset_pattern8:
+ case LibFunc_memset_pattern16:
case LibFunc_strncpy:
case LibFunc_strcpy:
case LibFunc_strcat:
diff --git a/llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll b/llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll
index 76e595a1dbb35..9fe5eb3ca7e0f 100644
--- a/llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll
+++ b/llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll
@@ -10,9 +10,7 @@ declare void @memset_pattern16(i8*, i8*, i64)
define void @test_memset_pattern4_const_size(i8* noalias %a, i8* noalias %pattern) {
; CHECK-LABEL: @test_memset_pattern4_const_size(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[A_GEP_1:%.*]] = getelementptr i8, i8* [[A:%.*]], i32 1
-; CHECK-NEXT: store i8 0, i8* [[A_GEP_1]], align 1
-; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, i8* [[A]], i32 17
+; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, i8* [[A:%.*]], i32 17
; CHECK-NEXT: store i8 1, i8* [[A_GEP_17]], align 1
; CHECK-NEXT: call void @memset_pattern4(i8* [[A]], i8* [[PATTERN:%.*]], i64 17)
; CHECK-NEXT: ret void
@@ -48,9 +46,7 @@ entry:
define void @test_memset_pattern8_const_size(i8* noalias %a, i8* noalias %pattern) {
; CHECK-LABEL: @test_memset_pattern8_const_size(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[A_GEP_1:%.*]] = getelementptr i8, i8* [[A:%.*]], i32 1
-; CHECK-NEXT: store i8 0, i8* [[A_GEP_1]], align 1
-; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, i8* [[A]], i32 17
+; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, i8* [[A:%.*]], i32 17
; CHECK-NEXT: store i8 1, i8* [[A_GEP_17]], align 1
; CHECK-NEXT: call void @memset_pattern8(i8* [[A]], i8* [[PATTERN:%.*]], i64 17)
; CHECK-NEXT: ret void
@@ -86,9 +82,7 @@ entry:
define void @test_memset_pattern16_const_size(i8* noalias %a, i8* noalias %pattern) {
; CHECK-LABEL: @test_memset_pattern16_const_size(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[A_GEP_1:%.*]] = getelementptr i8, i8* [[A:%.*]], i32 1
-; CHECK-NEXT: store i8 0, i8* [[A_GEP_1]], align 1
-; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, i8* [[A]], i32 17
+; CHECK-NEXT: [[A_GEP_17:%.*]] = getelementptr i8, i8* [[A:%.*]], i32 17
; CHECK-NEXT: store i8 1, i8* [[A_GEP_17]], align 1
; CHECK-NEXT: call void @memset_pattern16(i8* [[A]], i8* [[PATTERN:%.*]], i64 17)
; CHECK-NEXT: ret void
More information about the llvm-commits
mailing list