Index: llvm/include/llvm/CodeGen/ReachingDefAnalysis.h =================================================================== --- llvm/include/llvm/CodeGen/ReachingDefAnalysis.h +++ 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; Index: llvm/lib/CodeGen/ReachingDefAnalysis.cpp =================================================================== --- llvm/lib/CodeGen/ReachingDefAnalysis.cpp +++ llvm/lib/CodeGen/ReachingDefAnalysis.cpp @@ -215,9 +215,11 @@ return nullptr; for (auto &MI : *MBB) { - if (InstIds.count(&MI) && InstIds.lookup(&MI) == InstId) - return &MI; + auto F = InstIds.find(&MI); + if (F != InstIds.end() && F->second == InstId) + return F->first; } + return nullptr; }