diff --git a/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h b/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h index b4ea1ad840f9d..7231e45fe8eb7 100644 --- a/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h +++ b/llvm/include/llvm/Transforms/Utils/SampleProfileInference.h @@ -247,9 +247,10 @@ FlowFunction SampleProfileInference::createFlowFunction( // Create FlowBlocks for (const auto *BB : BasicBlocks) { FlowBlock Block; - if (SampleBlockWeights.contains(BB)) { + auto It = SampleBlockWeights.find(BB); + if (It != SampleBlockWeights.end()) { Block.HasUnknownWeight = false; - Block.Weight = SampleBlockWeights[BB]; + Block.Weight = It->second; } else { Block.HasUnknownWeight = true; Block.Weight = 0;