aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineVerifier.cpp
diff options
context:
space:
mode:
authorSerguei Katkov <serguei.katkov@azul.com>2021-01-12 16:56:04 +0700
committerSerguei Katkov <serguei.katkov@azul.com>2021-01-13 11:51:48 +0700
commitfba9805ba3491db03ad538ea2db2f225f57ff98e (patch)
tree5c8a61e9130685d772b47230e68f855f1f841bcd /llvm/lib/CodeGen/MachineVerifier.cpp
parent157efd84abf812c1689ba6a9ecb4da2b87dde756 (diff)
downloadllvm-fba9805ba3491db03ad538ea2db2f225f57ff98e.zip
llvm-fba9805ba3491db03ad538ea2db2f225f57ff98e.tar.gz
llvm-fba9805ba3491db03ad538ea2db2f225f57ff98e.tar.bz2
[Verifier] Extend statepoint verifier to cover more constants
Also old mir tests are updated to meet last changes in STATEPOINT format. Reviewers: reames, dantrushin Reviewed By: reames, dantrushin Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D94482
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineVerifier.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp
index e69688d..41fdf2f 100644
--- a/llvm/lib/CodeGen/MachineVerifier.cpp
+++ b/llvm/lib/CodeGen/MachineVerifier.cpp
@@ -1647,6 +1647,10 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
}
auto VerifyStackMapConstant = [&](unsigned Offset) {
+ if (Offset >= MI->getNumOperands()) {
+ report("stack map constant to STATEPOINT is out of range!", MI);
+ return;
+ }
if (!MI->getOperand(Offset - 1).isImm() ||
MI->getOperand(Offset - 1).getImm() != StackMaps::ConstantOp ||
!MI->getOperand(Offset).isImm())
@@ -1655,6 +1659,9 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
VerifyStackMapConstant(SO.getCCIdx());
VerifyStackMapConstant(SO.getFlagsIdx());
VerifyStackMapConstant(SO.getNumDeoptArgsIdx());
+ VerifyStackMapConstant(SO.getNumGCPtrIdx());
+ VerifyStackMapConstant(SO.getNumAllocaIdx());
+ VerifyStackMapConstant(SO.getNumGcMapEntriesIdx());
// TODO: verify we have properly encoded deopt arguments
} break;