[llvm] 662f57e - [InstCombine] Add tests for memset with undef/poison value (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 06:46:14 PDT 2022


Author: Nikita Popov
Date: 2022-04-21T15:45:54+02:00
New Revision: 662f57ee21a45919ed85f912c3a05153d125d081

URL: https://github.com/llvm/llvm-project/commit/662f57ee21a45919ed85f912c3a05153d125d081
DIFF: https://github.com/llvm/llvm-project/commit/662f57ee21a45919ed85f912c3a05153d125d081.diff

LOG: [InstCombine] Add tests for memset with undef/poison value (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/memset.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/memset.ll b/llvm/test/Transforms/InstCombine/memset.ll
index 81ac83d110828..95048f5d95474 100644
--- a/llvm/test/Transforms/InstCombine/memset.ll
+++ b/llvm/test/Transforms/InstCombine/memset.ll
@@ -33,4 +33,40 @@ define void @memset_to_constant() {
   ret void
 }
 
+define void @memset_undef(i8* %p) {
+; CHECK-LABEL: @memset_undef(
+; CHECK-NEXT:    call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(8) [[P:%.*]], i8 undef, i32 8, i1 false)
+; CHECK-NEXT:    ret void
+;
+  call void @llvm.memset.p0i8.i32(i8* %p, i8 undef, i32 8, i1 false)
+  ret void
+}
+
+define void @memset_undef_volatile(i8* %p) {
+; CHECK-LABEL: @memset_undef_volatile(
+; CHECK-NEXT:    call void @llvm.memset.p0i8.i32(i8* [[P:%.*]], i8 undef, i32 8, i1 true)
+; CHECK-NEXT:    ret void
+;
+  call void @llvm.memset.p0i8.i32(i8* %p, i8 undef, i32 8, i1 true)
+  ret void
+}
+
+define void @memset_poison(i8* %p) {
+; CHECK-LABEL: @memset_poison(
+; CHECK-NEXT:    call void @llvm.memset.p0i8.i32(i8* noundef nonnull align 1 dereferenceable(8) [[P:%.*]], i8 undef, i32 8, i1 false)
+; CHECK-NEXT:    ret void
+;
+  call void @llvm.memset.p0i8.i32(i8* %p, i8 undef, i32 8, i1 false)
+  ret void
+}
+
+define void @memset_poison_volatile(i8* %p) {
+; CHECK-LABEL: @memset_poison_volatile(
+; CHECK-NEXT:    call void @llvm.memset.p0i8.i32(i8* [[P:%.*]], i8 poison, i32 8, i1 true)
+; CHECK-NEXT:    ret void
+;
+  call void @llvm.memset.p0i8.i32(i8* %p, i8 poison, i32 8, i1 true)
+  ret void
+}
+
 declare void @llvm.memset.p0i8.i32(i8* nocapture writeonly, i8, i32, i1) argmemonly nounwind


        


More information about the llvm-commits mailing list