summaryrefslogtreecommitdiff
path: root/src/backend/jit
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2020-12-07 18:21:06 -0800
committerAndres Freund <andres@anarazel.de>2020-12-07 19:34:13 -0800
commit5da871bfa1ba41768ecd7786293d9b81dcf1b667 (patch)
treec83ab6ddd2723d62d62dd29808dab8f0b6fc6b0f /src/backend/jit
parent9543f0861b1d9b566be88edae21f24fb1377f45c (diff)
downloadpostgresql-5da871bfa1ba41768ecd7786293d9b81dcf1b667.tar.gz
jit: Correct parameter type for generated expression evaluation functions.
clang only uses the 'i1' type for scalar booleans, not for pointers to booleans (as the pointer might be pointing into a larger memory allocation). Therefore a pointer-to-bool needs to the "storage" boolean. There's no known case of wrong code generation due to this, but it seems quite possible that it could cause problems (see e.g. 72559438f92). Author: Andres Freund Discussion: https://postgr.es/m/20201207212142.wz5tnbk2jsaqzogb@alap3.anarazel.de Backpatch: 11-, where jit support was added
Diffstat (limited to 'src/backend/jit')
-rw-r--r--src/backend/jit/llvm/llvmjit_expr.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/backend/jit/llvm/llvmjit_expr.c b/src/backend/jit/llvm/llvmjit_expr.c
index f232397cab..da5e3a2c1d 100644
--- a/src/backend/jit/llvm/llvmjit_expr.c
+++ b/src/backend/jit/llvm/llvmjit_expr.c
@@ -155,7 +155,7 @@ llvm_compile_expr(ExprState *state)
param_types[0] = l_ptr(StructExprState); /* state */
param_types[1] = l_ptr(StructExprContext); /* econtext */
- param_types[2] = l_ptr(TypeParamBool); /* isnull */
+ param_types[2] = l_ptr(TypeStorageBool); /* isnull */
eval_sig = LLVMFunctionType(TypeSizeT,
param_types, lengthof(param_types),
@@ -265,8 +265,6 @@ llvm_compile_expr(ExprState *state)
v_tmpvalue = LLVMBuildLoad(b, v_tmpvaluep, "");
v_tmpisnull = LLVMBuildLoad(b, v_tmpisnullp, "");
- v_tmpisnull =
- LLVMBuildTrunc(b, v_tmpisnull, TypeParamBool, "");
LLVMBuildStore(b, v_tmpisnull, v_isnullp);