[PATCH] D24144: [CFGPrinter] Display branch weight on the edges
David Li via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 1 11:48:32 PDT 2016
davidxl added a comment.
The problem I see is that people may confuse 'weight' with actual profile count, while in-reality it may not be the case (due to scaling). Perhaps add '(W)' after the number?
================
Comment at: include/llvm/Analysis/CFGPrinter.h:135
@@ +134,3 @@
+ // operand to the metadata node is a name, not a weight.
+ if (WeightsNode->getNumOperands() != TI->getNumSuccessors() + 1)
+ return "";
----------------
A better way to filter:
MDString *MDName = cast<MDString>(WeightsNode>getOperand(0));
if (MDName->getString() != "branch_weights")
return "" ;
https://reviews.llvm.org/D24144
More information about the llvm-commits
mailing list