Skip to content

Commit 8c27694

Browse files
committed
jit: Reference functions by name in IOCOERCE steps.
Previously we used constant function pointer addresses, which prevents inlining and other related optimizations. Author: Andres Freund Discussion: https://postgr.es/m/20191023163849.sosqbfs5yenocez3@alap3.anarazel.de
1 parent 1fdb7f9 commit 8c27694

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backend/jit/llvm/llvmjit_expr.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,10 +1261,10 @@ llvm_compile_expr(ExprState *state)
12611261
{
12621262
FunctionCallInfo fcinfo_out,
12631263
fcinfo_in;
1264+
LLVMValueRef v_fn_out,
1265+
v_fn_in;
12641266
LLVMValueRef v_fcinfo_out,
12651267
v_fcinfo_in;
1266-
LLVMValueRef v_fn_addr_out,
1267-
v_fn_addr_in;
12681268
LLVMValueRef v_fcinfo_in_isnullp;
12691269
LLVMValueRef v_retval;
12701270
LLVMValueRef v_resvalue;
@@ -1290,10 +1290,10 @@ llvm_compile_expr(ExprState *state)
12901290
b_inputcall = l_bb_before_v(opblocks[opno + 1],
12911291
"op.%d.inputcall", opno);
12921292

1293+
v_fn_out = llvm_function_reference(context, b, mod, fcinfo_out);
1294+
v_fn_in = llvm_function_reference(context, b, mod, fcinfo_in);
12931295
v_fcinfo_out = l_ptr_const(fcinfo_out, l_ptr(StructFunctionCallInfoData));
12941296
v_fcinfo_in = l_ptr_const(fcinfo_in, l_ptr(StructFunctionCallInfoData));
1295-
v_fn_addr_out = l_ptr_const(fcinfo_out->flinfo->fn_addr, TypePGFunction);
1296-
v_fn_addr_in = l_ptr_const(fcinfo_in->flinfo->fn_addr, TypePGFunction);
12971297

12981298
v_fcinfo_in_isnullp =
12991299
LLVMBuildStructGEP(b, v_fcinfo_in,
@@ -1323,7 +1323,7 @@ llvm_compile_expr(ExprState *state)
13231323
l_sbool_const(0),
13241324
l_funcnullp(b, v_fcinfo_out, 0));
13251325
/* and call output function (can never return NULL) */
1326-
v_output = LLVMBuildCall(b, v_fn_addr_out, &v_fcinfo_out,
1326+
v_output = LLVMBuildCall(b, v_fn_out, &v_fcinfo_out,
13271327
1, "funccall_coerce_out");
13281328
LLVMBuildBr(b, b_input);
13291329

@@ -1378,7 +1378,7 @@ llvm_compile_expr(ExprState *state)
13781378
/* reset fcinfo_in->isnull */
13791379
LLVMBuildStore(b, l_sbool_const(0), v_fcinfo_in_isnullp);
13801380
/* and call function */
1381-
v_retval = LLVMBuildCall(b, v_fn_addr_in, &v_fcinfo_in, 1,
1381+
v_retval = LLVMBuildCall(b, v_fn_in, &v_fcinfo_in, 1,
13821382
"funccall_iocoerce_in");
13831383

13841384
LLVMBuildStore(b, v_retval, v_resvaluep);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy