llvm-project/llvm/test/Verifier/nonnull_metadata.ll
Nikita Popov 474f20ba26 [Verifier] Check that !nonnull metadata is empty
!nonnull expectes an empty metadata argument, so check that this
is the case in the verifier. This came up as a problem in
https://reviews.llvm.org/D141386.

This requires dropping the verifier call in the compatibility-6.0.ll
test (which is not present in any of the other bitcode compatibility
tests). The original input unfortunately used typo'd nonnull
metadata.
2023-01-23 11:16:49 +01:00

22 lines
499 B
LLVM

; RUN: not llvm-as < %s 2>&1 | FileCheck %s
declare ptr @dummy()
; CHECK: nonnull applies only to pointer types
define void @test_not_pointer(ptr %p) {
load i32, ptr %p, !nonnull !{}
ret void
}
; CHECK: nonnull applies only to load instructions, use attributes for calls or invokes
define void @test_not_load() {
call ptr @dummy(), !nonnull !{}
ret void
}
; CHECK: nonnull metadata must be empty
define void @test_invalid_arg(ptr %p) {
load ptr, ptr %p, !nonnull !{i32 0}
ret void
}