mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Ensure blockExpr lifetimeStart doesn't insert above phi nodes
This commit is contained in:
parent
72d74149be
commit
2a85806580
1 changed files with 11 additions and 1 deletions
|
@ -3105,7 +3105,17 @@ void BfIRCodeGen::HandleNextCmd()
|
||||||
case BfIRCmd_SetInsertPointAtStart:
|
case BfIRCmd_SetInsertPointAtStart:
|
||||||
{
|
{
|
||||||
CMD_PARAM(llvm::BasicBlock*, block);
|
CMD_PARAM(llvm::BasicBlock*, block);
|
||||||
mIRBuilder->SetInsertPoint(block, block->begin());
|
|
||||||
|
auto itr = block->begin();
|
||||||
|
if (itr != block->end())
|
||||||
|
{
|
||||||
|
// Some instructructions MUST be at start of the block
|
||||||
|
auto instType = itr->getType();
|
||||||
|
if (llvm::PHINode::classof(&*itr))
|
||||||
|
++itr;
|
||||||
|
}
|
||||||
|
|
||||||
|
mIRBuilder->SetInsertPoint(block, itr);
|
||||||
// SetInsertPoint can clear the debug loc so reset it here
|
// SetInsertPoint can clear the debug loc so reset it here
|
||||||
mIRBuilder->SetCurrentDebugLocation(mDebugLoc);
|
mIRBuilder->SetCurrentDebugLocation(mDebugLoc);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue