Skip to content

Commit 1e16ad1

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 f4f924b commit 1e16ad1

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
@@ -152,7 +152,7 @@ llvm_compile_expr(ExprState *state)
152152

153153
param_types[0] = l_ptr(StructExprState); /* state */
154154
param_types[1] = l_ptr(StructExprContext); /* econtext */
155-
param_types[2] = l_ptr(TypeParamBool); /* isnull */
155+
param_types[2] = l_ptr(TypeStorageBool); /* isnull */
156156

157157
eval_sig = LLVMFunctionType(TypeSizeT,
158158
param_types, lengthof(param_types),
@@ -259,8 +259,6 @@ llvm_compile_expr(ExprState *state)
259259

260260
v_tmpvalue = LLVMBuildLoad(b, v_tmpvaluep, "");
261261
v_tmpisnull = LLVMBuildLoad(b, v_tmpisnullp, "");
262-
v_tmpisnull =
263-
LLVMBuildTrunc(b, v_tmpisnull, TypeParamBool, "");
264262

265263
LLVMBuildStore(b, v_tmpisnull, v_isnullp);
266264

0 commit comments

Comments
 (0)