Index: llvm/lib/CodeGen/ReachingDefAnalysis.cpp =================================================================== --- llvm/lib/CodeGen/ReachingDefAnalysis.cpp +++ llvm/lib/CodeGen/ReachingDefAnalysis.cpp @@ -214,10 +214,12 @@ if (InstId < 0) return nullptr; - for (auto &MI : *MBB) { - if (InstIds.count(&MI) && InstIds.lookup(&MI) == InstId) - return &MI; - } + auto It = std::find_if(MBB->begin(), MBB->end(), [&](const MachineInstr &MI) { + return InstIds.lookup(&MI) == InstId; + }); + if (It != MBB->end()) + return &*It; + return nullptr; }