[llvm] [X86] Avoid repeated hash lookups (NFC) (PR #130710)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 11 07:53:14 PDT 2025


================
@@ -293,29 +293,30 @@ bool X86PreTileConfig::runOnMachineFunction(MachineFunction &MF) {
   SmallVector<MachineBasicBlock *, 8> CfgLiveInBBs;
   for (auto &MBB : MF) {
     size_t Pos = 0;
+    auto &Info = BBVisitedInfo[&MBB];
     for (auto &MI : MBB) {
       ++Pos;
       if (isAMXInstruction(MI)) {
         // If there's call before the AMX, we need to reload tile config.
-        if (BBVisitedInfo[&MBB].LastCall)
-          CfgNeedInsert.insert(BBVisitedInfo[&MBB].LastCall);
+        if (Info.LastCall)
+          CfgNeedInsert.insert(Info.LastCall);
         else // Otherwise, we need tile config to live in this BB.
-          BBVisitedInfo[&MBB].NeedTileCfgLiveIn = true;
+          Info.NeedTileCfgLiveIn = true;
         // Always record the first AMX in case there's shape def after it.
-        if (!BBVisitedInfo[&MBB].FirstAMX)
-          BBVisitedInfo[&MBB].FirstAMX = MIRef(&MI, &MBB, Pos);
+        if (!Info.FirstAMX)
+          Info.FirstAMX = MIRef(&MI, &MBB, Pos);
       } else if (MI.isCall() && isDestructiveCall(MI, AMXRegs)) {
         // Record the call only if the callee clobbers all AMX registers.
-        BBVisitedInfo[&MBB].LastCall = MIRef(&MI, &MBB, Pos);
+        Info.LastCall = MIRef(&MI, &MBB, Pos);
       }
     }
-    if (BBVisitedInfo[&MBB].NeedTileCfgLiveIn) {
+    if (Info.NeedTileCfgLiveIn) {
       if (&MBB == &MF.front())
         CfgNeedInsert.insert(MIRef(&MBB));
       else
         CfgLiveInBBs.push_back(&MBB);
     }
-    if (BBVisitedInfo[&MBB].FirstAMX || BBVisitedInfo[&MBB].HasAMXRegLiveIn)
+    if (Info.FirstAMX || Info.HasAMXRegLiveIn)
       for (auto *Succ : MBB.successors())
         if (!isLoopBackEdge(Succ, &MBB))
           BBVisitedInfo[Succ].HasAMXRegLiveIn = true;
----------------
kazutakahirata wrote:

@nikic Fixed.  Thank you for pointing this out!

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


More information about the llvm-commits mailing list