Skip to content

[llvm] Remove redundant calls to std::unique_ptr<T>::get (NFC) #138236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/GlobalMergeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ checkConstLocationCompatible(const StableFunctionMap::StableFunctionEntry &SF,
std::optional<Constant *> OldConst;
for (auto &Loc : ParamLocs) {
assert(SF.IndexOperandHashMap->count(Loc));
auto CurrHash = SF.IndexOperandHashMap.get()->at(Loc);
auto CurrHash = SF.IndexOperandHashMap->at(Loc);
auto [InstIndex, OpndIndex] = Loc;
assert(InstIndex < IndexInstruction.size());
const auto *Inst = IndexInstruction.lookup(InstIndex);
Expand Down Expand Up @@ -532,7 +532,7 @@ void GlobalMergeFunc::emitFunctionMap(Module &M) {
OS.str(), "in-memory stable function map", false);

Triple TT(M.getTargetTriple());
embedBufferInModule(M, *Buffer.get(),
embedBufferInModule(M, *Buffer,
getCodeGenDataSectionName(CG_merge, TT.getObjectFormat()),
Align(4));
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,7 @@ bool RISCVLoadStoreOpt::tryConvertToLdStPair(
return false;

MachineInstrBuilder MIB = BuildMI(
*MF,
First->getDebugLoc().get() ? First->getDebugLoc() : Second->getDebugLoc(),
*MF, First->getDebugLoc() ? First->getDebugLoc() : Second->getDebugLoc(),
TII->get(PairOpc));
MIB.add(First->getOperand(0))
.add(Second->getOperand(0))
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/SPIRV/SPIRVAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ SPIRVTranslate(Module *M, std::string &SpirvObj, std::string &ErrMsg,
std::unique_ptr<MachineModuleInfoWrapperPass> MMIWP(
new MachineModuleInfoWrapperPass(Target.get()));
const_cast<TargetLoweringObjectFile *>(Target->getObjFileLowering())
->Initialize(MMIWP.get()->getMMI().getContext(), *Target);
->Initialize(MMIWP->getMMI().getContext(), *Target);

SmallString<4096> OutBuffer;
raw_svector_ostream OutStream(OutBuffer);
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ SPIRVSubtarget::SPIRVSubtarget(const Triple &TT, const std::string &CPU,
InlineAsmInfo = std::make_unique<SPIRVInlineAsmLowering>(TLInfo);
Legalizer = std::make_unique<SPIRVLegalizerInfo>(*this);
RegBankInfo = std::make_unique<SPIRVRegisterBankInfo>();
InstSelector.reset(
createSPIRVInstructionSelector(TM, *this, *RegBankInfo.get()));
InstSelector.reset(createSPIRVInstructionSelector(TM, *this, *RegBankInfo));
}

SPIRVSubtarget &SPIRVSubtarget::initSubtargetDependencies(StringRef CPU,
Expand Down
13 changes: 6 additions & 7 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1830,7 +1830,7 @@ class BoUpSLP {
/// Returns the type/is-signed info for the root node in the graph without
/// casting.
std::optional<std::pair<Type *, bool>> getRootNodeTypeWithNoCast() const {
const TreeEntry &Root = *VectorizableTree.front().get();
const TreeEntry &Root = *VectorizableTree.front();
if (Root.State != TreeEntry::Vectorize || Root.isAltShuffle() ||
!Root.Scalars.front()->getType()->isIntegerTy())
return std::nullopt;
Expand Down Expand Up @@ -7507,7 +7507,7 @@ void BoUpSLP::reorderBottomToTop(bool IgnoreReorder) {
assert(Data.first->CombinedEntriesWithIndices.size() == 2 &&
"Expected exactly 2 entries.");
for (const auto &P : Data.first->CombinedEntriesWithIndices) {
TreeEntry &OpTE = *VectorizableTree[P.first].get();
TreeEntry &OpTE = *VectorizableTree[P.first];
OrdersType Order = OpTE.ReorderIndices;
if (Order.empty() || !OpTE.ReuseShuffleIndices.empty()) {
if (!OpTE.isGather() && OpTE.ReuseShuffleIndices.empty())
Expand Down Expand Up @@ -17464,13 +17464,13 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
"Expected exactly 2 combined entries.");
setInsertPointAfterBundle(E);
TreeEntry &OpTE1 =
*VectorizableTree[E->CombinedEntriesWithIndices.front().first].get();
*VectorizableTree[E->CombinedEntriesWithIndices.front().first];
assert(OpTE1.isSame(
ArrayRef(E->Scalars).take_front(OpTE1.getVectorFactor())) &&
"Expected same first part of scalars.");
Value *Op1 = vectorizeTree(&OpTE1);
TreeEntry &OpTE2 =
*VectorizableTree[E->CombinedEntriesWithIndices.back().first].get();
*VectorizableTree[E->CombinedEntriesWithIndices.back().first];
assert(
OpTE2.isSame(ArrayRef(E->Scalars).take_back(OpTE2.getVectorFactor())) &&
"Expected same second part of scalars.");
Expand Down Expand Up @@ -19325,9 +19325,8 @@ BoUpSLP::BlockScheduling::buildBundle(ArrayRef<Value *> VL) {
.first->getSecond()
.push_back(BundlePtr.get());
}
assert(BundlePtr.get() && *BundlePtr.get() &&
"Failed to find schedule bundle");
return *BundlePtr.get();
assert(BundlePtr && *BundlePtr && "Failed to find schedule bundle");
return *BundlePtr;
}

// Groups the instructions to a bundle (which is then a single scheduling entity)
Expand Down
2 changes: 1 addition & 1 deletion llvm/utils/TableGen/DAGISelMatcherOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ static void ContractNodes(std::unique_ptr<Matcher> &InputMatcherPtr,
MatcherPtr = &(MatcherPtr->get()->getNextPtr());

// If we reached the end of the chain, we're done.
if (!MatcherPtr->get())
if (!*MatcherPtr)
return;
}
}
Expand Down