aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorJon Chesterfield <jonathanchesterfield@gmail.com>2024-04-16 10:33:54 +0100
committerGitHub <noreply@github.com>2024-04-16 10:33:54 +0100
commit61717c1aa1f08eb57839a21fb2d9004739022e0d (patch)
tree42065dc0f28c1b5e7b0c2d0470c5759261764a81 /llvm/lib/IR/Verifier.cpp
parent76782e28869abf93716f72f195d55c28eaf263ed (diff)
downloadllvm-61717c1aa1f08eb57839a21fb2d9004739022e0d.zip
llvm-61717c1aa1f08eb57839a21fb2d9004739022e0d.tar.gz
llvm-61717c1aa1f08eb57839a21fb2d9004739022e0d.tar.bz2
[Verifier] Reject va_start in non-variadic function (#88809)
A va_start intrinsic lowers to something derived from the variadic parameter to the function. If there is no such parameter, it can't lower meaningfully. Clang sema rejects the same with `error: 'va_start' used in function with fixed args`. Moves the existing lint warning into a verifier error. Updates the one lit test that had a va_start in a non-variadic function.
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 516d4a0..4cd61e6 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -5798,6 +5798,11 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
break;
}
+ case Intrinsic::vastart: {
+ Check(Call.getFunction()->isVarArg(),
+ "va_start called in a non-varargs function");
+ break;
+ }
case Intrinsic::vector_reduce_and:
case Intrinsic::vector_reduce_or:
case Intrinsic::vector_reduce_xor: