postgres.git / summary / log / commit / refs

commit    8583b1f99340f4de24661dc50ab63ec6965f6759
Author:   Thomas Munro <tmunro@postgresql.org>
Date:     Mon Jul 15 04:20:09 2024 +0000
First released in: 18.0

    Run LLVM verify pass on IR in assert builds.
    
    The problem fixed by commit 53c8d6c9 would have been noticed if we'd
    been running LLVM's verify pass on generated IR.  Doing so also reveals
    a complaint about incorrect name mangling, fixed here.  Only enabled for
    LLVM 17+ because it uses the new pass manager API.
    
    Suggested-by: Dmitry Dolgov <9erthalion6@gmail.com>
    Discussion: https://postgr.es/m/CAFj8pRACpVFr7LMdVYENUkScG5FCYMZDDdSGNU-tch%2Bw98OxYg%40mail.gmail.com


src/backend/jit/llvm/llvmjit.c | 5 +++++ src/backend/jit/llvm/llvmjit_expr.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index 1d439f24554..0bafe309bb6 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -714,6 +714,11 @@ llvm_optimize_module(LLVMJitContext *context, LLVMModuleRef module) LLVMPassBuilderOptionsSetDebugLogging(options, 1); #endif + /* In assertion builds, run the LLVM verify pass. */ +#ifdef USE_ASSERT_CHECKING + LLVMPassBuilderOptionsSetVerifyEach(options, true); +#endif + LLVMPassBuilderOptionsSetInlinerThreshold(options, 512); err = LLVMRunPasses(module, passes, NULL, options); diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c index 306aea82d3b..cbd9ed7cc4b 100644 --- a/src/backend/jit/llvm/llvmjit_expr.c +++ b/src/backend/jit/llvm/llvmjit_expr.c @@ -2765,7 +2765,7 @@ create_LifetimeEnd(LLVMModuleRef mod) LLVMContextRef lc; /* variadic pointer argument */ - const char *nm = "llvm.lifetime.end.p0i8"; + const char *nm = "llvm.lifetime.end.p0"; fn = LLVMGetNamedFunction(mod, nm); if (fn) [parent: 91651347bae1]