Skip to content

Commit 4ec473e

Browse files
[llvm] Remove redundant calls to std::unique_ptr<T>::get (NFC) (#138236)
1 parent d6dbe77 commit 4ec473e

File tree

6 files changed

+12
-15
lines changed

6 files changed

+12
-15
lines changed

llvm/lib/CodeGen/GlobalMergeFunctions.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ checkConstLocationCompatible(const StableFunctionMap::StableFunctionEntry &SF,
328328
std::optional<Constant *> OldConst;
329329
for (auto &Loc : ParamLocs) {
330330
assert(SF.IndexOperandHashMap->count(Loc));
331-
auto CurrHash = SF.IndexOperandHashMap.get()->at(Loc);
331+
auto CurrHash = SF.IndexOperandHashMap->at(Loc);
332332
auto [InstIndex, OpndIndex] = Loc;
333333
assert(InstIndex < IndexInstruction.size());
334334
const auto *Inst = IndexInstruction.lookup(InstIndex);
@@ -532,7 +532,7 @@ void GlobalMergeFunc::emitFunctionMap(Module &M) {
532532
OS.str(), "in-memory stable function map", false);
533533

534534
Triple TT(M.getTargetTriple());
535-
embedBufferInModule(M, *Buffer.get(),
535+
embedBufferInModule(M, *Buffer,
536536
getCodeGenDataSectionName(CG_merge, TT.getObjectFormat()),
537537
Align(4));
538538
}

llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ bool RISCVLoadStoreOpt::tryConvertToLdStPair(
185185
return false;
186186

187187
MachineInstrBuilder MIB = BuildMI(
188-
*MF,
189-
First->getDebugLoc().get() ? First->getDebugLoc() : Second->getDebugLoc(),
188+
*MF, First->getDebugLoc() ? First->getDebugLoc() : Second->getDebugLoc(),
190189
TII->get(PairOpc));
191190
MIB.add(First->getOperand(0))
192191
.add(Second->getOperand(0))

llvm/lib/Target/SPIRV/SPIRVAPI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ SPIRVTranslate(Module *M, std::string &SpirvObj, std::string &ErrMsg,
124124
std::unique_ptr<MachineModuleInfoWrapperPass> MMIWP(
125125
new MachineModuleInfoWrapperPass(Target.get()));
126126
const_cast<TargetLoweringObjectFile *>(Target->getObjFileLowering())
127-
->Initialize(MMIWP.get()->getMMI().getContext(), *Target);
127+
->Initialize(MMIWP->getMMI().getContext(), *Target);
128128

129129
SmallString<4096> OutBuffer;
130130
raw_svector_ostream OutStream(OutBuffer);

llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ SPIRVSubtarget::SPIRVSubtarget(const Triple &TT, const std::string &CPU,
9292
InlineAsmInfo = std::make_unique<SPIRVInlineAsmLowering>(TLInfo);
9393
Legalizer = std::make_unique<SPIRVLegalizerInfo>(*this);
9494
RegBankInfo = std::make_unique<SPIRVRegisterBankInfo>();
95-
InstSelector.reset(
96-
createSPIRVInstructionSelector(TM, *this, *RegBankInfo.get()));
95+
InstSelector.reset(createSPIRVInstructionSelector(TM, *this, *RegBankInfo));
9796
}
9897

9998
SPIRVSubtarget &SPIRVSubtarget::initSubtargetDependencies(StringRef CPU,

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ class BoUpSLP {
18301830
/// Returns the type/is-signed info for the root node in the graph without
18311831
/// casting.
18321832
std::optional<std::pair<Type *, bool>> getRootNodeTypeWithNoCast() const {
1833-
const TreeEntry &Root = *VectorizableTree.front().get();
1833+
const TreeEntry &Root = *VectorizableTree.front();
18341834
if (Root.State != TreeEntry::Vectorize || Root.isAltShuffle() ||
18351835
!Root.Scalars.front()->getType()->isIntegerTy())
18361836
return std::nullopt;
@@ -7507,7 +7507,7 @@ void BoUpSLP::reorderBottomToTop(bool IgnoreReorder) {
75077507
assert(Data.first->CombinedEntriesWithIndices.size() == 2 &&
75087508
"Expected exactly 2 entries.");
75097509
for (const auto &P : Data.first->CombinedEntriesWithIndices) {
7510-
TreeEntry &OpTE = *VectorizableTree[P.first].get();
7510+
TreeEntry &OpTE = *VectorizableTree[P.first];
75117511
OrdersType Order = OpTE.ReorderIndices;
75127512
if (Order.empty() || !OpTE.ReuseShuffleIndices.empty()) {
75137513
if (!OpTE.isGather() && OpTE.ReuseShuffleIndices.empty())
@@ -17464,13 +17464,13 @@ Value *BoUpSLP::vectorizeTree(TreeEntry *E) {
1746417464
"Expected exactly 2 combined entries.");
1746517465
setInsertPointAfterBundle(E);
1746617466
TreeEntry &OpTE1 =
17467-
*VectorizableTree[E->CombinedEntriesWithIndices.front().first].get();
17467+
*VectorizableTree[E->CombinedEntriesWithIndices.front().first];
1746817468
assert(OpTE1.isSame(
1746917469
ArrayRef(E->Scalars).take_front(OpTE1.getVectorFactor())) &&
1747017470
"Expected same first part of scalars.");
1747117471
Value *Op1 = vectorizeTree(&OpTE1);
1747217472
TreeEntry &OpTE2 =
17473-
*VectorizableTree[E->CombinedEntriesWithIndices.back().first].get();
17473+
*VectorizableTree[E->CombinedEntriesWithIndices.back().first];
1747417474
assert(
1747517475
OpTE2.isSame(ArrayRef(E->Scalars).take_back(OpTE2.getVectorFactor())) &&
1747617476
"Expected same second part of scalars.");
@@ -19325,9 +19325,8 @@ BoUpSLP::BlockScheduling::buildBundle(ArrayRef<Value *> VL) {
1932519325
.first->getSecond()
1932619326
.push_back(BundlePtr.get());
1932719327
}
19328-
assert(BundlePtr.get() && *BundlePtr.get() &&
19329-
"Failed to find schedule bundle");
19330-
return *BundlePtr.get();
19328+
assert(BundlePtr && *BundlePtr && "Failed to find schedule bundle");
19329+
return *BundlePtr;
1933119330
}
1933219331

1933319332
// Groups the instructions to a bundle (which is then a single scheduling entity)

llvm/utils/TableGen/DAGISelMatcherOpt.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ static void ContractNodes(std::unique_ptr<Matcher> &InputMatcherPtr,
314314
MatcherPtr = &(MatcherPtr->get()->getNextPtr());
315315

316316
// If we reached the end of the chain, we're done.
317-
if (!MatcherPtr->get())
317+
if (!*MatcherPtr)
318318
return;
319319
}
320320
}

0 commit comments

Comments
 (0)