Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Feb 21, 2025

@llvm/pr-subscribers-backend-x86

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/128130.diff

1 Files Affected:

  • (modified) llvm/lib/Target/X86/X86PreTileConfig.cpp (+4-3)
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.

@kazutakahirata kazutakahirata merged commit 8a58f83 into llvm:main Feb 21, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lookups_llvm_X86 branch February 21, 2025 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants