[PATCH] D120121: [StableHashing] Hash vregs with multiple defs

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 21 02:39:07 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9a547e7009f7: [StableHashing] Hash vregs with multiple defs (authored by foad).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120121

Files:
  llvm/lib/CodeGen/MachineStableHash.cpp


Index: llvm/lib/CodeGen/MachineStableHash.cpp
===================================================================
--- llvm/lib/CodeGen/MachineStableHash.cpp
+++ llvm/lib/CodeGen/MachineStableHash.cpp
@@ -64,7 +64,10 @@
   case MachineOperand::MO_Register:
     if (Register::isVirtualRegister(MO.getReg())) {
       const MachineRegisterInfo &MRI = MO.getParent()->getMF()->getRegInfo();
-      return MRI.getVRegDef(MO.getReg())->getOpcode();
+      SmallVector<unsigned> DefOpcodes;
+      for (auto &Def : MRI.def_instructions(MO.getReg()))
+        DefOpcodes.push_back(Def.getOpcode());
+      return hash_combine_range(DefOpcodes.begin(), DefOpcodes.end());
     }
 
     // Register operands don't have target flags.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120121.410258.patch
Type: text/x-patch
Size: 724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220221/021d6bc8/attachment.bin>


More information about the llvm-commits mailing list