diff options
author | Thomas Munro <tmunro@postgresql.org> | 2021-09-27 10:39:01 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2021-09-27 10:53:20 +1300 |
commit | e6a7600202105919bffd62b3dfd941f4a94e082b (patch) | |
tree | def82e5baa20eb8a62fd9a606be4dbd3056642fa /src/backend/jit/llvm/llvmjit_inline.cpp | |
parent | e94c1a55dada49772622d2be2d17a2a9973b2661 (diff) | |
download | postgresql-e6a7600202105919bffd62b3dfd941f4a94e082b.tar.gz postgresql-e6a7600202105919bffd62b3dfd941f4a94e082b.zip |
Track LLVM 14 API changes.
Only done on the master branch for now to fix build farm animal seawasp
(which tests bleeeding edge PostgreSQL with bleeding edge LLVM). We can
back-patch a consolidated fix closer to LLVM 14's release, once its API
has stopped moving around.
Discussion: https://postgr.es/m/CA%2BhUKGL%3Dyg6qqgg6W6SAuvRQejditeoDNy-X3b9H_6Fnw8j5Wg%40mail.gmail.com
Diffstat (limited to 'src/backend/jit/llvm/llvmjit_inline.cpp')
-rw-r--r-- | src/backend/jit/llvm/llvmjit_inline.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/backend/jit/llvm/llvmjit_inline.cpp b/src/backend/jit/llvm/llvmjit_inline.cpp index 6f03595db5a..9bb4b672a73 100644 --- a/src/backend/jit/llvm/llvmjit_inline.cpp +++ b/src/backend/jit/llvm/llvmjit_inline.cpp @@ -594,7 +594,11 @@ function_inlinable(llvm::Function &F, if (F.materialize()) elog(FATAL, "failed to materialize metadata"); - if (F.getAttributes().hasFnAttribute(llvm::Attribute::NoInline)) +#if LLVM_VERSION_MAJOR < 14 +#define hasFnAttr hasFnAttribute +#endif + + if (F.getAttributes().hasFnAttr(llvm::Attribute::NoInline)) { ilog(DEBUG1, "ineligibile to import %s due to noinline", F.getName().data()); @@ -871,7 +875,9 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod, llvm::Function *AF; llvm::BasicBlock *BB; llvm::CallInst *fwdcall; +#if LLVM_VERSION_MAJOR < 14 llvm::Attribute inlineAttribute; +#endif AF = llvm::Function::Create(F->getFunctionType(), LinkageTypes::AvailableExternallyLinkage, @@ -880,9 +886,13 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod, Builder.SetInsertPoint(BB); fwdcall = Builder.CreateCall(F, &*AF->arg_begin()); +#if LLVM_VERSION_MAJOR < 14 inlineAttribute = llvm::Attribute::get(Context, llvm::Attribute::AlwaysInline); fwdcall->addAttribute(~0U, inlineAttribute); +#else + fwdcall->addFnAttr(llvm::Attribute::AlwaysInline); +#endif Builder.CreateRet(fwdcall); return AF; |