[PATCH] D158217: [NFCi][MergeFunctions] Consolidate Hashing Functions

Aiden Grossman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 14:07:03 PDT 2023


aidengrossman created this revision.
Herald added subscribers: hoy, ormris, hiraditya.
Herald added a project: All.
aidengrossman requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

A couple years ago, StructuralHash was created, copying the exact
hashing implementation from FunctionComparator (minus a couple small
details/refactorings). Since then, the hashing implementation has not
diverged, but several other areas, like unit testing, have diverged
significantly, with StructuralHash getting more attention in these
areas. This patch aims to consolidate the two hashing functions into
StructuralHash given they do the exact same thing and having less
divergence in areas like unit testing would be beneficial.

The original aim at creating a separate StructuralHash was to make the
implementation divergent and capture additional details like instruction
operands (which neither hashing implementation does currently). The
MergeFunctions pass doesn't need these detaisl, but verification of pass
return values would benefit from this additional data. Setting an option
to calculate these values would allow for divergent behavior where
appropriate while reducing code duplication with little runtime
overhead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158217

Files:
  llvm/include/llvm/IR/StructuralHash.h
  llvm/include/llvm/Transforms/Utils/FunctionComparator.h
  llvm/lib/IR/StructuralHash.cpp
  llvm/lib/Transforms/IPO/MergeFunctions.cpp
  llvm/lib/Transforms/Utils/FunctionComparator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158217.551260.patch
Type: text/x-patch
Size: 8149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230817/98beee29/attachment.bin>


More information about the llvm-commits mailing list