Thanks to visit codestin.com
Credit goes to github.com

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

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 2, 2025

@llvm/pr-subscribers-vectorizers
@llvm/pr-subscribers-backend-spir-v

@llvm/pr-subscribers-llvm-selectiondag

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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;
   }
 }

@llvmbot
Copy link
Member

llvmbot commented May 2, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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;
   }
 }

@llvmbot
Copy link
Member

llvmbot commented May 2, 2025

@llvm/pr-subscribers-backend-risc-v

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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;
   }
 }

@kazutakahirata kazutakahirata merged commit 4ec473e into llvm:main May 2, 2025
17 of 19 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_clang_tidy_readability_redundant_smartptr_get_llvm branch May 2, 2025 15:53
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants