aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2025-07-14 09:17:33 +0200
committerGitHub <noreply@github.com>2025-07-14 08:17:33 +0100
commitcad62df49a79df5e5136cfad280c5abc9f62c60b (patch)
tree8a91ae0d8643eea20e3f6c2a9db6273414766d89 /llvm/lib/IR/Verifier.cpp
parent040e7ad8281dcb52507070fbeec59421af78c5ca (diff)
downloadllvm-cad62df49a79df5e5136cfad280c5abc9f62c60b.zip
llvm-cad62df49a79df5e5136cfad280c5abc9f62c60b.tar.gz
llvm-cad62df49a79df5e5136cfad280c5abc9f62c60b.tar.bz2
[Loads] Support dereferenceable assumption with variable size. (#128436)
Update isDereferenceableAndAlignedPointer to make use of dereferenceable assumptions with variable sizes via SCEV. To do so, factor out the logic to check via an assumption to a helper, and use SE to check if the access size is less than the dereferenceable size. PR: https://github.com/llvm/llvm-project/pull/128436
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index eb747bc..8004077 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -5604,6 +5604,15 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
"third argument should be an integer if present", Call);
continue;
}
+ if (Kind == Attribute::Dereferenceable) {
+ Check(ArgCount == 2,
+ "dereferenceable assumptions should have 2 arguments", Call);
+ Check(Call.getOperand(Elem.Begin)->getType()->isPointerTy(),
+ "first argument should be a pointer", Call);
+ Check(Call.getOperand(Elem.Begin + 1)->getType()->isIntegerTy(),
+ "second argument should be an integer", Call);
+ continue;
+ }
Check(ArgCount <= 2, "too many arguments", Call);
if (Kind == Attribute::None)
break;