mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-22 11:40:05 +00:00
avoid unnecessary reallocations in GetOperandConstants (#4708)
reserve capacity since we know the size exactly
This commit is contained in:
parent
44923beb52
commit
940127a77d
@ -158,6 +158,7 @@ Type* ConstantManager::GetType(const Instruction* inst) const {
|
|||||||
std::vector<const Constant*> ConstantManager::GetOperandConstants(
|
std::vector<const Constant*> ConstantManager::GetOperandConstants(
|
||||||
const Instruction* inst) const {
|
const Instruction* inst) const {
|
||||||
std::vector<const Constant*> constants;
|
std::vector<const Constant*> constants;
|
||||||
|
constants.reserve(inst->NumInOperands());
|
||||||
for (uint32_t i = 0; i < inst->NumInOperands(); i++) {
|
for (uint32_t i = 0; i < inst->NumInOperands(); i++) {
|
||||||
const Operand* operand = &inst->GetInOperand(i);
|
const Operand* operand = &inst->GetInOperand(i);
|
||||||
if (operand->type != SPV_OPERAND_TYPE_ID) {
|
if (operand->type != SPV_OPERAND_TYPE_ID) {
|
||||||
|
Loading…
Reference in New Issue
Block a user