@@ -594,7 +594,11 @@ function_inlinable(llvm::Function &F,
594
594
if (F.materialize ())
595
595
elog (FATAL, " failed to materialize metadata" );
596
596
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))
598
602
{
599
603
ilog (DEBUG1, " ineligibile to import %s due to noinline" ,
600
604
F.getName ().data ());
@@ -871,7 +875,9 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
871
875
llvm::Function *AF;
872
876
llvm::BasicBlock *BB;
873
877
llvm::CallInst *fwdcall;
878
+ #if LLVM_VERSION_MAJOR < 14
874
879
llvm::Attribute inlineAttribute;
880
+ #endif
875
881
876
882
AF = llvm::Function::Create (F->getFunctionType (),
877
883
LinkageTypes::AvailableExternallyLinkage,
@@ -880,9 +886,13 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
880
886
881
887
Builder.SetInsertPoint (BB);
882
888
fwdcall = Builder.CreateCall (F, &*AF->arg_begin ());
889
+ #if LLVM_VERSION_MAJOR < 14
883
890
inlineAttribute = llvm::Attribute::get (Context,
884
891
llvm::Attribute::AlwaysInline);
885
892
fwdcall->addAttribute (~0U , inlineAttribute);
893
+ #else
894
+ fwdcall->addFnAttr (llvm::Attribute::AlwaysInline);
895
+ #endif
886
896
Builder.CreateRet (fwdcall);
887
897
888
898
return AF;
0 commit comments