diff options
author | Kazu Hirata <kazu@google.com> | 2025-03-07 00:59:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-07 00:59:25 -0800 |
commit | 616f277640129ff37d4005737a62acbd60d06ca1 (patch) | |
tree | d5564b00cb870ff053646f6682a01b04fc649554 /llvm/lib/CodeGen/ModuloSchedule.cpp | |
parent | 17aac7ccf92e606fcf8c69ee11cdcf16ca2724b8 (diff) | |
download | llvm-616f277640129ff37d4005737a62acbd60d06ca1.zip llvm-616f277640129ff37d4005737a62acbd60d06ca1.tar.gz llvm-616f277640129ff37d4005737a62acbd60d06ca1.tar.bz2 |
[CodeGen] Avoid repeated hash lookups (NFC) (#130237)
Diffstat (limited to 'llvm/lib/CodeGen/ModuloSchedule.cpp')
-rw-r--r-- | llvm/lib/CodeGen/ModuloSchedule.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp index fa0805b..c6d1a41 100644 --- a/llvm/lib/CodeGen/ModuloSchedule.cpp +++ b/llvm/lib/CodeGen/ModuloSchedule.cpp @@ -464,10 +464,12 @@ void ModuloScheduleExpander::generateExistingPhis( InstOp1 = MRI.getVRegDef(PhiOp1); int PhiOpStage = Schedule.getStage(InstOp1); int StageAdj = (PhiOpStage != -1 ? PhiStage - PhiOpStage : 0); - if (PhiOpStage != -1 && PrologStage - StageAdj >= Indirects + np && - VRMap[PrologStage - StageAdj - Indirects - np].count(PhiOp1)) { - PhiOp1 = VRMap[PrologStage - StageAdj - Indirects - np][PhiOp1]; - break; + if (PhiOpStage != -1 && PrologStage - StageAdj >= Indirects + np) { + auto &M = VRMap[PrologStage - StageAdj - Indirects - np]; + if (auto It = M.find(PhiOp1); It != M.end()) { + PhiOp1 = It->second; + break; + } } ++Indirects; } @@ -597,8 +599,11 @@ void ModuloScheduleExpander::generateExistingPhis( // Check if we need to rename a Phi that has been eliminated due to // scheduling. - if (NumStages == 0 && IsLast && VRMap[CurStageNum].count(LoopVal)) - replaceRegUsesAfterLoop(Def, VRMap[CurStageNum][LoopVal], BB, MRI, LIS); + if (NumStages == 0 && IsLast) { + auto It = VRMap[CurStageNum].find(LoopVal); + if (It != VRMap[CurStageNum].end()) + replaceRegUsesAfterLoop(Def, It->second, BB, MRI, LIS); + } } } |