aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Instructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r--llvm/lib/IR/Instructions.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index 22e8ca7..7e718ac 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -4423,10 +4423,9 @@ MDNode *SwitchInstProfUpdateWrapper::buildProfBranchWeightsMD() {
assert(SI.getNumSuccessors() == Weights->size() &&
"num of prof branch_weights must accord with num of successors");
- bool AllZeroes =
- all_of(Weights.getValue(), [](uint32_t W) { return W == 0; });
+ bool AllZeroes = all_of(*Weights, [](uint32_t W) { return W == 0; });
- if (AllZeroes || Weights.getValue().size() < 2)
+ if (AllZeroes || Weights->size() < 2)
return nullptr;
return MDBuilder(SI.getParent()->getContext()).createBranchWeights(*Weights);
@@ -4460,8 +4459,8 @@ SwitchInstProfUpdateWrapper::removeCase(SwitchInst::CaseIt I) {
// Copy the last case to the place of the removed one and shrink.
// This is tightly coupled with the way SwitchInst::removeCase() removes
// the cases in SwitchInst::removeCase(CaseIt).
- Weights.getValue()[I->getCaseIndex() + 1] = Weights.getValue().back();
- Weights.getValue().pop_back();
+ Weights.value()[I->getCaseIndex() + 1] = Weights->back();
+ Weights->pop_back();
}
return SI.removeCase(I);
}
@@ -4474,10 +4473,10 @@ void SwitchInstProfUpdateWrapper::addCase(
if (!Weights && W && *W) {
Changed = true;
Weights = SmallVector<uint32_t, 8>(SI.getNumSuccessors(), 0);
- Weights.getValue()[SI.getNumSuccessors() - 1] = *W;
+ Weights.value()[SI.getNumSuccessors() - 1] = *W;
} else if (Weights) {
Changed = true;
- Weights.getValue().push_back(W.value_or(0));
+ Weights->push_back(W.value_or(0));
}
if (Weights)
assert(SI.getNumSuccessors() == Weights->size() &&