Hi PostgreSQL 18 will ship after these vacuum horizon systems reach EOL[1]:
animal | arch | llvm_version | os | os_release | end_of_support ---------------+---------+--------------+--------+------------+---------------- branta | s390x | 10.0.0 | Ubuntu | 20.04 | 2025-04-01 splitfin | aarch64 | 10.0.0 | Ubuntu | 20.04 | 2025-04-01 urutau | s390x | 10.0.0 | Ubuntu | 20.04 | 2025-04-01 massasauga | aarch64 | 11.1.0 | Amazon | 2 | 2025-06-30 snakefly | aarch64 | 11.1.0 | Amazon | 2 | 2025-06-30 Therefore, some time after the tree re-opens for hacking, we could rip out a bunch of support code for LLVM 10-13, and then rip out support for pre-opaque-pointer mode. Please see attached. [1] https://www.postgresql.org/message-id/CA%2BhUKG%2B-g61yq7Ce4aoZtBDO98b4GXH8Cu3zxVk-Zn1Vh7TKpA%40mail.gmail.com
From f5de5c6535b825033b1829eaf340baacc10ed654 Mon Sep 17 00:00:00 2001 From: Thomas Munro <thomas.mu...@gmail.com> Date: Thu, 19 Oct 2023 04:45:46 +1300 Subject: [PATCH 1/2] jit: Require at least LLVM 14, if enabled. Remove support for LLVM versions 10-13. The default on all non-EOL'd OSes represented in our build farm will be at least LLVM 14 when PostgreSQL 18 ships. Discussion: https://postgr.es/m/CA%2BhUKGLhNs5geZaVNj2EJ79Dx9W8fyWUU3HxcpZy55sMGcY%3DiA%40mail.gmail.com --- config/llvm.m4 | 8 +- configure | 8 +- doc/src/sgml/installation.sgml | 4 +- meson.build | 2 +- src/backend/jit/llvm/llvmjit.c | 109 ------------------------ src/backend/jit/llvm/llvmjit_error.cpp | 25 ------ src/backend/jit/llvm/llvmjit_inline.cpp | 13 --- src/backend/jit/llvm/llvmjit_wrap.cpp | 4 - 8 files changed, 11 insertions(+), 162 deletions(-) diff --git a/config/llvm.m4 b/config/llvm.m4 index 44769d819a0..6ca088b5a45 100644 --- a/config/llvm.m4 +++ b/config/llvm.m4 @@ -13,7 +13,7 @@ AC_DEFUN([PGAC_LLVM_SUPPORT], AC_REQUIRE([AC_PROG_AWK]) AC_ARG_VAR(LLVM_CONFIG, [path to llvm-config command]) - PGAC_PATH_PROGS(LLVM_CONFIG, llvm-config llvm-config-17 llvm-config-16 llvm-config-15 llvm-config-14 llvm-config-13 llvm-config-12 llvm-config-11 llvm-config-10) + PGAC_PATH_PROGS(LLVM_CONFIG, llvm-config llvm-config-18 llvm-config-17 llvm-config-16 llvm-config-15 llvm-config-14) # no point continuing if llvm wasn't found if test -z "$LLVM_CONFIG"; then @@ -25,14 +25,14 @@ AC_DEFUN([PGAC_LLVM_SUPPORT], AC_MSG_ERROR([$LLVM_CONFIG does not work]) fi # and whether the version is supported - if echo $pgac_llvm_version | $AWK -F '.' '{ if ([$]1 >= 10) exit 1; else exit 0;}';then - AC_MSG_ERROR([$LLVM_CONFIG version is $pgac_llvm_version but at least 10 is required]) + if echo $pgac_llvm_version | $AWK -F '.' '{ if ([$]1 >= 14) exit 1; else exit 0;}';then + AC_MSG_ERROR([$LLVM_CONFIG version is $pgac_llvm_version but at least 14 is required]) fi AC_MSG_NOTICE([using llvm $pgac_llvm_version]) # need clang to create some bitcode files AC_ARG_VAR(CLANG, [path to clang compiler to generate bitcode]) - PGAC_PATH_PROGS(CLANG, clang clang-17 clang-16 clang-15 clang-14 clang-13 clang-12 clang-11 clang-10) + PGAC_PATH_PROGS(CLANG, clang clang-18 clang-17 clang-16 clang-15 clang-14) if test -z "$CLANG"; then AC_MSG_ERROR([clang not found, but required when compiling --with-llvm, specify with CLANG=]) fi diff --git a/configure b/configure index cfbd2a096f4..ba4ce5a5282 100755 --- a/configure +++ b/configure @@ -5065,7 +5065,7 @@ if test "$with_llvm" = yes; then : if test -z "$LLVM_CONFIG"; then - for ac_prog in llvm-config llvm-config-17 llvm-config-16 llvm-config-15 llvm-config-14 llvm-config-13 llvm-config-12 llvm-config-11 llvm-config-10 + for ac_prog in llvm-config llvm-config-18 llvm-config-17 llvm-config-16 llvm-config-15 llvm-config-14 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -5129,8 +5129,8 @@ fi as_fn_error $? "$LLVM_CONFIG does not work" "$LINENO" 5 fi # and whether the version is supported - if echo $pgac_llvm_version | $AWK -F '.' '{ if ($1 >= 10) exit 1; else exit 0;}';then - as_fn_error $? "$LLVM_CONFIG version is $pgac_llvm_version but at least 10 is required" "$LINENO" 5 + if echo $pgac_llvm_version | $AWK -F '.' '{ if ($1 >= 14) exit 1; else exit 0;}';then + as_fn_error $? "$LLVM_CONFIG version is $pgac_llvm_version but at least 14 is required" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: using llvm $pgac_llvm_version" >&5 $as_echo "$as_me: using llvm $pgac_llvm_version" >&6;} @@ -5138,7 +5138,7 @@ $as_echo "$as_me: using llvm $pgac_llvm_version" >&6;} # need clang to create some bitcode files if test -z "$CLANG"; then - for ac_prog in clang clang-17 clang-16 clang-15 clang-14 clang-13 clang-12 clang-11 clang-10 + for ac_prog in clang clang-18 clang-17 clang-16 clang-15 clang-14 do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml index a453f804cd6..826cb5e4935 100644 --- a/doc/src/sgml/installation.sgml +++ b/doc/src/sgml/installation.sgml @@ -936,7 +936,7 @@ build-postgresql: <acronym>JIT</acronym> compilation (see <xref linkend="jit"/>). This requires the <productname>LLVM</productname> library to be installed. The minimum required version of <productname>LLVM</productname> is - currently 10. + currently 14. </para> <para> <command>llvm-config</command><indexterm><primary>llvm-config</primary></indexterm> @@ -2424,7 +2424,7 @@ ninja install <acronym>JIT</acronym> compilation (see <xref linkend="jit"/>). This requires the <productname>LLVM</productname> library to be installed. The minimum required version of - <productname>LLVM</productname> is currently 10. Disabled by + <productname>LLVM</productname> is currently 14. Disabled by default. </para> diff --git a/meson.build b/meson.build index 5acf083ce3c..9b79e42e711 100644 --- a/meson.build +++ b/meson.build @@ -748,7 +748,7 @@ endif llvmopt = get_option('llvm') llvm = not_found_dep if add_languages('cpp', required: llvmopt, native: false) - llvm = dependency('llvm', version: '>=10', method: 'config-tool', required: llvmopt) + llvm = dependency('llvm', version: '>=14', method: 'config-tool', required: llvmopt) if llvm.found() diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 92b4993a98a..8f9c77eedc1 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -21,13 +21,9 @@ #if LLVM_VERSION_MAJOR > 16 #include <llvm-c/Transforms/PassBuilder.h> #endif -#if LLVM_VERSION_MAJOR > 11 #include <llvm-c/Orc.h> #include <llvm-c/OrcEE.h> #include <llvm-c/LLJIT.h> -#else -#include <llvm-c/OrcBindings.h> -#endif #include <llvm-c/Support.h> #include <llvm-c/Target.h> #if LLVM_VERSION_MAJOR < 17 @@ -50,13 +46,8 @@ /* Handle of a module emitted via ORC JIT */ typedef struct LLVMJitHandle { -#if LLVM_VERSION_MAJOR > 11 LLVMOrcLLJITRef lljit; LLVMOrcResourceTrackerRef resource_tracker; -#else - LLVMOrcJITStackRef stack; - LLVMOrcModuleHandle orc_handle; -#endif } LLVMJitHandle; @@ -103,14 +94,9 @@ static LLVMContextRef llvm_context; static LLVMTargetRef llvm_targetref; -#if LLVM_VERSION_MAJOR > 11 static LLVMOrcThreadSafeContextRef llvm_ts_context; static LLVMOrcLLJITRef llvm_opt0_orc; static LLVMOrcLLJITRef llvm_opt3_orc; -#else /* LLVM_VERSION_MAJOR > 11 */ -static LLVMOrcJITStackRef llvm_opt0_orc; -static LLVMOrcJITStackRef llvm_opt3_orc; -#endif /* LLVM_VERSION_MAJOR > 11 */ static void llvm_release_context(JitContext *context); @@ -124,10 +110,8 @@ static void llvm_set_target(void); static void llvm_recreate_llvm_context(void); static uint64_t llvm_resolve_symbol(const char *name, void *ctx); -#if LLVM_VERSION_MAJOR > 11 static LLVMOrcLLJITRef llvm_create_jit_instance(LLVMTargetMachineRef tm); static char *llvm_error_message(LLVMErrorRef error); -#endif /* LLVM_VERSION_MAJOR > 11 */ /* ResourceOwner callbacks to hold JitContexts */ static void ResOwnerReleaseJitContext(Datum res); @@ -292,7 +276,6 @@ llvm_release_context(JitContext *context) { LLVMJitHandle *jit_handle = (LLVMJitHandle *) lfirst(lc); -#if LLVM_VERSION_MAJOR > 11 { LLVMOrcExecutionSessionRef ee; LLVMOrcSymbolStringPoolRef sp; @@ -310,11 +293,6 @@ llvm_release_context(JitContext *context) sp = LLVMOrcExecutionSessionGetSymbolStringPool(ee); LLVMOrcSymbolStringPoolClearDeadEntries(sp); } -#else /* LLVM_VERSION_MAJOR > 11 */ - { - LLVMOrcRemoveModule(jit_handle->stack, jit_handle->orc_handle); - } -#endif /* LLVM_VERSION_MAJOR > 11 */ pfree(jit_handle); } @@ -397,7 +375,6 @@ llvm_get_function(LLVMJitContext *context, const char *funcname) * to mangle here. */ -#if LLVM_VERSION_MAJOR > 11 foreach(lc, context->handles) { LLVMJitHandle *handle = (LLVMJitHandle *) lfirst(lc); @@ -427,19 +404,6 @@ llvm_get_function(LLVMJitContext *context, const char *funcname) if (addr) return (void *) (uintptr_t) addr; } -#else - foreach(lc, context->handles) - { - LLVMOrcTargetAddress addr; - LLVMJitHandle *handle = (LLVMJitHandle *) lfirst(lc); - - addr = 0; - if (LLVMOrcGetSymbolAddressIn(handle->stack, &addr, handle->orc_handle, funcname)) - elog(ERROR, "failed to look up symbol \"%s\"", funcname); - if (addr) - return (void *) (uintptr_t) addr; - } -#endif elog(ERROR, "failed to JIT: %s", funcname); @@ -735,11 +699,7 @@ llvm_compile_module(LLVMJitContext *context) MemoryContext oldcontext; instr_time starttime; instr_time endtime; -#if LLVM_VERSION_MAJOR > 11 LLVMOrcLLJITRef compile_orc; -#else - LLVMOrcJITStackRef compile_orc; -#endif if (context->base.flags & PGJIT_OPT3) compile_orc = llvm_opt3_orc; @@ -796,7 +756,6 @@ llvm_compile_module(LLVMJitContext *context) * faster instruction selection mechanism is used. */ INSTR_TIME_SET_CURRENT(starttime); -#if LLVM_VERSION_MAJOR > 11 { LLVMOrcThreadSafeModuleRef ts_module; LLVMErrorRef error; @@ -824,16 +783,6 @@ llvm_compile_module(LLVMJitContext *context) /* LLVMOrcLLJITAddLLVMIRModuleWithRT takes ownership of the module */ } -#else - { - handle->stack = compile_orc; - if (LLVMOrcAddEagerlyCompiledIR(compile_orc, &handle->orc_handle, context->module, - llvm_resolve_symbol, NULL)) - elog(ERROR, "failed to JIT module"); - - /* LLVMOrcAddEagerlyCompiledIR takes ownership of the module */ - } -#endif INSTR_TIME_SET_CURRENT(endtime); INSTR_TIME_ACCUM_DIFF(context->base.instr.emission_counter, @@ -945,7 +894,6 @@ llvm_session_initialize(void) /* force symbols in main binary to be loaded */ LLVMLoadLibraryPermanently(NULL); -#if LLVM_VERSION_MAJOR > 11 { llvm_ts_context = LLVMOrcCreateNewThreadSafeContext(); @@ -955,31 +903,6 @@ llvm_session_initialize(void) llvm_opt3_orc = llvm_create_jit_instance(opt3_tm); opt3_tm = 0; } -#else /* LLVM_VERSION_MAJOR > 11 */ - { - llvm_opt0_orc = LLVMOrcCreateInstance(opt0_tm); - llvm_opt3_orc = LLVMOrcCreateInstance(opt3_tm); - -#if defined(HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER) && HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER - if (jit_debugging_support) - { - LLVMJITEventListenerRef l = LLVMCreateGDBRegistrationListener(); - - LLVMOrcRegisterJITEventListener(llvm_opt0_orc, l); - LLVMOrcRegisterJITEventListener(llvm_opt3_orc, l); - } -#endif -#if defined(HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER) && HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER - if (jit_profiling_support) - { - LLVMJITEventListenerRef l = LLVMCreatePerfJITEventListener(); - - LLVMOrcRegisterJITEventListener(llvm_opt0_orc, l); - LLVMOrcRegisterJITEventListener(llvm_opt3_orc, l); - } -#endif - } -#endif /* LLVM_VERSION_MAJOR > 11 */ on_proc_exit(llvm_shutdown, 0); @@ -1009,7 +932,6 @@ llvm_shutdown(int code, Datum arg) elog(PANIC, "LLVMJitContext in use count not 0 at exit (is %zu)", llvm_jit_context_in_use_count); -#if LLVM_VERSION_MAJOR > 11 { if (llvm_opt3_orc) { @@ -1027,31 +949,6 @@ llvm_shutdown(int code, Datum arg) llvm_ts_context = NULL; } } -#else /* LLVM_VERSION_MAJOR > 11 */ - { - /* unregister profiling support, needs to be flushed to be useful */ - - if (llvm_opt3_orc) - { -#if defined(HAVE_DECL_LLVMORCREGISTERPERF) && HAVE_DECL_LLVMORCREGISTERPERF - if (jit_profiling_support) - LLVMOrcUnregisterPerf(llvm_opt3_orc); -#endif - LLVMOrcDisposeInstance(llvm_opt3_orc); - llvm_opt3_orc = NULL; - } - - if (llvm_opt0_orc) - { -#if defined(HAVE_DECL_LLVMORCREGISTERPERF) && HAVE_DECL_LLVMORCREGISTERPERF - if (jit_profiling_support) - LLVMOrcUnregisterPerf(llvm_opt0_orc); -#endif - LLVMOrcDisposeInstance(llvm_opt0_orc); - llvm_opt0_orc = NULL; - } - } -#endif /* LLVM_VERSION_MAJOR > 11 */ } /* helper for llvm_create_types, returning a function's return type */ @@ -1221,8 +1118,6 @@ llvm_resolve_symbol(const char *symname, void *ctx) return (uint64_t) addr; } -#if LLVM_VERSION_MAJOR > 11 - static LLVMErrorRef llvm_resolve_symbols(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx, LLVMOrcLookupStateRef *LookupState, LLVMOrcLookupKind Kind, @@ -1241,9 +1136,7 @@ llvm_resolve_symbols(LLVMOrcDefinitionGeneratorRef GeneratorObj, void *Ctx, { const char *name = LLVMOrcSymbolStringPoolEntryStr(LookupSet[i].Name); -#if LLVM_VERSION_MAJOR > 12 LLVMOrcRetainSymbolStringPoolEntry(LookupSet[i].Name); -#endif symbols[i].Name = LookupSet[i].Name; symbols[i].Sym.Address = llvm_resolve_symbol(name, NULL); symbols[i].Sym.Flags.GenericFlags = LLVMJITSymbolGenericFlagsExported; @@ -1372,8 +1265,6 @@ llvm_error_message(LLVMErrorRef error) return msg; } -#endif /* LLVM_VERSION_MAJOR > 11 */ - /* * ResourceOwner callbacks */ diff --git a/src/backend/jit/llvm/llvmjit_error.cpp b/src/backend/jit/llvm/llvmjit_error.cpp index ebe2f1baa10..351354c30bc 100644 --- a/src/backend/jit/llvm/llvmjit_error.cpp +++ b/src/backend/jit/llvm/llvmjit_error.cpp @@ -30,13 +30,7 @@ static std::new_handler old_new_handler = NULL; static void fatal_system_new_handler(void); static void fatal_llvm_new_handler(void *user_data, const char *reason, bool gen_crash_diag); -#if LLVM_VERSION_MAJOR < 14 -static void fatal_llvm_new_handler(void *user_data, const std::string& reason, bool gen_crash_diag); -#endif static void fatal_llvm_error_handler(void *user_data, const char *reason, bool gen_crash_diag); -#if LLVM_VERSION_MAJOR < 14 -static void fatal_llvm_error_handler(void *user_data, const std::string& reason, bool gen_crash_diag); -#endif /* @@ -135,15 +129,6 @@ fatal_llvm_new_handler(void *user_data, errmsg("out of memory"), errdetail("While in LLVM: %s", reason))); } -#if LLVM_VERSION_MAJOR < 14 -static void -fatal_llvm_new_handler(void *user_data, - const std::string& reason, - bool gen_crash_diag) -{ - fatal_llvm_new_handler(user_data, reason.c_str(), gen_crash_diag); -} -#endif static void fatal_llvm_error_handler(void *user_data, @@ -154,13 +139,3 @@ fatal_llvm_error_handler(void *user_data, (errcode(ERRCODE_OUT_OF_MEMORY), errmsg("fatal llvm error: %s", reason))); } - -#if LLVM_VERSION_MAJOR < 14 -static void -fatal_llvm_error_handler(void *user_data, - const std::string& reason, - bool gen_crash_diag) -{ - fatal_llvm_error_handler(user_data, reason.c_str(), gen_crash_diag); -} -#endif diff --git a/src/backend/jit/llvm/llvmjit_inline.cpp b/src/backend/jit/llvm/llvmjit_inline.cpp index 2007eb523c9..23a8053311d 100644 --- a/src/backend/jit/llvm/llvmjit_inline.cpp +++ b/src/backend/jit/llvm/llvmjit_inline.cpp @@ -594,10 +594,6 @@ function_inlinable(llvm::Function &F, if (F.materialize()) elog(FATAL, "failed to materialize metadata"); -#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", @@ -858,9 +854,6 @@ 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, @@ -869,13 +862,7 @@ 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; diff --git a/src/backend/jit/llvm/llvmjit_wrap.cpp b/src/backend/jit/llvm/llvmjit_wrap.cpp index 641c8841ca3..7f7623dac64 100644 --- a/src/backend/jit/llvm/llvmjit_wrap.cpp +++ b/src/backend/jit/llvm/llvmjit_wrap.cpp @@ -17,10 +17,6 @@ extern "C" } #include <llvm-c/Core.h> - -/* Avoid macro clash with LLVM's C++ headers */ -#undef Min - #include <llvm/IR/Function.h> #include "jit/llvmjit.h" -- 2.44.0
From f9227428dd9f0141138d225540c2454636f6a874 Mon Sep 17 00:00:00 2001 From: Thomas Munro <thomas.mu...@gmail.com> Date: Fri, 20 Oct 2023 15:13:26 +1300 Subject: [PATCH 2/2] jit: Use opaque pointers in all supported LLVM versions. LLVM's opaque pointer change began in LLVM 14, but remained optional until LLVM 16. When commit 37d5babb added opaque pointer support, we didn't turn it on for LLVM 14 and 15 yet because we didn't want to risk weird bitcode incompatibility problems in released branches of PostgreSQL. (That might have been overly cautious, I don't know.) Now that PostgreSQL 18 has dropped support for LLVM versions < 14, and since it hasn't been released yet and no extensions or bitcode have been built against it in the wild yet, we can be more aggressive. We can rip out the support code and build system clutter that made opaque pointer use optional. Discussions: https://postgr.es/m/CA%2BhUKGLhNs5geZaVNj2EJ79Dx9W8fyWUU3HxcpZy55sMGcY%3DiA%40mail.gmail.com --- configure | 89 -------------------------------- configure.ac | 3 -- src/backend/jit/llvm/llvmjit.c | 13 ----- src/backend/jit/llvm/meson.build | 3 -- src/include/jit/llvmjit_emit.h | 16 ------ 5 files changed, 124 deletions(-) diff --git a/configure b/configure index ba4ce5a5282..cb4d14f68c3 100755 --- a/configure +++ b/configure @@ -7290,95 +7290,6 @@ if test x"$pgac_cv_prog_CLANGXX_cxxflags__fexcess_precision_standard" = x"yes"; fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Xclang -no-opaque-pointers, for BITCODE_CFLAGS" >&5 -$as_echo_n "checking whether ${CLANG} supports -Xclang -no-opaque-pointers, for BITCODE_CFLAGS... " >&6; } -if ${pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers+:} false; then : - $as_echo_n "(cached) " >&6 -else - pgac_save_CFLAGS=$CFLAGS -pgac_save_CC=$CC -CC=${CLANG} -CFLAGS="${BITCODE_CFLAGS} -Xclang -no-opaque-pointers" -ac_save_c_werror_flag=$ac_c_werror_flag -ac_c_werror_flag=yes -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers=yes -else - pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_c_werror_flag=$ac_save_c_werror_flag -CFLAGS="$pgac_save_CFLAGS" -CC="$pgac_save_CC" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers" >&5 -$as_echo "$pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers" >&6; } -if test x"$pgac_cv_prog_CLANG_cflags__Xclang__no_opaque_pointers" = x"yes"; then - BITCODE_CFLAGS="${BITCODE_CFLAGS} -Xclang -no-opaque-pointers" -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANGXX} supports -Xclang -no-opaque-pointers, for BITCODE_CXXFLAGS" >&5 -$as_echo_n "checking whether ${CLANGXX} supports -Xclang -no-opaque-pointers, for BITCODE_CXXFLAGS... " >&6; } -if ${pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers+:} false; then : - $as_echo_n "(cached) " >&6 -else - pgac_save_CXXFLAGS=$CXXFLAGS -pgac_save_CXX=$CXX -CXX=${CLANGXX} -CXXFLAGS="${BITCODE_CXXFLAGS} -Xclang -no-opaque-pointers" -ac_save_cxx_werror_flag=$ac_cxx_werror_flag -ac_cxx_werror_flag=yes -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers=yes -else - pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_cxx_werror_flag=$ac_save_cxx_werror_flag -CXXFLAGS="$pgac_save_CXXFLAGS" -CXX="$pgac_save_CXX" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers" >&5 -$as_echo "$pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers" >&6; } -if test x"$pgac_cv_prog_CLANGXX_cxxflags__Xclang__no_opaque_pointers" = x"yes"; then - BITCODE_CXXFLAGS="${BITCODE_CXXFLAGS} -Xclang -no-opaque-pointers" -fi - - NOT_THE_CFLAGS="" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS" >&5 $as_echo_n "checking whether ${CLANG} supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... " >&6; } diff --git a/configure.ac b/configure.ac index 67e738d92b1..b82ec09c8f5 100644 --- a/configure.ac +++ b/configure.ac @@ -634,9 +634,6 @@ if test "$with_llvm" = yes ; then PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, BITCODE_CFLAGS, [-fexcess-precision=standard]) PGAC_PROG_VARCXX_VARFLAGS_OPT(CLANGXX, BITCODE_CXXFLAGS, [-fexcess-precision=standard]) - PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, BITCODE_CFLAGS, [-Xclang -no-opaque-pointers]) - PGAC_PROG_VARCXX_VARFLAGS_OPT(CLANGXX, BITCODE_CXXFLAGS, [-Xclang -no-opaque-pointers]) - NOT_THE_CFLAGS="" PGAC_PROG_VARCC_VARFLAGS_OPT(CLANG, NOT_THE_CFLAGS, [-Wunused-command-line-argument]) if test -n "$NOT_THE_CFLAGS"; then diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 8f9c77eedc1..9960a0239c8 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -835,19 +835,6 @@ llvm_session_initialize(void) llvm_llvm_context_reuse_count = 0; } - /* - * When targeting LLVM 15, turn off opaque pointers for the context we - * build our code in. We don't need to do so for other contexts (e.g. - * llvm_ts_context). Once the IR is generated, it carries the necessary - * information. - * - * For 16 and above, opaque pointers must be used, and we have special - * code for that. - */ -#if LLVM_VERSION_MAJOR == 15 - LLVMContextSetOpaquePointers(LLVMGetGlobalContext(), false); -#endif - /* * Synchronize types early, as that also includes inferring the target * triple. diff --git a/src/backend/jit/llvm/meson.build b/src/backend/jit/llvm/meson.build index 41c759f73c5..88b4a212bd1 100644 --- a/src/backend/jit/llvm/meson.build +++ b/src/backend/jit/llvm/meson.build @@ -60,9 +60,6 @@ endif # XXX: Need to determine proper version of the function cflags for clang bitcode_cflags = ['-fno-strict-aliasing', '-fwrapv'] -if llvm.version().version_compare('=15.0') - bitcode_cflags += ['-Xclang', '-no-opaque-pointers'] -endif bitcode_cflags += cppflags # XXX: Worth improving on the logic to find directories here diff --git a/src/include/jit/llvmjit_emit.h b/src/include/jit/llvmjit_emit.h index 4f35f3dca13..0a04c85d9b9 100644 --- a/src/include/jit/llvmjit_emit.h +++ b/src/include/jit/llvmjit_emit.h @@ -107,41 +107,25 @@ l_pbool_const(bool i) static inline LLVMValueRef l_struct_gep(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, int32 idx, const char *name) { -#if LLVM_VERSION_MAJOR < 16 - return LLVMBuildStructGEP(b, v, idx, ""); -#else return LLVMBuildStructGEP2(b, t, v, idx, ""); -#endif } static inline LLVMValueRef l_gep(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, LLVMValueRef *indices, int32 nindices, const char *name) { -#if LLVM_VERSION_MAJOR < 16 - return LLVMBuildGEP(b, v, indices, nindices, name); -#else return LLVMBuildGEP2(b, t, v, indices, nindices, name); -#endif } static inline LLVMValueRef l_load(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef v, const char *name) { -#if LLVM_VERSION_MAJOR < 16 - return LLVMBuildLoad(b, v, name); -#else return LLVMBuildLoad2(b, t, v, name); -#endif } static inline LLVMValueRef l_call(LLVMBuilderRef b, LLVMTypeRef t, LLVMValueRef fn, LLVMValueRef *args, int32 nargs, const char *name) { -#if LLVM_VERSION_MAJOR < 16 - return LLVMBuildCall(b, fn, args, nargs, name); -#else return LLVMBuildCall2(b, t, fn, args, nargs, name); -#endif } /* -- 2.44.0