diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2018-04-12 19:48:05 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2018-04-12 19:48:05 +0000 |
commit | 85fc4c327a438e43283b6f77fce37518dfb26097 (patch) | |
tree | 36803e44ea289b05f6f159c048251f8ca8357125 | |
parent | 8b74db9cc7387f1c18db74a737541b0e5025896a (diff) | |
download | bcm5719-llvm-85fc4c327a438e43283b6f77fce37518dfb26097.tar.gz bcm5719-llvm-85fc4c327a438e43283b6f77fce37518dfb26097.zip |
Simplify; NFCI
llvm-svn: 329943
-rw-r--r-- | llvm/lib/IR/ProfileSummary.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/llvm/lib/IR/ProfileSummary.cpp b/llvm/lib/IR/ProfileSummary.cpp index 2b24d125112..6635d4cfc7b 100644 --- a/llvm/lib/IR/ProfileSummary.cpp +++ b/llvm/lib/IR/ProfileSummary.cpp @@ -69,18 +69,16 @@ Metadata *ProfileSummary::getDetailedSummaryMD(LLVMContext &Context) { // "SampleProfile"). The rest of the elements of the outer MDTuple are specific // to the kind of profile summary as returned by getFormatSpecificMD. Metadata *ProfileSummary::getMD(LLVMContext &Context) { - std::vector<Metadata *> Components; - Components.push_back(getKeyValMD(Context, "ProfileFormat", KindStr[PSK])); - - Components.push_back(getKeyValMD(Context, "TotalCount", getTotalCount())); - Components.push_back(getKeyValMD(Context, "MaxCount", getMaxCount())); - Components.push_back( - getKeyValMD(Context, "MaxInternalCount", getMaxInternalCount())); - Components.push_back( - getKeyValMD(Context, "MaxFunctionCount", getMaxFunctionCount())); - Components.push_back(getKeyValMD(Context, "NumCounts", getNumCounts())); - Components.push_back(getKeyValMD(Context, "NumFunctions", getNumFunctions())); - Components.push_back(getDetailedSummaryMD(Context)); + Metadata *Components[] = { + getKeyValMD(Context, "ProfileFormat", KindStr[PSK]), + getKeyValMD(Context, "TotalCount", getTotalCount()), + getKeyValMD(Context, "MaxCount", getMaxCount()), + getKeyValMD(Context, "MaxInternalCount", getMaxInternalCount()), + getKeyValMD(Context, "MaxFunctionCount", getMaxFunctionCount()), + getKeyValMD(Context, "NumCounts", getNumCounts()), + getKeyValMD(Context, "NumFunctions", getNumFunctions()), + getDetailedSummaryMD(Context), + }; return MDTuple::get(Context, Components); } @@ -144,12 +142,8 @@ static bool getSummaryFromMD(MDTuple *MD, SummaryEntryVector &Summary) { } ProfileSummary *ProfileSummary::getFromMD(Metadata *MD) { - if (!MD) - return nullptr; - if (!isa<MDTuple>(MD)) - return nullptr; - MDTuple *Tuple = cast<MDTuple>(MD); - if (Tuple->getNumOperands() != 8) + MDTuple *Tuple = dyn_cast_or_null<MDTuple>(MD); + if (!Tuple || Tuple->getNumOperands() != 8) return nullptr; auto &FormatMD = Tuple->getOperand(0); |