[PATCH] D114906: [MemoryLocation] Handle memset_pattern{4,8,16} in getForDest.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 1 12:53:53 PST 2021
fhahn created this revision.
fhahn added reviewers: efriedma, ab, t.p.northover.
Herald added a subscriber: hiraditya.
fhahn requested review of this revision.
Herald added a project: LLVM.
memset_pattern{4,8,16} writes to the first argument. Use getForDest
to return the corresponding MemoryLocation.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D114906
Files:
llvm/lib/Analysis/MemoryLocation.cpp
llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll
Index: llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll
===================================================================
--- llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll
+++ llvm/test/Transforms/DeadStoreElimination/libcalls-darwin.ll
@@ -10,9 +10,7 @@
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 @@
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 @@
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
Index: llvm/lib/Analysis/MemoryLocation.cpp
===================================================================
--- llvm/lib/Analysis/MemoryLocation.cpp
+++ llvm/lib/Analysis/MemoryLocation.cpp
@@ -136,6 +136,9 @@
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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114906.391119.patch
Type: text/x-patch
Size: 2626 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211201/ae385eb8/attachment.bin>
More information about the llvm-commits
mailing list