From 662f57ee21a45919ed85f912c3a05153d125d081 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 21 Apr 2022 15:45:54 +0200 Subject: [PATCH] [InstCombine] Add tests for memset with undef/poison value (NFC) --- llvm/test/Transforms/InstCombine/memset.ll | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/memset.ll b/llvm/test/Transforms/InstCombine/memset.ll index 81ac83d..95048f5 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 -- 2.7.4