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 <[email protected]>
Reviewed-by: Thomas Munro <[email protected]>
Reviewed-by: Andreas Karlsson <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Reviewed-by: Álvaro Herrera <[email protected]>
Reviewed-by: Pierre Ducroquet <[email protected]>
Reviewed-by: Matheus Alcantara <[email protected]>
Discussion: 
https://postgr.es/m/CAO6_XqrNjJnbn15ctPv7o4yEAT9fWa-dK15RSyun6QNw9YDtKg%40mail.gmail.com

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7600dc79c231e7fd88172dde6c3a3ba701144298

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

Reply via email to