Skip to content

Commit d1cba23

Browse files
[InstCombine] Avoid repeated hash lookups (NFC)
1 parent 5c6db8c commit d1cba23

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
@@ -4179,13 +4179,14 @@ Instruction *InstCombinerImpl::visitCallBase(CallBase &Call) {
41794179
DenseMap<Value *, unsigned> Val2Idx;
41804180
std::vector<Value *> NewLiveGc;
41814181
for (Value *V : Bundle->Inputs) {
4182-
if (Val2Idx.count(V))
4182+
auto [It, Inserted] = Val2Idx.try_emplace(V);
4183+
if (!Inserted)
41834184
continue;
41844185
if (LiveGcValues.count(V)) {
4185-
Val2Idx[V] = NewLiveGc.size();
4186+
It->second = NewLiveGc.size();
41864187
NewLiveGc.push_back(V);
41874188
} else
4188-
Val2Idx[V] = NumOfGCLives;
4189+
It->second = NumOfGCLives;
41894190
}
41904191
// Update all gc.relocates
41914192
for (const GCRelocateInst *Reloc : GCSP.getGCRelocates()) {

0 commit comments

Comments
 (0)