Skip to content

Commit 0963f0d

Browse files
[AMDGPU] Avoid repeated hash lookups (NFC) (llvm#128393)
1 parent dbd219a commit 0963f0d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Target/AMDGPU/SIFoldOperands.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,13 +1084,11 @@ void SIFoldOperandsImpl::foldOperand(
10841084
}
10851085

10861086
if (CopyToVGPR.Reg) {
1087-
Register Vgpr;
1088-
if (VGPRCopies.count(CopyToVGPR)) {
1089-
Vgpr = VGPRCopies[CopyToVGPR];
1090-
} else {
1087+
auto [It, Inserted] = VGPRCopies.try_emplace(CopyToVGPR);
1088+
Register &Vgpr = It->second;
1089+
if (Inserted) {
10911090
Vgpr = MRI->createVirtualRegister(&AMDGPU::VGPR_32RegClass);
10921091
BuildMI(MBB, UseMI, DL, TII->get(AMDGPU::COPY), Vgpr).add(*Def);
1093-
VGPRCopies[CopyToVGPR] = Vgpr;
10941092
}
10951093
auto Tmp = MRI->createVirtualRegister(&AMDGPU::AGPR_32RegClass);
10961094
BuildMI(MBB, UseMI, DL,

0 commit comments

Comments
 (0)