Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 01c6370

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. 72559438f92). Author: Andres Freund Discussion: https://postgr.es/m/20201207212142.wz5tnbk2jsaqzogb@alap3.anarazel.de Backpatch: 11-, where jit support was added
1 parent 4f64daf commit 01c6370

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

156156
param_types[0] = l_ptr(StructExprState); /* state */
157157
param_types[1] = l_ptr(StructExprContext); /* econtext */
158-
param_types[2] = l_ptr(TypeParamBool); /* isnull */
158+
param_types[2] = l_ptr(TypeStorageBool); /* isnull */
159159

160160
eval_sig = LLVMFunctionType(TypeSizeT,
161161
param_types, lengthof(param_types),
@@ -265,8 +265,6 @@ llvm_compile_expr(ExprState *state)
265265

266266
v_tmpvalue = LLVMBuildLoad(b, v_tmpvaluep, "");
267267
v_tmpisnull = LLVMBuildLoad(b, v_tmpisnullp, "");
268-
v_tmpisnull =
269-
LLVMBuildTrunc(b, v_tmpisnull, TypeParamBool, "");
270268

271269
LLVMBuildStore(b, v_tmpisnull, v_isnullp);
272270

0 commit comments

Comments
 (0)