From: Daniel Gustafsson <daniel@yesql.se>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-committers@lists.postgresql.org, Andres Freund <andres@anarazel.de>
Subject: Re: pgsql: llvmjit: Use explicit LLVMContextRef for inlining
Date: Fri, 8 Dec 2023 14:38:23 +0100
Message-ID: <82CD6B67-1B7C-4D4B-9533-A94A2E4BC15B@yesql.se> (raw)
In-Reply-To: <3EF0CBF1-6460-4977-A62B-A9B58641175B@yesql.se>
References: <E1r3wSk-005s3g-JI@gemulon.postgresql.org>
<1106876.1700409912@sss.pgh.pa.us>
<3469A042-A3EB-4483-831D-0D8815D4EF41@yesql.se>
<3EF0CBF1-6460-4977-A62B-A9B58641175B@yesql.se>
> On 20 Nov 2023, at 22:53, Daniel Gustafsson <daniel@yesql.se> wrote:
>
>> On 19 Nov 2023, at 21:08, Daniel Gustafsson <daniel@yesql.se> wrote:
>
>> I'll have a look with fresh eyes in the morning, and hopefully it will be
>> fixable. If it get's messy it's quite possible that skipping v12 is the best
>> option.
>
> As an update, discussing with Andres off-list I have a potential patch for
> this, need to rebuild LLVM debug builds tomorrow to test further but there
> should be either a fix or a revert soon.
After some more work with Andres, the bug was found to be a void pointer not
created in the referenced context. The attached diff fixes the issue (which is
related to code refactored in v13 hence why it only affects v12). I will apply
that to v12 shortly after a little more testing.
--
Daniel Gustafsson
Attachments:llvmcontext_v12_fix.diff (application/octet-stream, 900B) downloaddiff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.cindex c25960a82b..f2cf2fadaa 100644--- a/src/backend/jit/llvm/llvmjit_expr.c+++ b/src/backend/jit/llvm/llvmjit_expr.c@@ -2620,7 +2620,9 @@ build_EvalXFunc(LLVMBuilderRef b, LLVMModuleRef mod, const char *funcname,
LLVMValueRef v_fn;
LLVMTypeRef param_types[3];
LLVMValueRef params[3];
+ LLVMContextRef lc;+ lc = LLVMGetModuleContext(mod);
v_fn = LLVMGetNamedFunction(mod, funcname);
if (!v_fn)
{
@@ -2628,7 +2630,7 @@ build_EvalXFunc(LLVMBuilderRef b, LLVMModuleRef mod, const char *funcname,
param_types[1] = l_ptr(StructExprEvalStep);
param_types[2] = l_ptr(StructExprContext);
- sig = LLVMFunctionType(LLVMVoidType(),+ sig = LLVMFunctionType(LLVMVoidTypeInContext(lc),
param_types, lengthof(param_types),
false);
v_fn = LLVMAddFunction(mod, funcname, sig);
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: daniel@yesql.se, tgl@sss.pgh.pa.us, andres@anarazel.de
Subject: Re: pgsql: llvmjit: Use explicit LLVMContextRef for inlining
In-Reply-To: <82CD6B67-1B7C-4D4B-9533-A94A2E4BC15B@yesql.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox