[PATCH] D23149: Printing imported functions size
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 4 15:07:16 PDT 2016
tejohnson added inline comments.
================
Comment at: include/llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h:82
@@ -80,1 +81,3 @@
+ /// not imported function.
+ int NumberOfInstructions = 0;
};
----------------
Need to clarify with either comment or name that this is the number of instructions recorded in the summary (i.e. it may have changed by this point which is why we don't recompute here).
================
Comment at: lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp:28
@@ +27,3 @@
+ const auto &C = cast<ConstantAsMetadata>(*Node->getOperand(0));
+ return C.getValue()->getUniqueInteger().getLimitedValue() ;
+}
----------------
Looks like the standard way to get an integer metadata is using mdconst::extract. E.g. from Value.cpp:
if (MDNode *MD = LI->getMetadata(LLVMContext::MD_align)) {
ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
Align = CI->getLimitedValue();
}
================
Comment at: lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp:139
@@ +138,3 @@
+ if (Val.Imported)
+ Ostream << ", number_of_instructions = " << Val.NumberOfInstructions;
+ Ostream << "\n";
----------------
"#instructions per summary"?
https://reviews.llvm.org/D23149
More information about the llvm-commits
mailing list