Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/docs/LangRef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15640,8 +15640,8 @@ Syntax:
"""""""

This is an overloaded intrinsic. You can use
``llvm.experimental.memset.pattern`` on any integer bit width and for
different address spaces. Not all targets support all bit widths however.
``llvm.experimental.memset.pattern`` on any sized type for different address
spaces.

::

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/IR/Intrinsics.td
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ def int_memset_inline
def int_experimental_memset_pattern
: Intrinsic<[],
[llvm_anyptr_ty, // Destination.
llvm_anyint_ty, // Pattern value.
llvm_any_ty, // Pattern value.
llvm_anyint_ty, // Count (number of times to fill value).
llvm_i1_ty], // IsVolatile.
[IntrWriteMem, IntrArgMemOnly, IntrWillReturn, IntrNoFree, IntrNoCallback,
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5583,7 +5583,11 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
case Intrinsic::memmove:
case Intrinsic::memset:
case Intrinsic::memset_inline:
break;
case Intrinsic::experimental_memset_pattern: {
const auto Memset = cast<MemSetPatternInst>(&Call);
Check(Memset->getValue()->getType()->isSized(),
"unsized types cannot be used as memset patterns", Call);
break;
}
case Intrinsic::memcpy_element_unordered_atomic:
Expand Down
10 changes: 10 additions & 0 deletions llvm/test/Verifier/memset-pattern-unsized.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
; RUN: not opt -passes=verify < %s 2>&1 | FileCheck %s

; CHECK: unsized types cannot be used as memset patterns

%X = type opaque
define void @bar(ptr %P, %X %value) {
call void @llvm.experimental.memset.pattern.p0.s_s.i32.0(ptr %P, %X %value, i32 4, i1 false)
ret void
}
declare void @llvm.experimental.memset.pattern.p0.s_s.i32.0(ptr nocapture, %X, i32, i1) nounwind
Loading