[PATCH] D13218: Mark BB as annotated if its weight is > 0

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 21:20:32 PDT 2015


danielcdh added inline comments.

================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:242
@@ -241,3 +241,3 @@
 /// \returns The computed weight of BB.
 unsigned SampleProfileLoader::getBlockWeight(BasicBlock *BB) {
   // If we've computed BB's weight before, return it.
----------------
davidxl wrote:
> I think it is clearer to rename this method 'setBlockWeight' -- what it does is to read from the samples and set the cached weight for BB and mark it as annotated.
In another patch http://reviews.llvm.org/D13231, I changed getBlockWeight as a const member function and removed the caching (because there is no reuse), and move the setting of BlockWeights outside this function.

================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:486
@@ -483,3 +485,3 @@
       if (NumUnknownEdges <= 1) {
         unsigned &BBWeight = BlockWeights[BB];
         if (NumUnknownEdges == 0) {
----------------
davidxl wrote:
> Should use annotated EC's weight.
That's correct. I'll have a separate patch to fix the EC's propagation.


http://reviews.llvm.org/D13218





More information about the llvm-commits mailing list