[PATCH] D30767: Updates branch_weights annotation for call instructions during inlining.

Z. Zheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 16 17:45:56 PDT 2017


zzheng added a comment.

If X is Optional, please use X.has_value() to check if it has value and X.getValue() to check for 0 value.



================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:1433
+                              const Instruction *TheCall) {
+  if (!CalleeEntryCount || CalleeEntryCount.getValue() < 1)
+    return;
----------------
Do you mean to use !CalleeEntryCount.has_value()?


================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:1437
+      ProfileSummaryInfo::getProfileCount(TheCall, nullptr);
+  uint64_t CallCount = std::min(CallSiteCount ? CallSiteCount.getValue() : 0,
+                                CalleeEntryCount.getValue());
----------------
I'm confused, do you mean to test if CallSiteCount has no value or it has a value of 0?


================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:1441
+  for (auto const &Entry : VMap)
+    if (isa<CallInst>(Entry.first) && &*Entry.second != nullptr &&
+        isa<CallInst>(Entry.second))
----------------
Isn't it redundant to check ptr != nullptr?

Is there any chance that Entry.second is NULL and what happen on (*Entry.second) in that case?


https://reviews.llvm.org/D30767





More information about the llvm-commits mailing list