Re: Add missing JIT inline pass for llvm>=17
Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
To: Andreas Karlsson <andreas@proxel.se>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2026-01-15T09:40:37Z
Lists: pgsql-hackers
Attachments
- always_inline.s (application/octet-stream)
- v2-0002-Remove-always-inline-pass-for-LLVM-17.patch (application/octet-stream) patch v2-0002
- v2-0001-Add-missing-JIT-inline-pass-for-llvm-17.patch (application/octet-stream) patch v2-0001
On Thu, Jan 15, 2026 at 4:20 AM Andreas Karlsson <andreas@proxel.se> wrote: > If inline-always does not do anything it should be removed on older LLVM > versions too. I do not think we should be having pre- and post-LLVM 17 > run different passes. But as Thomas pointed out inline-always is likely > used for tuple deforming. Right, I've missed the l_callsite_alwaysinline for varsize_any. Testing with the following query to trigger a call to varsize_any: create table test_always_inline(id integer, data text); select data, id FROM test_always_inline; The generated bc were identical (attached with the message), with and without always-inline with varsize_any not being inlined. I think this is the same issue as with external functions. varsize_any is defined in postgres/access/common/heaptuple.bc, and the function needs to be imported for LLVM to be able to inline it. Without going through llvm_inline and importing the functions, there's no inlining doable. Maybe the issue is that always-inline functions should be inlined, even with the non-optimized case (at least, that's what the configured passes seem to imply)? But that would require calling llvm_inline, which kind of defeats the purpose of having a dedicated PGJIT_INLINE flag and threshold. I've updated the patch with the simplified PGJIT_INLINE check and the commit message change. I've added a separate patch to remove the always-inline pass pre-LLVM 17 if we want to go that way.
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