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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 20 21:10:47 PST 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/128130

None

>From ccd74641f0fedcb891a1a4fceda9e91084d9762a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 20 Feb 2025 09:33:31 -0800
Subject: [PATCH] [X86] Avoid repeated hash lookups (NFC)

---
 llvm/lib/Target/X86/X86PreTileConfig.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Target/X86/X86PreTileConfig.cpp b/llvm/lib/Target/X86/X86PreTileConfig.cpp
index 96801636deb9e..e8d90da1fb1e0 100644
--- a/llvm/lib/Target/X86/X86PreTileConfig.cpp
+++ b/llvm/lib/Target/X86/X86PreTileConfig.cpp
@@ -234,9 +234,10 @@ INITIALIZE_PASS_END(X86PreTileConfig, "tilepreconfig",
 void X86PreTileConfig::collectShapeInfo(MachineInstr &MI, unsigned Shapes) {
   auto RecordShape = [&](MachineInstr *MI, MachineBasicBlock *MBB) {
     MIRef MIR(MI, MBB);
-    auto I = llvm::lower_bound(ShapeBBs[MBB], MIR);
-    if (I == ShapeBBs[MBB].end() || *I != MIR)
-      ShapeBBs[MBB].insert(I, MIR);
+    auto &Refs = ShapeBBs[MBB];
+    auto I = llvm::lower_bound(Refs, MIR);
+    if (I == Refs.end() || *I != MIR)
+      Refs.insert(I, MIR);
   };
 
   // All shapes have same row in multi-tile operand.



More information about the llvm-commits mailing list