diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 842881156dc67..a2730396a0ea2 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -4179,13 +4179,14 @@ Instruction *InstCombinerImpl::visitCallBase(CallBase &Call) { DenseMap Val2Idx; std::vector NewLiveGc; for (Value *V : Bundle->Inputs) { - if (Val2Idx.count(V)) + auto [It, Inserted] = Val2Idx.try_emplace(V); + if (!Inserted) continue; if (LiveGcValues.count(V)) { - Val2Idx[V] = NewLiveGc.size(); + It->second = NewLiveGc.size(); NewLiveGc.push_back(V); } else - Val2Idx[V] = NumOfGCLives; + It->second = NumOfGCLives; } // Update all gc.relocates for (const GCRelocateInst *Reloc : GCSP.getGCRelocates()) {