mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed some nullable splat cases
This commit is contained in:
parent
c889877443
commit
192c9d8f33
2 changed files with 8 additions and 1 deletions
|
@ -14159,6 +14159,8 @@ BfIRValue BfModule::ExtractValue(BfTypedValue typedValue, int dataIdx)
|
|||
auto addrVal = mBfIRBuilder->CreateInBoundsGEP(typedValue.mValue, 0, dataIdx);
|
||||
return mBfIRBuilder->CreateAlignedLoad(addrVal, typedValue.mType->mAlign);
|
||||
}
|
||||
if (typedValue.IsSplat())
|
||||
typedValue = LoadOrAggregateValue(typedValue);
|
||||
return mBfIRBuilder->CreateExtractValue(typedValue.mValue, dataIdx);
|
||||
}
|
||||
|
||||
|
|
|
@ -1519,10 +1519,15 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
|
|||
if (!resolvedType->IsNullable())
|
||||
{
|
||||
if (initValue.IsAddr())
|
||||
{
|
||||
initValue = BfTypedValue(mBfIRBuilder->CreateInBoundsGEP(initValue.mValue, 0, 1), initValue.mType->GetUnderlyingType(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
initValue = LoadOrAggregateValue(initValue);
|
||||
initValue = BfTypedValue(mBfIRBuilder->CreateExtractValue(initValue.mValue, 1), initValue.mType->GetUnderlyingType());
|
||||
}
|
||||
}
|
||||
|
||||
if ((initValue) && (!initValue.mType->IsValuelessType()))
|
||||
{
|
||||
|
@ -1600,7 +1605,7 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
|
|||
{
|
||||
auto nullableElementType = initValue.mType->GetUnderlyingType();
|
||||
auto boolType = GetPrimitiveType(BfTypeCode_Boolean);
|
||||
initValue = LoadValue(initValue);
|
||||
initValue = LoadOrAggregateValue(initValue);
|
||||
exprEvaluator->mResult = BfTypedValue(mBfIRBuilder->CreateExtractValue(initValue.mValue, nullableElementType->IsValuelessType() ? 1 : 2), boolType);
|
||||
handledExprBoolResult = true;
|
||||
if (!nullableElementType->IsValuelessType())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue