[PATCH] D22744: CodeExtractor : Add ability to preserve profile data.

David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 17:02:36 PDT 2016


davidxl added inline comments.

================
Comment at: lib/Transforms/Utils/CodeExtractor.cpp:693
@@ +692,3 @@
+  for (auto &Weight : ExitWeights) {
+    if (Weight.second.getFrequency() == 0) {
+      HasValidWeights = false;
----------------
rriddle wrote:
> rriddle wrote:
> > davidxl wrote:
> > > This check does not look correct. It is possible for the frequency to be zero
> > Yeah, that was my understanding. Thanks for the sanity check! I need to add the weights without using the current methods given that they do not allow for weights of 0.
> Although, can you help clarify on what I should be doing in the case of a 0 frequency? I am unsure on whether the branch weight can be set to a hard 0 or if it needs to be modified to always have a non zero weight? 
zero weight is fine -- BFI will always adds 1 to it if it sees it due to some limitation (it is less than ideal -- a better way to is to fix BPI (which will be fixed in the near future).

One the other hand if the total weight is zero, you may want to treat it as invalid.


https://reviews.llvm.org/D22744





More information about the llvm-commits mailing list