diff options
author | Kazu Hirata <kazu@google.com> | 2022-06-25 11:55:57 -0700 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-06-25 11:55:57 -0700 |
commit | aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d (patch) | |
tree | d207b35cfb445636f41204bcfe51f6ca3a94a3ba /llvm/lib/IR/Instructions.cpp | |
parent | b8df4093e4d82c67a419911a46b63482043643e5 (diff) | |
download | llvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.zip llvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.tar.gz llvm-aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.tar.bz2 |
Don't use Optional::hasValue (NFC)
Diffstat (limited to 'llvm/lib/IR/Instructions.cpp')
-rw-r--r-- | llvm/lib/IR/Instructions.cpp | 13 |
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() && |