[llvm] [PowerPC] Avoid repeated hash lookups (NFC) (PR #131724)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 17 21:00:37 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-powerpc

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/131724.diff


1 Files Affected:

- (modified) llvm/lib/Target/PowerPC/PPCFrameLowering.cpp (+6-5) 


``````````diff
diff --git a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
index f62434d57dcd3..429994e09cc5c 100644
--- a/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
@@ -2489,22 +2489,23 @@ bool PPCFrameLowering::spillCalleeSavedRegisters(
         if (Spilled[Dst])
           continue;
 
-        if (VSRContainingGPRs[Dst].second != 0) {
+        auto &VSR = VSRContainingGPRs[Dst];
+        if (VSR.second != 0) {
           assert(Subtarget.hasP9Vector() &&
                  "mtvsrdd is unavailable on pre-P9 targets.");
 
           NumPESpillVSR += 2;
           BuildMI(MBB, MI, DL, TII.get(PPC::MTVSRDD), Dst)
-              .addReg(VSRContainingGPRs[Dst].first, getKillRegState(true))
-              .addReg(VSRContainingGPRs[Dst].second, getKillRegState(true));
-        } else if (VSRContainingGPRs[Dst].second == 0) {
+              .addReg(VSR.first, getKillRegState(true))
+              .addReg(VSR.second, getKillRegState(true));
+        } else if (VSR.second == 0) {
           assert(Subtarget.hasP8Vector() &&
                  "Can't move GPR to VSR on pre-P8 targets.");
 
           ++NumPESpillVSR;
           BuildMI(MBB, MI, DL, TII.get(PPC::MTVSRD),
                   TRI->getSubReg(Dst, PPC::sub_64))
-              .addReg(VSRContainingGPRs[Dst].first, getKillRegState(true));
+              .addReg(VSR.first, getKillRegState(true));
         } else {
           llvm_unreachable("More than two GPRs spilled to a VSR!");
         }

``````````

</details>


https://github.com/llvm/llvm-project/pull/131724


More information about the llvm-commits mailing list