diff --git a/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp b/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp index 59c882bf37afa..7c18c524d2d64 100644 --- a/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp +++ b/llvm/lib/Target/Hexagon/HexagonCopyHoisting.cpp @@ -180,14 +180,15 @@ bool HexagonCopyHoisting::analyzeCopy(MachineBasicBlock *BB) { bool IsSafetoMove = true; for (MachineBasicBlock *SuccBB : BB->successors()) { auto &SuccBBCopyInst = CopyMIList[SuccBB->getNumber()]; - if (!SuccBBCopyInst.count(Key)) { + auto It = SuccBBCopyInst.find(Key); + if (It == SuccBBCopyInst.end()) { // Same copy not present in this successor IsSafetoMove = false; break; } // If present, make sure that it's safe to pull this copy instruction // into the predecessor. - MachineInstr *SuccMI = SuccBBCopyInst[Key]; + MachineInstr *SuccMI = It->second; if (!isSafetoMove(SuccMI)) { IsSafetoMove = false; break;