From: Thomas Munro Date: Tue, 30 Dec 2025 03:39:19 +0000 (+1300) Subject: jit: Drop redundant LLVM configure probes. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a28b4b455df41725ea2115ae2a2fd9b33a20ae5;p=thirdparty%2Fpostgresql.git jit: Drop redundant LLVM configure probes. We currently require LLVM 14, so these probes for LLVM 9 functions always succeeded. Even when the features aren't enabled in an LLVM build, dummy functions are defined (a problem for a later commit). The whole PGAC_CHECK_LLVM_FUNCTIONS macro and Meson equivalent are removed, because we switched to testing LLVM_VERSION_MAJOR at compile time in subsequent work and these were the last holdouts. That suits the nature of LLVM API evolution better, and also allows for strictly mechanical pruning in future commits like 820b5af7 and 972c2cd2. They advanced the minimum LLVM version but failed to spot these. Reviewed-by: Matheus Alcantara Reviewed-by: Andres Freund Discussion: https://postgr.es/m/CA%2BhUKGJgB6gvrdDohgwLfCwzVQm%3DVMtb9m0vzQn%3DCwWn-kwG9w%40mail.gmail.com --- diff --git a/config/llvm.m4 b/config/llvm.m4 index 9d6fe8199e3..5d4f14cb900 100644 --- a/config/llvm.m4 +++ b/config/llvm.m4 @@ -101,20 +101,3 @@ dnl LLVM_CONFIG, CLANG are already output via AC_ARG_VAR AC_SUBST(LLVM_BINPATH) ])# PGAC_LLVM_SUPPORT - - -# PGAC_CHECK_LLVM_FUNCTIONS -# ------------------------- -# -# Check presence of some optional LLVM functions. -# (This shouldn't happen until we're ready to run AC_CHECK_DECLS tests; -# because PGAC_LLVM_SUPPORT runs very early, it's not an appropriate place.) -# -AC_DEFUN([PGAC_CHECK_LLVM_FUNCTIONS], -[ - # Check which functionality is present - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS" - AC_CHECK_DECLS([LLVMCreateGDBRegistrationListener, LLVMCreatePerfJITEventListener], [], [], [[#include ]]) - CPPFLAGS="$SAVE_CPPFLAGS" -])# PGAC_CHECK_LLVM_FUNCTIONS diff --git a/configure b/configure index 14ad0a5006f..f203f9d528b 100755 --- a/configure +++ b/configure @@ -16607,38 +16607,6 @@ fi CPPFLAGS=$ac_save_CPPFLAGS fi -if test "$with_llvm" = yes; then - - # Check which functionality is present - SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS $LLVM_CPPFLAGS" - ac_fn_c_check_decl "$LINENO" "LLVMCreateGDBRegistrationListener" "ac_cv_have_decl_LLVMCreateGDBRegistrationListener" "#include -" -if test "x$ac_cv_have_decl_LLVMCreateGDBRegistrationListener" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER $ac_have_decl -_ACEOF -ac_fn_c_check_decl "$LINENO" "LLVMCreatePerfJITEventListener" "ac_cv_have_decl_LLVMCreatePerfJITEventListener" "#include -" -if test "x$ac_cv_have_decl_LLVMCreatePerfJITEventListener" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER $ac_have_decl -_ACEOF - - CPPFLAGS="$SAVE_CPPFLAGS" - -fi - # Lastly, restore full LIBS list and check for readline/libedit symbols LIBS="$LIBS_including_readline" diff --git a/configure.ac b/configure.ac index 01b3bbc1be8..ec38ddefa36 100644 --- a/configure.ac +++ b/configure.ac @@ -1941,10 +1941,6 @@ if test "$with_icu" = yes; then CPPFLAGS=$ac_save_CPPFLAGS fi -if test "$with_llvm" = yes; then - PGAC_CHECK_LLVM_FUNCTIONS() -fi - # Lastly, restore full LIBS list and check for readline/libedit symbols LIBS="$LIBS_including_readline" diff --git a/meson.build b/meson.build index d7c5193d4ce..ec08cd49056 100644 --- a/meson.build +++ b/meson.build @@ -2679,14 +2679,6 @@ decl_checks += [ ['memset_s', 'string.h', '#define __STDC_WANT_LIB_EXT1__ 1'], ] -# Check presence of some optional LLVM functions. -if llvm.found() - decl_checks += [ - ['LLVMCreateGDBRegistrationListener', 'llvm-c/ExecutionEngine.h'], - ['LLVMCreatePerfJITEventListener', 'llvm-c/ExecutionEngine.h'], - ] -endif - foreach c : decl_checks func = c.get(0) header = c.get(1) diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 15c3475ede2..9b599d11380 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -1180,24 +1180,19 @@ llvm_create_object_layer(void *Ctx, LLVMOrcExecutionSessionRef ES, const char *T LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(ES); #endif - -#if defined(HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER) && HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER if (jit_debugging_support) { LLVMJITEventListenerRef l = LLVMCreateGDBRegistrationListener(); LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(objlayer, l); } -#endif -#if defined(HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER) && HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER if (jit_profiling_support) { LLVMJITEventListenerRef l = LLVMCreatePerfJITEventListener(); LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(objlayer, l); } -#endif return objlayer; } diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 92fcc5f3063..f0091b09cbe 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -83,14 +83,6 @@ don't. */ #undef HAVE_DECL_F_FULLFSYNC -/* Define to 1 if you have the declaration of - `LLVMCreateGDBRegistrationListener', and to 0 if you don't. */ -#undef HAVE_DECL_LLVMCREATEGDBREGISTRATIONLISTENER - -/* Define to 1 if you have the declaration of - `LLVMCreatePerfJITEventListener', and to 0 if you don't. */ -#undef HAVE_DECL_LLVMCREATEPERFJITEVENTLISTENER - /* Define to 1 if you have the declaration of `memset_s', and to 0 if you don't. */ #undef HAVE_DECL_MEMSET_S