1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Better fix for direct autprop optimization

This commit is contained in:
Brian Fiete 2021-01-20 08:53:43 -08:00
parent b5aa92ff33
commit 3fddd4f396
6 changed files with 31 additions and 13 deletions

View file

@ -11754,7 +11754,7 @@ void BfModule::AggregateSplatIntoAddr(BfTypedValue typedValue, BfIRValue addrVal
checkTypeLambda(typedValue.mType, addrVal);
}
BfTypedValue BfModule::MakeAddressable(BfTypedValue typedVal)
BfTypedValue BfModule::MakeAddressable(BfTypedValue typedVal, bool forceMutable)
{
bool wasReadOnly = typedVal.IsReadOnly();
@ -11775,6 +11775,9 @@ BfTypedValue BfModule::MakeAddressable(BfTypedValue typedVal)
else
mBfIRBuilder->CreateAlignedStore(typedVal.mValue, tempVar, type->mAlign);
if (forceMutable)
wasReadOnly = false;
return BfTypedValue(tempVar, type,
typedVal.IsThis() ?
(wasReadOnly ? BfTypedValueKind_ReadOnlyThisAddr : BfTypedValueKind_ThisAddr) :
@ -11790,6 +11793,11 @@ BfTypedValue BfModule::RemoveReadOnly(BfTypedValue typedValue)
return typedValue;
}
BfTypedValue BfModule::CopyValue(const BfTypedValue& typedValue)
{
return MakeAddressable(LoadValue(typedValue), true);
}
BfIRValue BfModule::ExtractSplatValue(BfTypedValue typedValue, int componentIdx, BfType* wantType, bool* isAddr)
{
BF_ASSERT(!mIsComptimeModule);