mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +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);
|
mBfIRBuilder->ClearDebugLocation(allocaInst);
|
||||||
auto allocaBlock = mBfIRBuilder->GetInsertBlock();
|
auto allocaBlock = mBfIRBuilder->GetInsertBlock();
|
||||||
mBfIRBuilder->SetAllocaAlignment(allocaInst, allocAlign);
|
mBfIRBuilder->SetAllocaAlignment(allocaInst, allocAlign);
|
||||||
auto typedVal = BfTypedValue(mBfIRBuilder->CreateBitCast(allocaInst, mBfIRBuilder->MapType(arrayType)), arrayType);
|
|
||||||
mBfIRBuilder->ClearDebugLocation_Last();
|
BfTypedValue typedVal;
|
||||||
if (!isDynAlloc)
|
if (!isDynAlloc)
|
||||||
|
{
|
||||||
|
mBfIRBuilder->SetInsertPoint(mCurMethodState->mIRInitBlock);
|
||||||
|
typedVal = BfTypedValue(mBfIRBuilder->CreateBitCast(allocaInst, mBfIRBuilder->MapType(arrayType)), arrayType);
|
||||||
|
mBfIRBuilder->ClearDebugLocation_Last();
|
||||||
mBfIRBuilder->SetInsertPoint(prevBlock);
|
mBfIRBuilder->SetInsertPoint(prevBlock);
|
||||||
|
allocaBlock = mCurMethodState->mIRInitBlock;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
typedVal = BfTypedValue(mBfIRBuilder->CreateBitCast(allocaInst, mBfIRBuilder->MapType(arrayType)), arrayType);
|
||||||
|
|
||||||
if (!noDtorCall)
|
if (!noDtorCall)
|
||||||
AddStackAlloc(typedVal, BfIRValue(), NULL, scopeData, false, true, allocaBlock);
|
AddStackAlloc(typedVal, BfIRValue(), NULL, scopeData, false, true, allocaBlock);
|
||||||
InitTypeInst(typedVal, scopeData, zeroMemory, sizeValue);
|
InitTypeInst(typedVal, scopeData, zeroMemory, sizeValue);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue