From 6a2437677db8e104a26e2f4dfaf79ecac391ae4d Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 7 Mar 2025 09:33:27 -0800 Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?= =?UTF-8?q?itial=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.4 --- llvm/lib/CodeGen/ModuloSchedule.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp index c6d1a416407f2..04d07f4ef5428 100644 --- a/llvm/lib/CodeGen/ModuloSchedule.cpp +++ b/llvm/lib/CodeGen/ModuloSchedule.cpp @@ -410,8 +410,11 @@ void ModuloScheduleExpander::generateExistingPhis( Register NewReg = VRMap[PrevStage][LoopVal]; rewriteScheduledInstr(NewBB, InstrMap, CurStageNum, 0, &*BBI, Def, InitVal, NewReg); - if (VRMap[CurStageNum].count(LoopVal)) - VRMap[CurStageNum][Def] = VRMap[CurStageNum][LoopVal]; + auto It = VRMap[CurStageNum].find(LoopVal); + if (It != VRMap[CurStageNum].end()) { + llvm::Register Reg = It->second; + VRMap[CurStageNum][Def] = Reg; + } } // Adjust the number of Phis needed depending on the number of prologs left, // and the distance from where the Phi is first scheduled. The number of From b9a662d1393c7149a86859ec263804b40e68cfcf Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Fri, 7 Mar 2025 11:04:26 -0800 Subject: [PATCH 2/2] undo Created using spr 1.3.4 --- llvm/lib/CodeGen/ModuloSchedule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/CodeGen/ModuloSchedule.cpp b/llvm/lib/CodeGen/ModuloSchedule.cpp index 9fbef19fe424a..04d07f4ef5428 100644 --- a/llvm/lib/CodeGen/ModuloSchedule.cpp +++ b/llvm/lib/CodeGen/ModuloSchedule.cpp @@ -412,8 +412,8 @@ void ModuloScheduleExpander::generateExistingPhis( InitVal, NewReg); auto It = VRMap[CurStageNum].find(LoopVal); if (It != VRMap[CurStageNum].end()) { - llvm::Register &Reg = VRMap[CurStageNum][Def]; - Reg = It->second; + llvm::Register Reg = It->second; + VRMap[CurStageNum][Def] = Reg; } } // Adjust the number of Phis needed depending on the number of prologs left,