[llvm] 47656dc - [X86] Avoid repeated hash lookups (NFC) (#128464)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 01:00:10 PST 2025


Author: Kazu Hirata
Date: 2025-02-24T01:00:05-08:00
New Revision: 47656dc765aabed8079c650261a79a7e85c4370c

URL: https://github.com/llvm/llvm-project/commit/47656dc765aabed8079c650261a79a7e85c4370c
DIFF: https://github.com/llvm/llvm-project/commit/47656dc765aabed8079c650261a79a7e85c4370c.diff

LOG: [X86] Avoid repeated hash lookups (NFC) (#128464)

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86FastPreTileConfig.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86FastPreTileConfig.cpp b/llvm/lib/Target/X86/X86FastPreTileConfig.cpp
index 4486a1cae782c..d3c239250943e 100644
--- a/llvm/lib/Target/X86/X86FastPreTileConfig.cpp
+++ b/llvm/lib/Target/X86/X86FastPreTileConfig.cpp
@@ -362,7 +362,8 @@ void X86FastPreTileConfig::convertPHI(MachineBasicBlock *MBB,
     MachineBasicBlock::iterator InsertPos;
     if (TileDefMI->isPHI()) {
       InsertPos = TileDefMI->getParent()->getFirstNonPHI();
-      if (VisitedPHIs.count(TileDefMI)) { // circular phi reference
+      if (auto It = VisitedPHIs.find(TileDefMI);
+          It != VisitedPHIs.end()) { // circular phi reference
         //        def t1
         //       /       \
         //  def t2       t3 = phi(t1, t4) <--
@@ -372,9 +373,9 @@ void X86FastPreTileConfig::convertPHI(MachineBasicBlock *MBB,
         // For each (row, column and stack address) append phi incoming value.
         // Create r3 = phi(r1, r4)
         // Create r4 = phi(r2, r3)
-        Register InRowReg = VisitedPHIs[TileDefMI].Row;
-        Register InColReg = VisitedPHIs[TileDefMI].Col;
-        Register InStackAddrReg = VisitedPHIs[TileDefMI].StackAddr;
+        Register InRowReg = It->second.Row;
+        Register InColReg = It->second.Col;
+        Register InStackAddrReg = It->second.StackAddr;
         RowPHI.addReg(InRowReg).addMBB(InMBB);
         ColPHI.addReg(InColReg).addMBB(InMBB);
         AddrPHI.addReg(InStackAddrReg).addMBB(InMBB);


        


More information about the llvm-commits mailing list