mirror of
https://github.com/postgres/postgres.git
synced 2025-08-19 23:22:23 +03:00
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 <andres@anarazel.de> Co-authored-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Andreas Karlsson <andreas@proxel.se> Discussion: https://postgr.es/m/415721CE-7D2E-4B74-B5D9-1950083BA03E@yesql.se Discussion: https://postgr.es/m/20191023163849.sosqbfs5yenocez3@alap3.anarazel.de
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user