Re: pgsql: jit: Support opaque pointers in LLVM 16.

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Thomas Munro <tmunro(at)postgresql(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: jit: Support opaque pointers in LLVM 16.
Date: 2023-11-06 18:11:54
Message-ID: 202311061811.m5heranea4gj@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On 2023-Oct-18, Thomas Munro wrote:

> jit: Support opaque pointers in LLVM 16.
>
> Remove use of LLVMGetElementType() and provide the type of all pointers
> to LLVMBuildXXX() functions when emitting IR, as required by modern LLVM
> versions[1].
>
> * For LLVM <= 14, we'll still use the old LLVMBuildXXX() functions.

I have LLVM 14 (whatever Debian ships[*]), and running headerscheck results
in a bunch of warnings from this:

In file included from /tmp/headerscheck.s89Gdv/test.c:2:
/pgsql/source/master/src/include/jit/llvmjit_emit.h: In function ‘l_call’:
/pgsql/source/master/src/include/jit/llvmjit_emit.h:141:9: warning: ‘LLVMBuildCall’ is deprecated [-Wdeprecated-declarations]
141 | return LLVMBuildCall(b, fn, args, nargs, name);
| ^~~~~~
In file included from /usr/include/llvm-c/Core.h:18,
from /pgsql/source/master/src/include/jit/llvmjit_emit.h:18:
/usr/include/llvm-c/Core.h:3991:1: note: declared here
3991 | LLVM_ATTRIBUTE_C_DEPRECATED(
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~

These warnings go away if I change the conditional from
LLVM_VERSION_MAJOR < 16 to 14.

Let's ... do that? As in the attached patch.

In 13, there's a comment about it being deprecated, but no macro to make
the compiler whine:
https://github.com/hdoc/llvm-project/blob/release/13.x/llvm/include/llvm-c/Core.h#L3953

This changed in 14:
https://github.com/hdoc/llvm-project/blob/release/14.x/llvm/include/llvm-c/Core.h#L3898

[*] apt policy llvm:
llvm:
Installed: 1:14.0-55.7~deb12u1
Candidate: 1:14.0-55.7~deb12u1
Version table:
*** 1:14.0-55.7~deb12u1 500
500 http://ftp.de.debian.org/debian bookworm/main amd64 Packages
100 /var/lib/dpkg/status

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

Attachment Content-Type Size
0001-use-non-deprecated-LLVM-functions-starting-with-its-.patch text/x-diff 2.0 KB

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-11-06 18:26:52 pgsql: Last-minute updates for release notes.
Previous Message Tom Lane 2023-11-06 15:57:54 pgsql: Detect integer overflow while computing new array dimensions.

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2023-11-06 18:54:49 Re: Add bump memory context type and use it for tuplesorts
Previous Message Stephen Frost 2023-11-06 18:02:50 Re: Add the ability to limit the amount of memory that can be allocated to backends.