mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Fixed bug with stack saving
In certain cases when we need to remove the StackSave (because we crossed the save threshold with an allocation), there may already be restores using that stack save which need to be removed as well.
This commit is contained in:
parent
be7e82f5b6
commit
9f1ea28953
8 changed files with 25 additions and 10 deletions
|
@ -1767,8 +1767,11 @@ void BeIRCodeGen::HandleNextCmd()
|
|||
CMD_PARAM(BeValue*, instVal);
|
||||
|
||||
BeInst* inst = (BeInst*)instVal;
|
||||
auto itr = std::find(inst->mParentBlock->mInstructions.begin(), inst->mParentBlock->mInstructions.end(), inst);
|
||||
inst->mParentBlock->mInstructions.erase(itr);
|
||||
bool wasRemoved = inst->mParentBlock->mInstructions.Remove(inst);
|
||||
BF_ASSERT(wasRemoved);
|
||||
#ifdef _DEBUG
|
||||
inst->mWasRemoved = true;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case BfIRCmd_CreateBr:
|
||||
|
@ -3050,6 +3053,7 @@ BeValue* BeIRCodeGen::GetBeValue(int id)
|
|||
BF_ASSERT(result.mKind == BeIRCodeGenEntryKind_Value);
|
||||
#ifdef _DEBUG
|
||||
BF_ASSERT(!result.mBeValue->mLifetimeEnded);
|
||||
BF_ASSERT(!result.mBeValue->mWasRemoved);
|
||||
#endif
|
||||
return result.mBeValue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue