mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-25 21:00:22 +01:00
swr/rast: Fix alloca usage in jitter
Fix issue where temporary allocas were getting hoisted to function entry unnecessarily. We now explicitly mark temporary allocas and skip hoisting during the hoist pass. Shuold reduce stack usage. Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
This commit is contained in:
parent
81371a5909
commit
aa482014e5
3 changed files with 20 additions and 0 deletions
|
|
@ -111,4 +111,21 @@ namespace SwrJit
|
|||
mSimdVectorIntTy = ArrayType::get(mSimdInt32Ty, 4);
|
||||
mSimdVectorTRTy = ArrayType::get(mSimdFP32Ty, 5);
|
||||
}
|
||||
|
||||
/// @brief Mark this alloca as temporary to avoid hoisting later on
|
||||
void Builder::SetTempAlloca(Value* inst)
|
||||
{
|
||||
AllocaInst* pAlloca = dyn_cast<AllocaInst>(inst);
|
||||
SWR_ASSERT(pAlloca, "Unexpected non-alloca instruction");
|
||||
MDNode* N = MDNode::get(JM()->mContext, MDString::get(JM()->mContext, "is_temp_alloca"));
|
||||
pAlloca->setMetadata("is_temp_alloca", N);
|
||||
}
|
||||
|
||||
bool Builder::IsTempAlloca(Value* inst)
|
||||
{
|
||||
AllocaInst* pAlloca = dyn_cast<AllocaInst>(inst);
|
||||
SWR_ASSERT(pAlloca, "Unexpected non-alloca instruction");
|
||||
|
||||
return (pAlloca->getMetadata("is_temp_alloca") != nullptr);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,6 +96,8 @@ namespace SwrJit
|
|||
Type* mSimd32Int8Ty;
|
||||
|
||||
void SetTargetWidth(uint32_t width);
|
||||
void SetTempAlloca(Value* inst);
|
||||
bool IsTempAlloca(Value* inst);
|
||||
|
||||
#include "gen_builder.hpp"
|
||||
#include "gen_builder_meta.hpp"
|
||||
|
|
|
|||
|
|
@ -229,6 +229,7 @@ namespace SwrJit
|
|||
|
||||
// store vSrc on the stack. this way we can select between a valid load address and the vSrc address
|
||||
Value* vSrcPtr = ALLOCA(vSrc->getType());
|
||||
SetTempAlloca(vSrcPtr);
|
||||
STORE(vSrc, vSrcPtr);
|
||||
|
||||
vGather = UndefValue::get(VectorType::get(mDoubleTy, 4));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue