mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-04 11:16:48 +02:00
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. 72559438f9
).
Author: Andres Freund
Discussion: https://postgr.es/m/20201207212142.wz5tnbk2jsaqzogb@alap3.anarazel.de
Backpatch: 11-, where jit support was added
This commit is contained in:
parent
f4f924b3ed
commit
1e16ad1014
@ -152,7 +152,7 @@ llvm_compile_expr(ExprState *state)
|
|||||||
|
|
||||||
param_types[0] = l_ptr(StructExprState); /* state */
|
param_types[0] = l_ptr(StructExprState); /* state */
|
||||||
param_types[1] = l_ptr(StructExprContext); /* econtext */
|
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,
|
eval_sig = LLVMFunctionType(TypeSizeT,
|
||||||
param_types, lengthof(param_types),
|
param_types, lengthof(param_types),
|
||||||
@ -259,8 +259,6 @@ llvm_compile_expr(ExprState *state)
|
|||||||
|
|
||||||
v_tmpvalue = LLVMBuildLoad(b, v_tmpvaluep, "");
|
v_tmpvalue = LLVMBuildLoad(b, v_tmpvaluep, "");
|
||||||
v_tmpisnull = LLVMBuildLoad(b, v_tmpisnullp, "");
|
v_tmpisnull = LLVMBuildLoad(b, v_tmpisnullp, "");
|
||||||
v_tmpisnull =
|
|
||||||
LLVMBuildTrunc(b, v_tmpisnull, TypeParamBool, "");
|
|
||||||
|
|
||||||
LLVMBuildStore(b, v_tmpisnull, v_isnullp);
|
LLVMBuildStore(b, v_tmpisnull, v_isnullp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user