mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-15 06:44:10 +02:00
Fixed phi with var failure value
This commit is contained in:
parent
8647d63806
commit
efa44caee0
1 changed files with 10 additions and 3 deletions
|
@ -16041,11 +16041,18 @@ void BfExprEvaluator::Visit(BfConditionalExpression* condExpr)
|
||||||
mModule->mBfIRBuilder->SetInsertPoint(endBB);
|
mModule->mBfIRBuilder->SetInsertPoint(endBB);
|
||||||
BfIRValue phi;
|
BfIRValue phi;
|
||||||
if (!trueValue.mType->IsValuelessType())
|
if (!trueValue.mType->IsValuelessType())
|
||||||
|
{
|
||||||
|
if (trueValue.mType->IsVar())
|
||||||
|
{
|
||||||
|
phi = mModule->mBfIRBuilder->GetFakeVal();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
phi = mModule->mBfIRBuilder->CreatePhi(mModule->mBfIRBuilder->MapType(trueValue.mType), 2);
|
phi = mModule->mBfIRBuilder->CreatePhi(mModule->mBfIRBuilder->MapType(trueValue.mType), 2);
|
||||||
mModule->mBfIRBuilder->AddPhiIncoming(phi, trueValue.mValue, trueBlockPos);
|
mModule->mBfIRBuilder->AddPhiIncoming(phi, trueValue.mValue, trueBlockPos);
|
||||||
mModule->mBfIRBuilder->AddPhiIncoming(phi, falseValue.mValue, falseBlockPos);
|
mModule->mBfIRBuilder->AddPhiIncoming(phi, falseValue.mValue, falseBlockPos);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mModule->mBfIRBuilder->CreateBr(contBB);
|
mModule->mBfIRBuilder->CreateBr(contBB);
|
||||||
mModule->AddBasicBlock(contBB);
|
mModule->AddBasicBlock(contBB);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue