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
2 changes: 2 additions & 0 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2931,6 +2931,8 @@ void Verifier::visitFunction(const Function &F) {
FT->getParamType(i));
Check(Arg.getType()->isFirstClassType(),
"Function arguments must have first-class types!", &Arg);
Check(!Arg.getType()->isLabelTy(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is checking arguments on the function not calls.

Though really, we should not allow labels as inline asm operands either -- it looks like this is some leftover from an old implementation the predates both blockaddresses and callbr.

"Function argument cannot be of label type!", &Arg);
if (!IsIntrinsic) {
Check(!Arg.getType()->isMetadataTy(),
"Function takes metadata but isn't an intrinsic", &Arg, &F);
Expand Down
7 changes: 7 additions & 0 deletions llvm/test/Verifier/invalid-label-param.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
; RUN: not llvm-as < %s 2>&1 | FileCheck %s

define void @invalid_arg_type(label %p) {
; CHECK: Function argument cannot be of label type!
ret void
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for call site, e.g.:

define void @test(i32 %0) {
1:
  call void @foo(label %1)
  ret void
}

declare void @foo(label)

Loading