[PATCH] D122819: [FuncSpec] Cache code metrics for analyzed functions.

Chuanqi Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 19:01:26 PDT 2022


ChuanqiXu accepted this revision.
ChuanqiXu added a comment.
This revision is now accepted and ready to land.

LGTM basically. Only suggestions on nit. 
And I suggest the title should contain one `[NFC]` tag.



================
Comment at: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp:543-546
+    auto I = FunctionMetrics.insert({F, CodeMetrics()});
+    CodeMetrics &Metrics = I.first->second;
+    if (I.second)
+      analyzeFunction(F);
----------------
The implementation should be right but it didn't implement in the usual style so that readers might be slightly confused at the first sight. I suggest:

---

The implementation for `analyzeFunction` might need to be changed slightly too: it need to an assertion to check F is not cached and insert the result to FunctionMetrics.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122819



More information about the llvm-commits mailing list