Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e6a7600

Browse files
committed
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
1 parent e94c1a5 commit e6a7600

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/backend/jit/llvm/llvmjit_inline.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,11 @@ function_inlinable(llvm::Function &F,
594594
if (F.materialize())
595595
elog(FATAL, "failed to materialize metadata");
596596

597-
if (F.getAttributes().hasFnAttribute(llvm::Attribute::NoInline))
597+
#if LLVM_VERSION_MAJOR < 14
598+
#define hasFnAttr hasFnAttribute
599+
#endif
600+
601+
if (F.getAttributes().hasFnAttr(llvm::Attribute::NoInline))
598602
{
599603
ilog(DEBUG1, "ineligibile to import %s due to noinline",
600604
F.getName().data());
@@ -871,7 +875,9 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
871875
llvm::Function *AF;
872876
llvm::BasicBlock *BB;
873877
llvm::CallInst *fwdcall;
878+
#if LLVM_VERSION_MAJOR < 14
874879
llvm::Attribute inlineAttribute;
880+
#endif
875881

876882
AF = llvm::Function::Create(F->getFunctionType(),
877883
LinkageTypes::AvailableExternallyLinkage,
@@ -880,9 +886,13 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
880886

881887
Builder.SetInsertPoint(BB);
882888
fwdcall = Builder.CreateCall(F, &*AF->arg_begin());
889+
#if LLVM_VERSION_MAJOR < 14
883890
inlineAttribute = llvm::Attribute::get(Context,
884891
llvm::Attribute::AlwaysInline);
885892
fwdcall->addAttribute(~0U, inlineAttribute);
893+
#else
894+
fwdcall->addFnAttr(llvm::Attribute::AlwaysInline);
895+
#endif
886896
Builder.CreateRet(fwdcall);
887897

888898
return AF;

0 commit comments

Comments
 (0)