[PATCH] D66324: clang-misexpect: Profile Guided Validation of Performance Annotations in LLVM

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 29 19:34:37 PDT 2019


leonardchan accepted this revision.
leonardchan added inline comments.


================
Comment at: clang-tools-extra/clang-misexpect/ClangMisExpect.cpp:64
+    break;
+  default:
+    llvm_unreachable("Bad Profile Format given to clang-misexpect use one of "
----------------
Nit: The default and llvm_unreachable aren't needed here since you cover all cases already.


================
Comment at: llvm/lib/IR/MDBuilder.cpp:315
+                                   uint64_t UnlikleyWeight) {
+  auto IntType = Type::getInt64Ty(Context);
+  Metadata *Vals[] = {
----------------
nit: `auto *IntType`


================
Comment at: llvm/lib/Transforms/Utils/MisExpect.cpp:55
+  Instruction *Ret = nullptr;
+  if (auto B = dyn_cast<BranchInst>(I)) {
+    Ret = dyn_cast<Instruction>(B->getCondition());
----------------
nit: `auto *B`


================
Comment at: llvm/lib/Transforms/Utils/MisExpect.cpp:124
+          Weights.begin(), Weights.end(), (uint64_t)0, std::plus<uint64_t>());
+      const int NumUnlikelyTargets = Weights.size() - 1;
+
----------------
nit: `const unsigned NumUnlikelyTargets`


================
Comment at: llvm/lib/Transforms/Utils/MisExpect.cpp:129
+
+      double Percentage = (double)ProfileCount / (double)CaseTotal;
+
----------------
nit: `(double)ProfileCount / CaseTotal`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66324





More information about the llvm-commits mailing list