mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Avoid emitting bitCast in head block
This commit is contained in:
parent
d10951527a
commit
3322211048
1 changed files with 13 additions and 4 deletions
|
@ -8984,10 +8984,19 @@ BfIRValue BfModule::AllocFromType(BfType* type, const BfAllocTarget& allocTarget
|
|||
mBfIRBuilder->ClearDebugLocation(allocaInst);
|
||||
auto allocaBlock = mBfIRBuilder->GetInsertBlock();
|
||||
mBfIRBuilder->SetAllocaAlignment(allocaInst, allocAlign);
|
||||
auto typedVal = BfTypedValue(mBfIRBuilder->CreateBitCast(allocaInst, mBfIRBuilder->MapType(arrayType)), arrayType);
|
||||
mBfIRBuilder->ClearDebugLocation_Last();
|
||||
|
||||
BfTypedValue typedVal;
|
||||
if (!isDynAlloc)
|
||||
{
|
||||
mBfIRBuilder->SetInsertPoint(mCurMethodState->mIRInitBlock);
|
||||
typedVal = BfTypedValue(mBfIRBuilder->CreateBitCast(allocaInst, mBfIRBuilder->MapType(arrayType)), arrayType);
|
||||
mBfIRBuilder->ClearDebugLocation_Last();
|
||||
mBfIRBuilder->SetInsertPoint(prevBlock);
|
||||
allocaBlock = mCurMethodState->mIRInitBlock;
|
||||
}
|
||||
else
|
||||
typedVal = BfTypedValue(mBfIRBuilder->CreateBitCast(allocaInst, mBfIRBuilder->MapType(arrayType)), arrayType);
|
||||
|
||||
if (!noDtorCall)
|
||||
AddStackAlloc(typedVal, BfIRValue(), NULL, scopeData, false, true, allocaBlock);
|
||||
InitTypeInst(typedVal, scopeData, zeroMemory, sizeValue);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue