[PATCH] D113059: [llvm-profgen] Refactor the code of getHashCode

Wenlei He via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 2 16:04:40 PDT 2021


wenlei added inline comments.


================
Comment at: llvm/tools/llvm-profgen/PerfReader.h:342
+  uint64_t getHashCode() override {
+    return hash_value(SampleContextFrames(Context));
+  }
----------------
This will compute hash code every time when we access it, can we do it only once? i.e. keep `HashCode`. same for the probe version.

```
if (!HashCode)
  HashCode = hash_value(SampleContextFrames(Context));
  
return HashCode;

```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113059



More information about the llvm-commits mailing list