diff --git a/llvm/include/llvm/CodeGen/ReachingDefAnalysis.h b/llvm/include/llvm/CodeGen/ReachingDefAnalysis.h --- a/llvm/include/llvm/CodeGen/ReachingDefAnalysis.h +++ b/llvm/include/llvm/CodeGen/ReachingDefAnalysis.h @@ -55,7 +55,7 @@ /// The first instruction in each basic block is 0. int CurInstr; - /// Maps instructions to their instruction Ids, relative to the begining of + /// Maps instructions to their instruction Ids, relative to the beginning of /// their basic blocks. DenseMap InstIds; diff --git a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp --- a/llvm/lib/CodeGen/ReachingDefAnalysis.cpp +++ b/llvm/lib/CodeGen/ReachingDefAnalysis.cpp @@ -215,9 +215,11 @@ return nullptr; for (auto &MI : *MBB) { - if (InstIds.count(&MI) && InstIds.lookup(&MI) == InstId) + auto F = InstIds.find(&MI); + if (F != InstIds.end() && F->second == InstId) return &MI; } + return nullptr; }