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

David Li via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 20:51:16 PDT 2015


davidxl 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.
----------------
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.

================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:486
@@ -483,3 +485,3 @@
       if (NumUnknownEdges <= 1) {
         unsigned &BBWeight = BlockWeights[BB];
         if (NumUnknownEdges == 0) {
----------------
Should use annotated EC's weight.

================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:580
@@ -577,3 +579,3 @@
   unsigned i = 0;
 
   // Add an entry count to the function using the samples gathered
----------------
There seems to be a missing step to propagate weights from annotated BBs to their equivalence classes -- the later should be used in Edge propagation


http://reviews.llvm.org/D13218





More information about the llvm-commits mailing list