Skip to content

Commit 0c951b6

Browse files
authored
Fixing issues in type scavenger related to copy efficiency (#2030)
1 parent b97824c commit 0c951b6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/SPIRV/SPIRVTypeScavenger.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ bool SPIRVTypeScavenger::unifyType(Type *T1, Type *T2) {
344344
return false;
345345
if (!unifyType(FT1->getReturnType(), FT2->getReturnType()))
346346
return false;
347-
for (auto [PT1, PT2] : zip(FT1->params(), FT2->params()))
347+
for (const auto &[PT1, PT2] : zip(FT1->params(), FT2->params()))
348348
if (!unifyType(PT1, PT2))
349349
return false;
350350
return true;
@@ -414,7 +414,7 @@ void SPIRVTypeScavenger::typeModule(Module &M) {
414414
// If there are any type variables we couldn't resolve, fallback to assigning
415415
// them as an i8* type.
416416
Type *Int8Ty = Type::getInt8Ty(M.getContext());
417-
for (auto [TypeVarNum, TypeVar] : enumerate(TypeVariables)) {
417+
for (const auto &[TypeVarNum, TypeVar] : enumerate(TypeVariables)) {
418418
unsigned PrimaryVar = UnifiedTypeVars.join(TypeVarNum, TypeVarNum);
419419
Type *LeaderTy = TypeVariables[PrimaryVar];
420420
if (TypeVar)
@@ -605,7 +605,8 @@ bool SPIRVTypeScavenger::typeIntrinsicCall(
605605
void SPIRVTypeScavenger::typeFunctionParams(
606606
CallBase &CB, FunctionType *FT, unsigned ArgStart, bool IncludeRet,
607607
SmallVectorImpl<TypeRule> &TypeRules) {
608-
for (auto [U, ArgTy] : zip(drop_begin(CB.args(), ArgStart), FT->params())) {
608+
for (const auto &[U, ArgTy] :
609+
zip(drop_begin(CB.args(), ArgStart), FT->params())) {
609610
if (hasPointerType(U->getType())) {
610611
TypeRules.push_back(TypeRule::is(U, ArgTy));
611612
}

0 commit comments

Comments
 (0)