[PATCH] D150005: [BOLT] Use opcode name in hashBlock

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 18:54:49 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG6fcb91b2f756: [BOLT] Use opcode name in hashBlock (authored by Amir).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150005/new/

https://reviews.llvm.org/D150005

Files:
  bolt/lib/Core/HashUtilities.cpp


Index: bolt/lib/Core/HashUtilities.cpp
===================================================================
--- bolt/lib/Core/HashUtilities.cpp
+++ bolt/lib/Core/HashUtilities.cpp
@@ -13,6 +13,7 @@
 #include "bolt/Core/HashUtilities.h"
 #include "bolt/Core/BinaryContext.h"
 #include "bolt/Core/BinaryFunction.h"
+#include "llvm/MC/MCInstPrinter.h"
 
 namespace llvm {
 namespace bolt {
@@ -116,13 +117,11 @@
     if (IsX86 && BC.MIB->isConditionalBranch(Inst))
       Opcode = BC.MIB->getShortBranchOpcode(Opcode);
 
-    if (Opcode == 0)
+    if (Opcode == 0) {
       HashString.push_back(0);
-
-    while (Opcode) {
-      uint8_t LSB = Opcode & 0xff;
-      HashString.push_back(LSB);
-      Opcode = Opcode >> 8;
+    } else {
+      StringRef OpcodeName = BC.InstPrinter->getOpcodeName(Opcode);
+      HashString.append(OpcodeName.str());
     }
 
     for (const MCOperand &Op : MCPlus::primeOperands(Inst))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150005.520551.patch
Type: text/x-patch
Size: 915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230509/ae5cf14d/attachment-0001.bin>


More information about the llvm-commits mailing list