pgsql: jit: Add missing inline pass for LLVM >= 17.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: jit: Add missing inline pass for LLVM >= 17.
Date: 2026-01-22 03:29:13
Message-ID: E1vilNg-001uz3-2C@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

jit: Add missing inline pass for LLVM >= 17.

With LLVM >= 17, transform passes are provided as a string to
LLVMRunPasses. Only two strings were used: "default<O3>" and
"default<O0>,mem2reg".

With previous LLVM versions, an additional inline pass was added when
JIT inlining was enabled without optimization. With LLVM >= 17, the code
would go through llvm_inline, prepare the functions for inlining, but
the generated bitcode would be the same due to the missing inline pass.

This patch restores the previous behavior by adding an inline pass when
inlining is enabled but no optimization is done.

This fixes an oversight introduced by 76200e5e when support for LLVM 17
was added.

Backpatch-through: 14
Author: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
Reviewed-by: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Reviewed-by: Andreas Karlsson <andreas(at)proxel(dot)se>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Reviewed-by: Pierre Ducroquet <p(dot)psql(at)pinaraf(dot)info>
Reviewed-by: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAO6_XqrNjJnbn15ctPv7o4yEAT9fWa-dK15RSyun6QNw9YDtKg%40mail.gmail.com

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d0bb0e5b364f157e93a00658c370527ae91e985e

Modified Files
--------------
src/backend/jit/llvm/llvmjit.c | 4 ++++
1 file changed, 4 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Thomas Munro 2026-01-22 03:29:27 pgsql: jit: Add missing inline pass for LLVM >= 17.
Previous Message Thomas Munro 2026-01-22 03:28:55 pgsql: jit: Add missing inline pass for LLVM >= 17.