diff options
author | Thomas Munro <tmunro@postgresql.org> | 2022-03-16 11:35:00 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2022-03-16 11:42:00 +1300 |
commit | d9f7ad54e552262ee0090e88d5abd3e04fcdeac8 (patch) | |
tree | 68117781efa7edda7790d670ee3ffd443d635af1 /src/backend/jit/llvm/llvmjit_inline.cpp | |
parent | 8dcd1c3564f04bc1f71020c150b31deea07b7a95 (diff) | |
download | postgresql-d9f7ad54e552262ee0090e88d5abd3e04fcdeac8.tar.gz postgresql-d9f7ad54e552262ee0090e88d5abd3e04fcdeac8.zip |
Back-patch LLVM 14 API changes.
Since LLVM 14 has stopped changing and is about to be released,
back-patch the following changes from the master branch:
e6a7600202105919bffd62b3dfd941f4a94e082b
807fee1a39de6bb8184082012e643951abb9ad1d
a56e7b66010f330782243de9e25ac2a6596be0e1
Back-patch to 11, where LLVM JIT support came in.
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; |