[llvm] 1ff06c5 - [verifier] Get rid of getResolverFunctionType. NFC (#102631)

Bjorn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 04:29:32 PDT 2024


Author: Bjorn Pettersson
Date: 2024-08-12T13:28:42+02:00
New Revision: 1ff06c54b70dd4c1971bf07a5d3a5467c16cca65

URL: https://github.com/llvm/llvm-project/commit/1ff06c54b70dd4c1971bf07a5d3a5467c16cca65
DIFF: https://github.com/llvm/llvm-project/commit/1ff06c54b70dd4c1971bf07a5d3a5467c16cca65.diff

LOG: [verifier] Get rid of getResolverFunctionType. NFC (#102631)

With opaque pointers we can just get the pointer type for the
resolver function by using PointerType::get, making the
GlobalIFunc::getResolverFunctionType function obsolete.

Added: 
    

Modified: 
    llvm/include/llvm/IR/GlobalIFunc.h
    llvm/lib/IR/Verifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/GlobalIFunc.h b/llvm/include/llvm/IR/GlobalIFunc.h
index 4d1982da0baff..8935284f32d75 100644
--- a/llvm/include/llvm/IR/GlobalIFunc.h
+++ b/llvm/include/llvm/IR/GlobalIFunc.h
@@ -80,10 +80,6 @@ class GlobalIFunc final : public GlobalObject, public ilist_node<GlobalIFunc> {
         static_cast<const GlobalIFunc *>(this)->getResolverFunction());
   }
 
-  static FunctionType *getResolverFunctionType(Type *IFuncValTy) {
-    return FunctionType::get(IFuncValTy->getPointerTo(), false);
-  }
-
   static bool isValidLinkage(LinkageTypes L) {
     return isExternalLinkage(L) || isLocalLinkage(L) || isWeakLinkage(L) ||
            isLinkOnceLinkage(L);

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 402af376651eb..7d71ce3230b20 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -1006,9 +1006,7 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   Check(isa<PointerType>(Resolver->getFunctionType()->getReturnType()),
         "IFunc resolver must return a pointer", &GI);
 
-  const Type *ResolverFuncTy =
-      GlobalIFunc::getResolverFunctionType(GI.getValueType());
-  Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
+  Check(ResolverTy == PointerType::get(Context, GI.getAddressSpace()),
         "IFunc resolver has incorrect type", &GI);
 }
 


        


More information about the llvm-commits mailing list