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

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 18 19:55:31 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-x86

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



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


1 Files Affected:

- (modified) llvm/lib/Target/X86/X86DiscriminateMemOps.cpp (+2-2) 


``````````diff
diff --git a/llvm/lib/Target/X86/X86DiscriminateMemOps.cpp b/llvm/lib/Target/X86/X86DiscriminateMemOps.cpp
index 6c7e6bf041995..bd151a450394a 100644
--- a/llvm/lib/Target/X86/X86DiscriminateMemOps.cpp
+++ b/llvm/lib/Target/X86/X86DiscriminateMemOps.cpp
@@ -113,8 +113,8 @@ bool X86DiscriminateMemOps::runOnMachineFunction(MachineFunction &MF) {
       if (BypassPrefetchInstructions && IsPrefetchOpcode(MI.getDesc().Opcode))
         continue;
       Location Loc = diToLocation(DI);
-      MemOpDiscriminators[Loc] =
-          std::max(MemOpDiscriminators[Loc], DI->getBaseDiscriminator());
+      unsigned &Disc = MemOpDiscriminators[Loc];
+      Disc = std::max(Disc, DI->getBaseDiscriminator());
     }
   }
 

``````````

</details>


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


More information about the llvm-commits mailing list