1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed phi with var failure value

This commit is contained in:
Brian Fiete 2020-10-05 14:54:55 -07:00
parent 8647d63806
commit efa44caee0

View file

@ -16042,9 +16042,16 @@ void BfExprEvaluator::Visit(BfConditionalExpression* condExpr)
BfIRValue phi;
if (!trueValue.mType->IsValuelessType())
{
phi = mModule->mBfIRBuilder->CreatePhi(mModule->mBfIRBuilder->MapType(trueValue.mType), 2);
mModule->mBfIRBuilder->AddPhiIncoming(phi, trueValue.mValue, trueBlockPos);
mModule->mBfIRBuilder->AddPhiIncoming(phi, falseValue.mValue, falseBlockPos);
if (trueValue.mType->IsVar())
{
phi = mModule->mBfIRBuilder->GetFakeVal();
}
else
{
phi = mModule->mBfIRBuilder->CreatePhi(mModule->mBfIRBuilder->MapType(trueValue.mType), 2);
mModule->mBfIRBuilder->AddPhiIncoming(phi, trueValue.mValue, trueBlockPos);
mModule->mBfIRBuilder->AddPhiIncoming(phi, falseValue.mValue, falseBlockPos);
}
}
mModule->mBfIRBuilder->CreateBr(contBB);
mModule->AddBasicBlock(contBB);