Skip to content

Commit a039b24

Browse files
committed
IR verifier check and test
1 parent 79eeb13 commit a039b24

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

llvm/lib/IR/Verifier.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5786,6 +5786,12 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
57865786
Check(cast<ConstantInt>(Call.getArgOperand(3))->getZExtValue() < 2,
57875787
"cache type argument to llvm.prefetch must be 0-1", Call);
57885788
break;
5789+
case Intrinsic::reloc_none: {
5790+
Check(isa<MDString>(
5791+
cast<MetadataAsValue>(Call.getArgOperand(0))->getMetadata()),
5792+
"llvm.reloc.none argument must be a metadata string", &Call);
5793+
break;
5794+
}
57895795
case Intrinsic::stackprotector:
57905796
Check(isa<AllocaInst>(Call.getArgOperand(1)->stripPointerCasts()),
57915797
"llvm.stackprotector parameter #2 must resolve to an alloca.", Call);

llvm/test/Verifier/reloc_none.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
; RUN: not opt -S -passes=verify 2>&1 < %s | FileCheck %s
2+
3+
; CHECK: llvm.reloc.none argument must be a metadata string
4+
; CHECK-NEXT: call void @llvm.reloc.none(metadata !0)
5+
6+
define void @test_reloc_none_bad_arg() {
7+
call void @llvm.reloc.none(metadata !0)
8+
ret void
9+
}
10+
11+
declare void @llvm.reloc.none(metadata)
12+
13+
!0 = !{}

0 commit comments

Comments
 (0)