aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index a4f6474..fa18c3cd 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2496,7 +2496,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
if (Attribute FPAttr = Attrs.getFnAttr("frame-pointer"); FPAttr.isValid()) {
StringRef FP = FPAttr.getValueAsString();
- if (FP != "all" && FP != "non-leaf" && FP != "none" && FP != "reserved")
+ if (FP != "all" && FP != "non-leaf" && FP != "none" && FP != "reserved" &&
+ FP != "non-leaf-no-reserve")
CheckFailed("invalid value for 'frame-pointer' attribute: " + FP, V);
}
@@ -2566,6 +2567,20 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
CheckFailed("invalid value for 'denormal-fp-math-f32' attribute: " + S,
V);
}
+
+ if (auto A = Attrs.getFnAttr("modular-format"); A.isValid()) {
+ StringRef S = A.getValueAsString();
+ SmallVector<StringRef> Args;
+ S.split(Args, ',');
+ Check(Args.size() >= 5,
+ "modular-format attribute requires at least 5 arguments", V);
+ unsigned FirstArgIdx;
+ Check(!Args[2].getAsInteger(10, FirstArgIdx),
+ "modular-format attribute first arg index is not an integer", V);
+ unsigned UpperBound = FT->getNumParams() + (FT->isVarArg() ? 1 : 0);
+ Check(FirstArgIdx > 0 && FirstArgIdx <= UpperBound,
+ "modular-format attribute first arg index is out of bounds", V);
+ }
}
void Verifier::verifyUnknownProfileMetadata(MDNode *MD) {
Check(MD->getNumOperands() == 2,