[PATCH] D66029: llvm-canon

Michal Paszkowski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 2 13:46:25 PDT 2020


mpaszkowski marked 12 inline comments as done.
mpaszkowski added a comment.

Thank you @plotfi for review! I will update the diff in a second.



================
Comment at: llvm/include/llvm/Transforms/Utils/IRCanonicalizer.h:61
+  // Random constant for hashing, so the state isn't zero.
+  const uint64_t MagicHashConstant = 0x6acaa36bef8325c5ULL;
+
----------------
plotfi wrote:
> Is there any significance of this magic number? Can you either set this by a cl::opt or generated at runtime  (maybe something using srand (time(NULL))) ? 
> 
There is no significance in this particular number but it needs to be consistent among all canonicalized modules (so this shouldn't be set by cl::opt or randomly generated). I have used particularly this number since it has been used in many other places in LLVM, for example [[ https://github.com/llvm/llvm-project/blob/60e9ee16b4a44166e5ceda44acb16f098b19cab4/llvm/lib/Transforms/Utils/FunctionComparator.cpp#L921 | here ]].


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

https://reviews.llvm.org/D66029





More information about the llvm-commits mailing list