summaryrefslogtreecommitdiff
path: root/src/backend/jit/llvm
diff options
context:
space:
mode:
authorDaniel Gustafsson2025-03-11 11:02:42 +0000
committerDaniel Gustafsson2025-03-11 11:02:42 +0000
commitd35d32d7112bc632c6a305e9dffdec0082bbdf00 (patch)
tree0e8b4c3c6b8603977cc68e59bc372764e7b489d8 /src/backend/jit/llvm
parent8dd7c7cd0a2605d5301266a6b67a569d6a305106 (diff)
Add special case fast-paths for strict functions
Many STRICT function calls will have one or two arguments, in which case we can speed up checking for NULL input by avoiding setting up a loop over the arguments. This adds EEOP_FUNCEXPR_STRICT_1 and the corresponding EEOP_FUNCEXPR_STRICT_2 for functions with one and two arguments respectively. Author: Andres Freund <[email protected]> Co-authored-by: Daniel Gustafsson <[email protected]> Reviewed-by: Andreas Karlsson <[email protected]> Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/jit/llvm')
-rw-r--r--src/backend/jit/llvm/llvmjit_expr.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c
index 4080b01c17e..890bcb0b0a7 100644
--- a/src/backend/jit/llvm/llvmjit_expr.c
+++ b/src/backend/jit/llvm/llvmjit_expr.c
@@ -662,12 +662,16 @@ llvm_compile_expr(ExprState *state)
case EEOP_FUNCEXPR:
case EEOP_FUNCEXPR_STRICT:
+ case EEOP_FUNCEXPR_STRICT_1:
+ case EEOP_FUNCEXPR_STRICT_2:
{
FunctionCallInfo fcinfo = op->d.func.fcinfo_data;
LLVMValueRef v_fcinfo_isnull;
LLVMValueRef v_retval;
- if (opcode == EEOP_FUNCEXPR_STRICT)
+ if (opcode == EEOP_FUNCEXPR_STRICT ||
+ opcode == EEOP_FUNCEXPR_STRICT_1 ||
+ opcode == EEOP_FUNCEXPR_STRICT_2)
{
LLVMBasicBlockRef b_nonull;
LLVMBasicBlockRef *b_checkargnulls;
@@ -2482,6 +2486,7 @@ llvm_compile_expr(ExprState *state)
}
case EEOP_AGG_STRICT_INPUT_CHECK_ARGS:
+ case EEOP_AGG_STRICT_INPUT_CHECK_ARGS_1:
case EEOP_AGG_STRICT_INPUT_CHECK_NULLS:
{
int nargs = op->d.agg_strict_input_check.nargs;