diff --git a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp index 92042ddab38dc..895c8c9d48681 100644 --- a/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp +++ b/llvm/lib/Transforms/HipStdPar/HipStdPar.cpp @@ -279,10 +279,11 @@ HipStdParAllocationInterpositionPass::run(Module &M, ModuleAnalysisManager&) { for (auto &&F : M) { if (!F.hasName()) continue; - if (!AllocReplacements.contains(F.getName())) + auto It = AllocReplacements.find(F.getName()); + if (It == AllocReplacements.end()) continue; - if (auto R = M.getFunction(AllocReplacements[F.getName()])) { + if (auto R = M.getFunction(It->second)) { F.replaceAllUsesWith(R); } else { std::string W;