[all-commits] [llvm/llvm-project] 28134a: [NFCi][MergeFunctions] Consolidate Hashing Functions

Aiden Grossman via All-commits all-commits at lists.llvm.org
Fri Aug 18 13:19:32 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 28134a29fdedd8972acdfb39223571ddcc15dc59
      https://github.com/llvm/llvm-project/commit/28134a29fdedd8972acdfb39223571ddcc15dc59
  Author: Aiden Grossman <agrossman154 at yahoo.com>
  Date:   2023-08-18 (Fri, 18 Aug 2023)

  Changed paths:
    M llvm/include/llvm/IR/StructuralHash.h
    M llvm/include/llvm/Transforms/Utils/FunctionComparator.h
    M llvm/lib/IR/StructuralHash.cpp
    M llvm/lib/Transforms/IPO/MergeFunctions.cpp
    M llvm/lib/Transforms/Utils/FunctionComparator.cpp

  Log Message:
  -----------
  [NFCi][MergeFunctions] Consolidate Hashing Functions

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.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D158217




More information about the All-commits mailing list