about summary refs log tree commit diff homepage
path: root/lib/Module/FunctionAlias.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Module/FunctionAlias.cpp')
-rw-r--r--lib/Module/FunctionAlias.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Module/FunctionAlias.cpp b/lib/Module/FunctionAlias.cpp
index aa80b35d..c00bde58 100644
--- a/lib/Module/FunctionAlias.cpp
+++ b/lib/Module/FunctionAlias.cpp
@@ -134,10 +134,16 @@ bool FunctionAliasPass::runOnModule(Module &M) {
 }
 
 const FunctionType *FunctionAliasPass::getFunctionType(const GlobalValue *gv) {
+#if LLVM_VERSION_CODE >= LLVM_VERSION(15, 0)
+  if (auto *ft = dyn_cast<FunctionType>(gv->getType()))
+    return ft;
+  return dyn_cast<FunctionType>(gv->getValueType());
+#else
   const Type *type = gv->getType();
   while (type->isPointerTy())
     type = type->getPointerElementType();
-  return cast<FunctionType>(type);
+  return dyn_cast<FunctionType>(type);
+#endif
 }
 
 bool FunctionAliasPass::checkType(const GlobalValue *match,