@@ -1008,8 +1008,8 @@ SPIRVType *SPIRVGlobalRegistry::findSPIRVType(
1008
1008
Register Reg = DT.find (Ty, &MIRBuilder.getMF ());
1009
1009
if (Reg.isValid ())
1010
1010
return getSPIRVTypeForVReg (Reg);
1011
- if (ForwardPointerTypes.contains (Ty))
1012
- return ForwardPointerTypes[Ty] ;
1011
+ if (auto It = ForwardPointerTypes.find (Ty); It != ForwardPointerTypes. end ( ))
1012
+ return It-> second ;
1013
1013
return restOfCreateSPIRVType (Ty, MIRBuilder, AccQual, EmitIR);
1014
1014
}
1015
1015
@@ -1103,14 +1103,15 @@ SPIRVType *SPIRVGlobalRegistry::createSPIRVType(
1103
1103
// Null pointer means we have a loop in type definitions, make and
1104
1104
// return corresponding OpTypeForwardPointer.
1105
1105
if (SpvElementType == nullptr ) {
1106
- if (!ForwardPointerTypes.contains (Ty))
1107
- ForwardPointerTypes[Ty] = getOpTypeForwardPointer (SC, MIRBuilder);
1108
- return ForwardPointerTypes[Ty];
1106
+ auto [It, Inserted] = ForwardPointerTypes.try_emplace (Ty);
1107
+ if (Inserted)
1108
+ It->second = getOpTypeForwardPointer (SC, MIRBuilder);
1109
+ return It->second ;
1109
1110
}
1110
1111
// If we have forward pointer associated with this type, use its register
1111
1112
// operand to create OpTypePointer.
1112
- if (ForwardPointerTypes.contains (Ty)) {
1113
- Register Reg = getSPIRVTypeID (ForwardPointerTypes[Ty] );
1113
+ if (auto It = ForwardPointerTypes.find (Ty); It != ForwardPointerTypes. end ( )) {
1114
+ Register Reg = getSPIRVTypeID (It-> second );
1114
1115
return getOpTypePointer (SC, SpvElementType, MIRBuilder, Reg);
1115
1116
}
1116
1117
0 commit comments