GCC: Remedy NRVO Fails

Using the `-Wnrvo` flag introduced by GCC 14, I identified a few places where NRVO was clearly intended, but is fumbled.
This commit is contained in:
mitaclaw
2024-12-13 14:02:12 -08:00
parent 87496205aa
commit 433c6ce0f2
6 changed files with 11 additions and 17 deletions

View File

@ -57,11 +57,10 @@ VertexLoaderX64::VertexLoaderX64(const TVtxDesc& vtx_desc, const VAT& vtx_att)
OpArg VertexLoaderX64::GetVertexAddr(CPArray array, VertexComponentFormat attribute)
{
OpArg data = MDisp(src_reg, m_src_ofs);
if (IsIndexed(attribute))
{
int bits = attribute == VertexComponentFormat::Index8 ? 8 : 16;
LoadAndSwap(bits, scratch1, data);
LoadAndSwap(bits, scratch1, MDisp(src_reg, m_src_ofs));
m_src_ofs += bits / 8;
if (array == CPArray::Position)
{
@ -74,7 +73,7 @@ OpArg VertexLoaderX64::GetVertexAddr(CPArray array, VertexComponentFormat attrib
}
else
{
return data;
return MDisp(src_reg, m_src_ofs);
}
}