[llvm] [llvm] Remove redundant calls to std::unique_ptr<T>::get (NFC) (PR #138236)
via llvm-commits
llvm-commits at lists.llvm.org
Thu May 1 23:54:57 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/138236.diff
6 Files Affected:
- (modified) llvm/lib/CodeGen/GlobalMergeFunctions.cpp (+2-2)
- (modified) llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp (+1-2)
- (modified) llvm/lib/Target/SPIRV/SPIRVAPI.cpp (+1-1)
- (modified) llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp (+1-2)
- (modified) llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp (+6-7)
- (modified) llvm/utils/TableGen/DAGISelMatcherOpt.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/CodeGen/GlobalMergeFunctions.cpp b/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
index d4c53e79ed2e1..9f1eb4b24772f 100644
--- a/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
+++ b/llvm/lib/CodeGen/GlobalMergeFunctions.cpp
@@ -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);
@@ -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));
}
diff --git a/llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp
index 46fd3158e07ca..9097fb538799c 100644
--- a/llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp
@@ -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))
diff --git a/llvm/lib/Target/SPIRV/SPIRVAPI.cpp b/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
index 145285a31dc10..b6d4bbf60d0db 100644
--- a/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVAPI.cpp
@@ -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);
diff --git a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
index 236a1272bcebb..8ad4a39937aa1 100644
--- a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
@@ -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,
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 5df38bc96fc9c..6e8e1670db952 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -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;
@@ -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())
@@ -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.");
@@ -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)
diff --git a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
index 9028a60027ffe..05bca75bcd4ef 100644
--- a/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherOpt.cpp
@@ -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;
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/138236
More information about the llvm-commits
mailing list