Re: Add missing JIT inline pass for llvm>=17 - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Add missing JIT inline pass for llvm>=17
Date
Msg-id CA+hUKGLF1T+fgASQrVbDw2jdpt1d1ks7Lcs1rrhZMa+eXSQb6g@mail.gmail.com
Whole thread Raw
In response to Add missing JIT inline pass for llvm>=17  (Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>)
List 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()?



pgsql-hackers by date:

Previous
From: Noah Misch
Date:
Subject: Re: Updating IPC::Run in CI?
Next
From: Andreas Karlsson
Date:
Subject: Re: Add missing JIT inline pass for llvm>=17