@@ -1182,11 +1182,12 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache,
1182
1182
for (unsigned i = 0 ; i < NumPHIValues; i++) {
1183
1183
Value *InVal = PN->getIncomingValue (i);
1184
1184
BasicBlock *InBB = PN->getIncomingBlock (i);
1185
- if (!BlockToValue.count (InBB))
1186
- BlockToValue[InBB] = getBaseForInput (InVal, InBB->getTerminator ());
1185
+ auto [It, Inserted] = BlockToValue.try_emplace (InBB);
1186
+ if (Inserted)
1187
+ It->second = getBaseForInput (InVal, InBB->getTerminator ());
1187
1188
else {
1188
1189
#ifndef NDEBUG
1189
- Value *OldBase = BlockToValue[InBB] ;
1190
+ Value *OldBase = It-> second ;
1190
1191
Value *Base = getBaseForInput (InVal, nullptr );
1191
1192
1192
1193
// We can't use `stripPointerCasts` instead of this function because
@@ -1206,7 +1207,7 @@ static Value *findBasePointer(Value *I, DefiningValueMapTy &Cache,
1206
1207
" findBaseOrBDV should be pure!" );
1207
1208
#endif
1208
1209
}
1209
- Value *Base = BlockToValue[InBB] ;
1210
+ Value *Base = It-> second ;
1210
1211
BasePHI->setIncomingValue (i, Base);
1211
1212
}
1212
1213
} else if (SelectInst *BaseSI =
@@ -1545,9 +1546,10 @@ static void CreateGCRelocates(ArrayRef<Value *> LiveVariables,
1545
1546
Value *LiveIdx = Builder.getInt32 (i);
1546
1547
1547
1548
Type *Ty = LiveVariables[i]->getType ();
1548
- if (!TypeToDeclMap.count (Ty))
1549
- TypeToDeclMap[Ty] = getGCRelocateDecl (Ty);
1550
- Function *GCRelocateDecl = TypeToDeclMap[Ty];
1549
+ auto [It, Inserted] = TypeToDeclMap.try_emplace (Ty);
1550
+ if (Inserted)
1551
+ It->second = getGCRelocateDecl (Ty);
1552
+ Function *GCRelocateDecl = It->second ;
1551
1553
1552
1554
// only specify a debug name if we can give a useful one
1553
1555
CallInst *Reloc = Builder.CreateCall (
@@ -2378,9 +2380,9 @@ findRematerializationCandidates(PointerToBaseTy PointerToBase,
2378
2380
2379
2381
// Handle the scenario where the RootOfChain is not equal to the
2380
2382
// Base Value, but they are essentially the same phi values.
2381
- if (RootOfChain ! = PointerToBase[Derived]) {
2383
+ if (Value *BaseVal = PointerToBase[Derived]; RootOfChain != BaseVal ) {
2382
2384
PHINode *OrigRootPhi = dyn_cast<PHINode>(RootOfChain);
2383
- PHINode *AlternateRootPhi = dyn_cast<PHINode>(PointerToBase[Derived] );
2385
+ PHINode *AlternateRootPhi = dyn_cast<PHINode>(BaseVal );
2384
2386
if (!OrigRootPhi || !AlternateRootPhi)
2385
2387
continue ;
2386
2388
// PHI nodes that have the same incoming values, and belonging to the same
0 commit comments