Skip to content

Commit

Permalink
ProfDataUtils: Avoid dyn_extract + assert (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
arsenm committed Sep 25, 2024
1 parent 5a03823 commit c71b212
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions llvm/lib/IR/ProfDataUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ bool extractProfTotalWeight(const MDNode *ProfileData, uint64_t &TotalVal) {
if (ProfDataName->getString() == "branch_weights") {
unsigned Offset = getBranchWeightOffset(ProfileData);
for (unsigned Idx = Offset; Idx < ProfileData->getNumOperands(); ++Idx) {
auto *V = mdconst::dyn_extract<ConstantInt>(ProfileData->getOperand(Idx));
assert(V && "Malformed branch_weight in MD_prof node");
auto *V = mdconst::extract<ConstantInt>(ProfileData->getOperand(Idx));
TotalVal += V->getValue().getZExtValue();
}
return true;
Expand Down

0 comments on commit c71b212

Please sign in to comment.