[llvm] c03d258 - [Verifier] Use isIntrinsic() (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 15 11:30:51 PDT 2021
Author: Nikita Popov
Date: 2021-07-15T20:30:42+02:00
New Revision: c03d25860a6f57be8e839e0879973b7d4d165333
URL: https://github.com/llvm/llvm-project/commit/c03d25860a6f57be8e839e0879973b7d4d165333
DIFF: https://github.com/llvm/llvm-project/commit/c03d25860a6f57be8e839e0879973b7d4d165333.diff
LOG: [Verifier] Use isIntrinsic() (NFC)
Call Function::isIntrinsic() instead of manually checking the
function name for an "llvm." prefix.
Added:
Modified:
llvm/lib/IR/Verifier.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 71e778c8ec7c9..2c005c911b2ec 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2326,11 +2326,10 @@ void Verifier::visitFunction(const Function &F) {
Assert(verifyAttributeCount(Attrs, FT->getNumParams()),
"Attribute after last parameter!", &F);
- bool isLLVMdotName = F.getName().size() >= 5 &&
- F.getName().substr(0, 5) == "llvm.";
+ bool IsIntrinsic = F.isIntrinsic();
// Check function attributes.
- verifyFunctionAttrs(FT, Attrs, &F, isLLVMdotName);
+ verifyFunctionAttrs(FT, Attrs, &F, IsIntrinsic);
// On function declarations/definitions, we do not support the builtin
// attribute. We do not check this in VerifyFunctionAttrs since that is
@@ -2407,7 +2406,7 @@ void Verifier::visitFunction(const Function &F) {
FT->getParamType(i));
Assert(Arg.getType()->isFirstClassType(),
"Function arguments must have first-class types!", &Arg);
- if (!isLLVMdotName) {
+ if (!IsIntrinsic) {
Assert(!Arg.getType()->isMetadataTy(),
"Function takes metadata but isn't an intrinsic", &Arg, &F);
Assert(!Arg.getType()->isTokenTy(),
@@ -2423,7 +2422,7 @@ void Verifier::visitFunction(const Function &F) {
++i;
}
- if (!isLLVMdotName) {
+ if (!IsIntrinsic) {
Assert(!F.getReturnType()->isTokenTy(),
"Function returns a token but isn't an intrinsic", &F);
Assert(!F.getReturnType()->isX86_AMXTy(),
@@ -2467,7 +2466,7 @@ void Verifier::visitFunction(const Function &F) {
} else {
// Verify that this function (which has a body) is not named "llvm.*". It
// is not legal to define intrinsics.
- Assert(!isLLVMdotName, "llvm intrinsics cannot be defined!", &F);
+ Assert(!IsIntrinsic, "llvm intrinsics cannot be defined!", &F);
// Check the entry node
const BasicBlock *Entry = &F.getEntryBlock();
@@ -3066,7 +3065,7 @@ void Verifier::visitCallBase(CallBase &Call) {
"Attribute after last parameter!", Call);
bool IsIntrinsic = Call.getCalledFunction() &&
- Call.getCalledFunction()->getName().startswith("llvm.");
+ Call.getCalledFunction()->isIntrinsic();
Function *Callee =
dyn_cast<Function>(Call.getCalledOperand()->stripPointerCasts());
More information about the llvm-commits
mailing list