Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit972c2cd

Browse files
committed
jit: Require at least LLVM 14, if enabled.
Remove support for LLVM versions 10-13. The default on all non-EOL'dOSes represented in our build farm will be at least LLVM 14 whenPostgreSQL 18 ships.Author: Thomas Munro <thomas.munro@gmail.com>Reviewed-by: Peter Eisentraut <peter@eisentraut.org>Discussion:https://postgr.es/m/CA%2BhUKGLhNs5geZaVNj2EJ79Dx9W8fyWUU3HxcpZy55sMGcY%3DiA%40mail.gmail.com
1 parent1b4d52c commit972c2cd

File tree

8 files changed

+7
-150
lines changed

8 files changed

+7
-150
lines changed

‎config/llvm.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ AC_DEFUN([PGAC_LLVM_SUPPORT],
2525
AC_MSG_ERROR([$LLVM_CONFIG does not work])
2626
fi
2727
# and whether the version is supported
28-
if echo $pgac_llvm_version | $AWK -F '.' '{ if ([$]1 >=10) exit 1; else exit 0;}';then
29-
AC_MSG_ERROR([$LLVM_CONFIG version is $pgac_llvm_version but at least10 is required])
28+
if echo $pgac_llvm_version | $AWK -F '.' '{ if ([$]1 >=14) exit 1; else exit 0;}';then
29+
AC_MSG_ERROR([$LLVM_CONFIG version is $pgac_llvm_version but at least14 is required])
3030
fi
3131
AC_MSG_NOTICE([using llvm $pgac_llvm_version])
3232

‎configure

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5072,8 +5072,8 @@ fi
50725072
as_fn_error $? "$LLVM_CONFIG does not work" "$LINENO" 5
50735073
fi
50745074
# and whether the version is supported
5075-
if echo $pgac_llvm_version | $AWK -F '.' '{ if ($1 >=10) exit 1; else exit 0;}';then
5076-
as_fn_error $? "$LLVM_CONFIG version is $pgac_llvm_version but at least10 is required" "$LINENO" 5
5075+
if echo $pgac_llvm_version | $AWK -F '.' '{ if ($1 >=14) exit 1; else exit 0;}';then
5076+
as_fn_error $? "$LLVM_CONFIG version is $pgac_llvm_version but at least14 is required" "$LINENO" 5
50775077
fi
50785078
{ $as_echo "$as_me:${as_lineno-$LINENO}: using llvm $pgac_llvm_version" >&5
50795079
$as_echo "$as_me: using llvm $pgac_llvm_version" >&6;}

‎doc/src/sgml/installation.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ build-postgresql:
936936
<acronym>JIT</acronym> compilation (see <xref linkend="jit"/>). This
937937
requires the <productname>LLVM</productname> library to be installed.
938938
The minimum required version of <productname>LLVM</productname> is
939-
currently10.
939+
currently14.
940940
</para>
941941
<para>
942942
<command>llvm-config</command><indexterm><primary>llvm-config</primary></indexterm>
@@ -2394,7 +2394,7 @@ ninja install
23942394
<acronym>JIT</acronym> compilation (see <xref linkend="jit"/>).
23952395
This requires the <productname>LLVM</productname> library to be
23962396
installed. The minimum required version of
2397-
<productname>LLVM</productname> is currently10. Disabled by
2397+
<productname>LLVM</productname> is currently14. Disabled by
23982398
default.
23992399
</para>
24002400

‎meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ endif
792792
llvmopt=get_option('llvm')
793793
llvm= not_found_dep
794794
ifadd_languages('cpp',required: llvmopt,native:false)
795-
llvm=dependency('llvm',version:'>=10',method:'config-tool',required: llvmopt)
795+
llvm=dependency('llvm',version:'>=14',method:'config-tool',required: llvmopt)
796796

797797
if llvm.found()
798798

‎src/backend/jit/llvm/llvmjit.c

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@
2121
#ifLLVM_VERSION_MAJOR>16
2222
#include<llvm-c/Transforms/PassBuilder.h>
2323
#endif
24-
#ifLLVM_VERSION_MAJOR>11
2524
#include<llvm-c/Orc.h>
2625
#include<llvm-c/OrcEE.h>
2726
#include<llvm-c/LLJIT.h>
28-
#else
29-
#include<llvm-c/OrcBindings.h>
30-
#endif
3127
#include<llvm-c/Support.h>
3228
#include<llvm-c/Target.h>
3329
#ifLLVM_VERSION_MAJOR<17
@@ -50,13 +46,8 @@
5046
/* Handle of a module emitted via ORC JIT */
5147
typedefstructLLVMJitHandle
5248
{
53-
#ifLLVM_VERSION_MAJOR>11
5449
LLVMOrcLLJITReflljit;
5550
LLVMOrcResourceTrackerRefresource_tracker;
56-
#else
57-
LLVMOrcJITStackRefstack;
58-
LLVMOrcModuleHandleorc_handle;
59-
#endif
6051
}LLVMJitHandle;
6152

6253

@@ -103,14 +94,9 @@ static LLVMContextRef llvm_context;
10394

10495

10596
staticLLVMTargetRefllvm_targetref;
106-
#ifLLVM_VERSION_MAJOR>11
10797
staticLLVMOrcThreadSafeContextRefllvm_ts_context;
10898
staticLLVMOrcLLJITRefllvm_opt0_orc;
10999
staticLLVMOrcLLJITRefllvm_opt3_orc;
110-
#else/* LLVM_VERSION_MAJOR > 11 */
111-
staticLLVMOrcJITStackRefllvm_opt0_orc;
112-
staticLLVMOrcJITStackRefllvm_opt3_orc;
113-
#endif/* LLVM_VERSION_MAJOR > 11 */
114100

115101

116102
staticvoidllvm_release_context(JitContext*context);
@@ -124,10 +110,8 @@ static void llvm_set_target(void);
124110
staticvoidllvm_recreate_llvm_context(void);
125111
staticuint64_tllvm_resolve_symbol(constchar*name,void*ctx);
126112

127-
#ifLLVM_VERSION_MAJOR>11
128113
staticLLVMOrcLLJITRefllvm_create_jit_instance(LLVMTargetMachineReftm);
129114
staticchar*llvm_error_message(LLVMErrorReferror);
130-
#endif/* LLVM_VERSION_MAJOR > 11 */
131115

132116
/* ResourceOwner callbacks to hold JitContexts */
133117
staticvoidResOwnerReleaseJitContext(Datumres);
@@ -292,7 +276,6 @@ llvm_release_context(JitContext *context)
292276
{
293277
LLVMJitHandle*jit_handle= (LLVMJitHandle*)lfirst(lc);
294278

295-
#ifLLVM_VERSION_MAJOR>11
296279
{
297280
LLVMOrcExecutionSessionRefee;
298281
LLVMOrcSymbolStringPoolRefsp;
@@ -310,11 +293,6 @@ llvm_release_context(JitContext *context)
310293
sp=LLVMOrcExecutionSessionGetSymbolStringPool(ee);
311294
LLVMOrcSymbolStringPoolClearDeadEntries(sp);
312295
}
313-
#else/* LLVM_VERSION_MAJOR > 11 */
314-
{
315-
LLVMOrcRemoveModule(jit_handle->stack,jit_handle->orc_handle);
316-
}
317-
#endif/* LLVM_VERSION_MAJOR > 11 */
318296

319297
pfree(jit_handle);
320298
}
@@ -397,7 +375,6 @@ llvm_get_function(LLVMJitContext *context, const char *funcname)
397375
* to mangle here.
398376
*/
399377

400-
#ifLLVM_VERSION_MAJOR>11
401378
foreach(lc,context->handles)
402379
{
403380
LLVMJitHandle*handle= (LLVMJitHandle*)lfirst(lc);
@@ -427,19 +404,6 @@ llvm_get_function(LLVMJitContext *context, const char *funcname)
427404
if (addr)
428405
return (void*) (uintptr_t)addr;
429406
}
430-
#else
431-
foreach(lc,context->handles)
432-
{
433-
LLVMOrcTargetAddressaddr;
434-
LLVMJitHandle*handle= (LLVMJitHandle*)lfirst(lc);
435-
436-
addr=0;
437-
if (LLVMOrcGetSymbolAddressIn(handle->stack,&addr,handle->orc_handle,funcname))
438-
elog(ERROR,"failed to look up symbol \"%s\"",funcname);
439-
if (addr)
440-
return (void*) (uintptr_t)addr;
441-
}
442-
#endif
443407

444408
elog(ERROR,"failed to JIT: %s",funcname);
445409

@@ -740,11 +704,7 @@ llvm_compile_module(LLVMJitContext *context)
740704
MemoryContextoldcontext;
741705
instr_timestarttime;
742706
instr_timeendtime;
743-
#ifLLVM_VERSION_MAJOR>11
744707
LLVMOrcLLJITRefcompile_orc;
745-
#else
746-
LLVMOrcJITStackRefcompile_orc;
747-
#endif
748708

749709
if (context->base.flags&PGJIT_OPT3)
750710
compile_orc=llvm_opt3_orc;
@@ -801,7 +761,6 @@ llvm_compile_module(LLVMJitContext *context)
801761
* faster instruction selection mechanism is used.
802762
*/
803763
INSTR_TIME_SET_CURRENT(starttime);
804-
#ifLLVM_VERSION_MAJOR>11
805764
{
806765
LLVMOrcThreadSafeModuleRefts_module;
807766
LLVMErrorReferror;
@@ -829,16 +788,6 @@ llvm_compile_module(LLVMJitContext *context)
829788

830789
/* LLVMOrcLLJITAddLLVMIRModuleWithRT takes ownership of the module */
831790
}
832-
#else
833-
{
834-
handle->stack=compile_orc;
835-
if (LLVMOrcAddEagerlyCompiledIR(compile_orc,&handle->orc_handle,context->module,
836-
llvm_resolve_symbol,NULL))
837-
elog(ERROR,"failed to JIT module");
838-
839-
/* LLVMOrcAddEagerlyCompiledIR takes ownership of the module */
840-
}
841-
#endif
842791

843792
INSTR_TIME_SET_CURRENT(endtime);
844793
INSTR_TIME_ACCUM_DIFF(context->base.instr.emission_counter,
@@ -950,7 +899,6 @@ llvm_session_initialize(void)
950899
/* force symbols in main binary to be loaded */
951900
LLVMLoadLibraryPermanently(NULL);
952901

953-
#ifLLVM_VERSION_MAJOR>11
954902
{
955903
llvm_ts_context=LLVMOrcCreateNewThreadSafeContext();
956904

@@ -960,31 +908,6 @@ llvm_session_initialize(void)
960908
llvm_opt3_orc=llvm_create_jit_instance(opt3_tm);
961909
opt3_tm=0;
962910
}
963-
#else/* LLVM_VERSION_MAJOR > 11 */
964-
{
965-
llvm_opt0_orc=LLVMOrcCreateInstance(opt0_tm);
966-
llvm_opt3_orc=LLVMOrcCreateInstance(opt3_tm);
967-
968-
#if defined(HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER)&&HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER
969-
if (jit_debugging_support)
970-
{
971-
LLVMJITEventListenerRefl=LLVMCreateGDBRegistrationListener();
972-
973-
LLVMOrcRegisterJITEventListener(llvm_opt0_orc,l);
974-
LLVMOrcRegisterJITEventListener(llvm_opt3_orc,l);
975-
}
976-
#endif
977-
#if defined(HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER)&&HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER
978-
if (jit_profiling_support)
979-
{
980-
LLVMJITEventListenerRefl=LLVMCreatePerfJITEventListener();
981-
982-
LLVMOrcRegisterJITEventListener(llvm_opt0_orc,l);
983-
LLVMOrcRegisterJITEventListener(llvm_opt3_orc,l);
984-
}
985-
#endif
986-
}
987-
#endif/* LLVM_VERSION_MAJOR > 11 */
988911

989912
on_proc_exit(llvm_shutdown,0);
990913

@@ -1014,7 +937,6 @@ llvm_shutdown(int code, Datum arg)
1014937
elog(PANIC,"LLVMJitContext in use count not 0 at exit (is %zu)",
1015938
llvm_jit_context_in_use_count);
1016939

1017-
#ifLLVM_VERSION_MAJOR>11
1018940
{
1019941
if (llvm_opt3_orc)
1020942
{
@@ -1032,23 +954,6 @@ llvm_shutdown(int code, Datum arg)
1032954
llvm_ts_context=NULL;
1033955
}
1034956
}
1035-
#else/* LLVM_VERSION_MAJOR > 11 */
1036-
{
1037-
/* unregister profiling support, needs to be flushed to be useful */
1038-
1039-
if (llvm_opt3_orc)
1040-
{
1041-
LLVMOrcDisposeInstance(llvm_opt3_orc);
1042-
llvm_opt3_orc=NULL;
1043-
}
1044-
1045-
if (llvm_opt0_orc)
1046-
{
1047-
LLVMOrcDisposeInstance(llvm_opt0_orc);
1048-
llvm_opt0_orc=NULL;
1049-
}
1050-
}
1051-
#endif/* LLVM_VERSION_MAJOR > 11 */
1052957
}
1053958

1054959
/* helper for llvm_create_types, returning a function's return type */
@@ -1218,8 +1123,6 @@ llvm_resolve_symbol(const char *symname, void *ctx)
12181123
return (uint64_t)addr;
12191124
}
12201125

1221-
#ifLLVM_VERSION_MAJOR>11
1222-
12231126
staticLLVMErrorRef
12241127
llvm_resolve_symbols(LLVMOrcDefinitionGeneratorRefGeneratorObj,void*Ctx,
12251128
LLVMOrcLookupStateRef*LookupState,LLVMOrcLookupKindKind,
@@ -1238,9 +1141,7 @@ llvm_resolve_symbols(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx,
12381141
{
12391142
constchar*name=LLVMOrcSymbolStringPoolEntryStr(LookupSet[i].Name);
12401143

1241-
#ifLLVM_VERSION_MAJOR>12
12421144
LLVMOrcRetainSymbolStringPoolEntry(LookupSet[i].Name);
1243-
#endif
12441145
symbols[i].Name=LookupSet[i].Name;
12451146
symbols[i].Sym.Address=llvm_resolve_symbol(name,NULL);
12461147
symbols[i].Sym.Flags.GenericFlags=LLVMJITSymbolGenericFlagsExported;
@@ -1369,8 +1270,6 @@ llvm_error_message(LLVMErrorRef error)
13691270
returnmsg;
13701271
}
13711272

1372-
#endif/* LLVM_VERSION_MAJOR > 11 */
1373-
13741273
/*
13751274
* ResourceOwner callbacks
13761275
*/

‎src/backend/jit/llvm/llvmjit_error.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@ static std::new_handler old_new_handler = NULL;
3030

3131
staticvoidfatal_system_new_handler(void);
3232
staticvoidfatal_llvm_new_handler(void *user_data,constchar *reason,bool gen_crash_diag);
33-
#if LLVM_VERSION_MAJOR < 14
34-
staticvoidfatal_llvm_new_handler(void *user_data,const std::string& reason,bool gen_crash_diag);
35-
#endif
3633
staticvoidfatal_llvm_error_handler(void *user_data,constchar *reason,bool gen_crash_diag);
37-
#if LLVM_VERSION_MAJOR < 14
38-
staticvoidfatal_llvm_error_handler(void *user_data,const std::string& reason,bool gen_crash_diag);
39-
#endif
4034

4135

4236
/*
@@ -135,15 +129,6 @@ fatal_llvm_new_handler(void *user_data,
135129
errmsg("out of memory"),
136130
errdetail("While in LLVM: %s", reason)));
137131
}
138-
#if LLVM_VERSION_MAJOR < 14
139-
staticvoid
140-
fatal_llvm_new_handler(void *user_data,
141-
const std::string& reason,
142-
bool gen_crash_diag)
143-
{
144-
fatal_llvm_new_handler(user_data, reason.c_str(), gen_crash_diag);
145-
}
146-
#endif
147132

148133
staticvoid
149134
fatal_llvm_error_handler(void *user_data,
@@ -154,13 +139,3 @@ fatal_llvm_error_handler(void *user_data,
154139
(errcode(ERRCODE_OUT_OF_MEMORY),
155140
errmsg("fatal llvm error: %s", reason)));
156141
}
157-
158-
#if LLVM_VERSION_MAJOR < 14
159-
staticvoid
160-
fatal_llvm_error_handler(void *user_data,
161-
const std::string& reason,
162-
bool gen_crash_diag)
163-
{
164-
fatal_llvm_error_handler(user_data, reason.c_str(), gen_crash_diag);
165-
}
166-
#endif

‎src/backend/jit/llvm/llvmjit_inline.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,6 @@ function_inlinable(llvm::Function &F,
594594
if (F.materialize())
595595
elog(FATAL,"failed to materialize metadata");
596596

597-
#if LLVM_VERSION_MAJOR < 14
598-
#definehasFnAttr hasFnAttribute
599-
#endif
600-
601597
if (F.getAttributes().hasFnAttr(llvm::Attribute::NoInline))
602598
{
603599
ilog(DEBUG1,"ineligibile to import %s due to noinline",
@@ -858,9 +854,6 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
858854
llvm::Function *AF;
859855
llvm::BasicBlock *BB;
860856
llvm::CallInst *fwdcall;
861-
#if LLVM_VERSION_MAJOR < 14
862-
llvm::Attribute inlineAttribute;
863-
#endif
864857

865858
AF =llvm::Function::Create(F->getFunctionType(),
866859
LinkageTypes::AvailableExternallyLinkage,
@@ -869,13 +862,7 @@ create_redirection_function(std::unique_ptr<llvm::Module> &importMod,
869862

870863
Builder.SetInsertPoint(BB);
871864
fwdcall = Builder.CreateCall(F, &*AF->arg_begin());
872-
#if LLVM_VERSION_MAJOR < 14
873-
inlineAttribute =llvm::Attribute::get(Context,
874-
llvm::Attribute::AlwaysInline);
875-
fwdcall->addAttribute(~0U, inlineAttribute);
876-
#else
877865
fwdcall->addFnAttr(llvm::Attribute::AlwaysInline);
878-
#endif
879866
Builder.CreateRet(fwdcall);
880867

881868
return AF;

‎src/backend/jit/llvm/llvmjit_wrap.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ extern "C"
1717
}
1818

1919
#include<llvm-c/Core.h>
20-
21-
/* Avoid macro clash with LLVM's C++ headers*/
22-
#undef Min
23-
2420
#include<llvm/IR/Function.h>
2521

2622
#include"jit/llvmjit.h"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp