Duplicated LLVMJitHandle->lljit assignment?

Started by Matheus Alcantaraover 2 years ago3 messages
#1Matheus Alcantara
mths.dev@pm.me
1 attachment(s)

Hi,

I was reading the jit implementation and I notice that the lljit field of
LLVMJitHandle is being assigned twice on llvm_compile_module function, is this
correct? I'm attaching a supposed fixes that removes the second assignment. I
ran meson test and all tests have pass.

--
Matheus Alcantara

Attachments:

0001-Remove-duplicated-LLVMJitHandle-lljit-assignment.patchtext/x-patch; name=0001-Remove-duplicated-LLVMJitHandle-lljit-assignment.patchDownload
From 2a2c773b2437b2c491576db8d7ed6b6d1ba2c815 Mon Sep 17 00:00:00 2001
From: Matheus Alcantara <mths.dev@pm.me>
Date: Wed, 12 Jul 2023 18:57:52 -0300
Subject: [PATCH] Remove duplicated LLVMJitHandle->lljit assignment

---
 src/backend/jit/llvm/llvmjit.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c
index 5c30494fa1..09650e2c70 100644
--- a/src/backend/jit/llvm/llvmjit.c
+++ b/src/backend/jit/llvm/llvmjit.c
@@ -722,8 +722,6 @@ llvm_compile_module(LLVMJitContext *context)
 			elog(ERROR, "failed to JIT module: %s",
 				 llvm_error_message(error));
 
-		handle->lljit = compile_orc;
-
 		/* LLVMOrcLLJITAddLLVMIRModuleWithRT takes ownership of the module */
 	}
 #elif LLVM_VERSION_MAJOR > 6
-- 
2.34.1

#2Gurjeet Singh
gurjeet@singh.im
In reply to: Matheus Alcantara (#1)
Re: Duplicated LLVMJitHandle->lljit assignment?

On Wed, Jul 12, 2023 at 5:22 PM Matheus Alcantara <mths.dev@pm.me> wrote:

I was reading the jit implementation and I notice that the lljit field of
LLVMJitHandle is being assigned twice on llvm_compile_module function, is this
correct? I'm attaching a supposed fixes that removes the second assignment. I
ran meson test and all tests have pass.

- handle->lljit = compile_orc;

LGTM.

Best regards,
Gurjeet
http://Gurje.et

#3Michael Paquier
michael@paquier.xyz
In reply to: Gurjeet Singh (#2)
Re: Duplicated LLVMJitHandle->lljit assignment?

On Wed, Jul 12, 2023 at 06:41:37PM -0700, Gurjeet Singh wrote:

LGTM.

Indeed. It looks like a small thinko from 6c57f2e when support for
LLVM12 was added.
--
Michael