diff options
author | YLChenZ <chentongyongcz@gmail.com> | 2025-04-19 09:32:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-19 09:32:40 +0800 |
commit | b9e11eade7f1c1e2464f9f891d3769d8e48c6509 (patch) | |
tree | 6301c240689a99fbd08c0924b37ea27114594a44 /llvm/lib/IR/Verifier.cpp | |
parent | f9bd89b7ac35920241740969b2b83c45a6a6ddb3 (diff) | |
download | llvm-b9e11eade7f1c1e2464f9f891d3769d8e48c6509.zip llvm-b9e11eade7f1c1e2464f9f891d3769d8e48c6509.tar.gz llvm-b9e11eade7f1c1e2464f9f891d3769d8e48c6509.tar.bz2 |
[llvm][ir]: fix llc crashes on function definitions with label parameters (#136285)
Closes #136144.
After the patch:
```llvm
; label-crash.ll
define void @invalid_arg_type(i32 %0) {
1:
call void @foo(label %1)
ret void
}
declare void @foo(label)
```
```
lambda@ubuntu22:~/test$ llc -o out.s label-crash.ll
Function argument cannot be of label type!
label %0
ptr @foo
llc: error: 'label-crash.ll': input module cannot be verified
```
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r-- | llvm/lib/IR/Verifier.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 35c4d60..8afe360 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -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(), + "Function argument cannot be of label type!", &Arg, &F); if (!IsIntrinsic) { Check(!Arg.getType()->isMetadataTy(), "Function takes metadata but isn't an intrinsic", &Arg, &F); |