[llvm] 5dd655e - [PowerPC] Avoid repeated hash lookups (NFC) (#132659)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 24 07:47:02 PDT 2025


Author: Kazu Hirata
Date: 2025-03-24T07:46:57-07:00
New Revision: 5dd655e8bfa1aa747597c97f5f5776e2d35a77a4

URL: https://github.com/llvm/llvm-project/commit/5dd655e8bfa1aa747597c97f5f5776e2d35a77a4
DIFF: https://github.com/llvm/llvm-project/commit/5dd655e8bfa1aa747597c97f5f5776e2d35a77a4.diff

LOG: [PowerPC] Avoid repeated hash lookups (NFC) (#132659)

Added: 
    

Modified: 
    llvm/lib/Target/PowerPC/PPCFastISel.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/PowerPC/PPCFastISel.cpp b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
index 9e7185287d291..e92e00f80c552 100644
--- a/llvm/lib/Target/PowerPC/PPCFastISel.cpp
+++ b/llvm/lib/Target/PowerPC/PPCFastISel.cpp
@@ -2263,17 +2263,17 @@ Register PPCFastISel::fastMaterializeConstant(const Constant *C) {
 // Materialize the address created by an alloca into a register, and
 // return the register number (or zero if we failed to handle it).
 Register PPCFastISel::fastMaterializeAlloca(const AllocaInst *AI) {
+  DenseMap<const AllocaInst *, int>::iterator SI =
+      FuncInfo.StaticAllocaMap.find(AI);
+
   // Don't handle dynamic allocas.
-  if (!FuncInfo.StaticAllocaMap.count(AI))
+  if (SI == FuncInfo.StaticAllocaMap.end())
     return Register();
 
   MVT VT;
   if (!isLoadTypeLegal(AI->getType(), VT))
     return Register();
 
-  DenseMap<const AllocaInst*, int>::iterator SI =
-    FuncInfo.StaticAllocaMap.find(AI);
-
   if (SI != FuncInfo.StaticAllocaMap.end()) {
     Register ResultReg = createResultReg(&PPC::G8RC_and_G8RC_NOX0RegClass);
     BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, TII.get(PPC::ADDI8),


        


More information about the llvm-commits mailing list