Skip to content

Commit 27b57f8

Browse files
committed
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. 7255943). Author: Andres Freund Discussion: https://postgr.es/m/20201207212142.wz5tnbk2jsaqzogb@alap3.anarazel.de Backpatch: 11-, where jit support was added
1 parent b07490b commit 27b57f8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/backend/jit/llvm/llvmjit_expr.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ llvm_compile_expr(ExprState *state)
151151

152152
param_types[0] = l_ptr(StructExprState); /* state */
153153
param_types[1] = l_ptr(StructExprContext); /* econtext */
154-
param_types[2] = l_ptr(TypeParamBool); /* isnull */
154+
param_types[2] = l_ptr(TypeStorageBool); /* isnull */
155155

156156
eval_sig = LLVMFunctionType(TypeSizeT,
157157
param_types, lengthof(param_types),
@@ -258,8 +258,6 @@ llvm_compile_expr(ExprState *state)
258258

259259
v_tmpvalue = LLVMBuildLoad(b, v_tmpvaluep, "");
260260
v_tmpisnull = LLVMBuildLoad(b, v_tmpisnullp, "");
261-
v_tmpisnull =
262-
LLVMBuildTrunc(b, v_tmpisnull, TypeParamBool, "");
263261

264262
LLVMBuildStore(b, v_tmpisnull, v_isnullp);
265263

0 commit comments

Comments
 (0)