[llvm] 46f5662 - [Hexagon] Avoid repeated map lookups (NFC) (#126185)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 07:58:54 PST 2025


Author: Kazu Hirata
Date: 2025-02-07T07:58:49-08:00
New Revision: 46f5662ebc461c897d7aa59b182e4cce29af7368

URL: https://github.com/llvm/llvm-project/commit/46f5662ebc461c897d7aa59b182e4cce29af7368
DIFF: https://github.com/llvm/llvm-project/commit/46f5662ebc461c897d7aa59b182e4cce29af7368.diff

LOG: [Hexagon] Avoid repeated map lookups (NFC) (#126185)

Added: 
    

Modified: 
    llvm/lib/Target/Hexagon/HexagonMachineFunctionInfo.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/Hexagon/HexagonMachineFunctionInfo.h b/llvm/lib/Target/Hexagon/HexagonMachineFunctionInfo.h
index cb4a7a8c393fcd4..c5df02fa3b89cb4 100644
--- a/llvm/lib/Target/Hexagon/HexagonMachineFunctionInfo.h
+++ b/llvm/lib/Target/Hexagon/HexagonMachineFunctionInfo.h
@@ -70,12 +70,12 @@ class HexagonMachineFunctionInfo : public MachineFunctionInfo {
     PacketInfo[MI] |= Hexagon::EndPacket;
   }
   bool isStartPacket(const MachineInstr* MI) const {
-    return (PacketInfo.count(MI) &&
-            (PacketInfo.find(MI)->second & Hexagon::StartPacket));
+    auto It = PacketInfo.find(MI);
+    return It != PacketInfo.end() && (It->second & Hexagon::StartPacket);
   }
   bool isEndPacket(const MachineInstr* MI) const {
-    return (PacketInfo.count(MI) &&
-            (PacketInfo.find(MI)->second & Hexagon::EndPacket));
+    auto It = PacketInfo.find(MI);
+    return It != PacketInfo.end() && (It->second & Hexagon::EndPacket);
   }
   void setHasClobberLR(bool v) { HasClobberLR = v;  }
   bool hasClobberLR() const { return HasClobberLR; }


        


More information about the llvm-commits mailing list