Skip to content

Commit 7fa1936

Browse files
[InstCombine] Avoid repeated hash lookups (NFC) (#123559)
1 parent 64749fb commit 7fa1936

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4206,13 +4206,14 @@ Instruction *InstCombinerImpl::visitCallBase(CallBase &Call) {
42064206
DenseMap<Value *, unsigned> Val2Idx;
42074207
std::vector<Value *> NewLiveGc;
42084208
for (Value *V : Bundle->Inputs) {
4209-
if (Val2Idx.count(V))
4209+
auto [It, Inserted] = Val2Idx.try_emplace(V);
4210+
if (!Inserted)
42104211
continue;
42114212
if (LiveGcValues.count(V)) {
4212-
Val2Idx[V] = NewLiveGc.size();
4213+
It->second = NewLiveGc.size();
42134214
NewLiveGc.push_back(V);
42144215
} else
4215-
Val2Idx[V] = NumOfGCLives;
4216+
It->second = NumOfGCLives;
42164217
}
42174218
// Update all gc.relocates
42184219
for (const GCRelocateInst *Reloc : GCSP.getGCRelocates()) {

0 commit comments

Comments
 (0)