提交 bc6faa08 编写于 作者: N Nikos Armenatzoglou 提交者: Karthikeyan Jambu Rajaraman

Set llvm_isNull_ptr to false when the result of codegened expression evaluation is not null

So far we were assuming that the content of `llvm_isNull_ptr` variable, which is passed as
input to expression evaluation, is always `false`. Consequently, when the result of the
expression is not null, we avoid setting `llvm_isNull_ptr` to `false`.

However, this assumption is not correct since in codegen we do not use a temporary `fcinfo`
struct (for perfromance reasons), which initializes `fcinfo->isnull` to `false`.
Instead, we pass a pointer to the isnull variable of the caller directly (which might not
have been inititialized). For example, in `GenerateAdvanceAggregates` we pass a pointer
to `transValueIsNull`.

In this commit, we explicitly set `llvm_isNull_ptr` to `false` when the result is not null.
This will cover all cases that the input is not initialized to `false`.
Signed-off-by: NKarthikeyan Jambu Rajaraman <karthi.jrk@gmail.com>
上级 8bbbd63f
......@@ -285,6 +285,11 @@ class PGIRBuilderFuncGenerator
llvm::BasicBlock* func_generation_last_block = irb->GetInsertBlock();
assert(llvm_func_tmp_value->getType() ==
codegen_utils->GetType<ReturnType>());
// Explicitly set isnull to false so that we can cover the case that isnull
// has not been initialized to false. This is useful because in codegen
// we do not use temporary struct fcinfo.
irb->CreateStore(codegen_utils->GetConstant<bool>(false),
llvm_isnull_ptr);
irb->CreateBr(set_llvm_out_value_block);
// null_argument_block
......@@ -502,6 +507,11 @@ class PGGenericFuncGenerator : public PGFuncGeneratorInterface {
llvm::BasicBlock* func_generation_last_block = irb->GetInsertBlock();
assert(llvm_func_generation_tmp_value->getType() ==
codegen_utils->GetType<ReturnType>());
// Explicitly set isnull to false so that we can cover the case that isnull
// has not been initialized to false. This is useful because in codegen
// we do not use temporary struct fcinfo.
irb->CreateStore(codegen_utils->GetConstant<bool>(false),
llvm_isnull_ptr);
irb->CreateBr(set_llvm_out_value_block);
// set_llvm_out_value_block
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册