I initially thought starting with a more narrow definition and later expanding would make more sense. But as pointed out in review for PR #129220, this restriction is generating additional unnecessary work. This patch alters the intrinsic to accept patterns of any type. Future patches will update LoopIdiomRecognize and PreISelIntrinsicLowering to take advantage of this. The verifier will complain if an unsized type is used. I've additionally taken the opportunity to remove a comment from the LangRef about some bit widths potentially not being supported by the target. I don't think this is any more true than it is for arbitrary width loads/stores which don't carry a similar warning that I can see. A verifier check ensures that only sized types are used for the pattern.
11 lines
374 B
LLVM
11 lines
374 B
LLVM
; 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
|