Re: Add missing JIT inline pass for llvm>=17
Thomas Munro <thomas.munro@gmail.com>
From: Thomas Munro <thomas.munro@gmail.com>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-01-15T02:33:13Z
Lists: pgsql-hackers
On Wed, Jan 14, 2026 at 9:02 PM Anthonin Bonnefoy
<anthonin.bonnefoy@datadoghq.com> wrote:
> The attached patch adds the inline pass when jit inlining is triggered
> without optimisation, as was done with LLVM<17.
Oof, right. Commit message should mention that this was an oversight
in 76200e5e. I think we should back-patch this.
if (context->base.flags & PGJIT_OPT3)
passes = "default<O3>";
+ else if (context->base.flags & PGJIT_INLINE
+ && !(context->base.flags & PGJIT_OPT3))
+ /* if doing inlining, but no expensive optimization, add inline pass */
+ passes = "default<O0>,mem2reg,inline";
else
passes = "default<O0>,mem2reg";
That expression after && is redundant with the "else".
> I didn't add the always-inline pass as I don't think this can have any
> effect. From what I understand, the functions need to be imported
> through llvm_inline for LLVM to be able to inline them. I've tested by
> tagging int4mod as always inline, and the generated bc was still
> calling the function despite the always-inline pass.
What about llvmjit_deform.c's use of l_callsite_alwaysinline()?
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
jit: Add missing inline pass for LLVM >= 17.
- f1c6b153cabd 18.2 landed
- d0bb0e5b364f 17.8 landed
- 7600dc79c231 16.12 landed
- cbdd09ae1b57 15.16 landed
- de8081c30e5a 14.21 landed
- e5d99b4d9ef4 19 (unreleased) landed