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

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 20:56:50 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/113415

None

>From 03c7f879fed25b214abe75899f368cf462bb3686 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 22 Oct 2024 10:33:57 -0700
Subject: [PATCH] [llvm] Remove redundant calls to std::unique_ptr<T>::get
 (NFC)

---
 llvm/lib/CGData/CodeGenData.cpp                |  2 +-
 llvm/lib/CodeGen/MachineOutliner.cpp           |  2 +-
 llvm/lib/Support/TimeProfiler.cpp              |  2 +-
 llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp      |  2 +-
 llvm/unittests/IR/DroppedVariableStatsTest.cpp | 14 +++++++-------
 5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/llvm/lib/CGData/CodeGenData.cpp b/llvm/lib/CGData/CodeGenData.cpp
index c56a8b77a52319..2a3a74c8bc37af 100644
--- a/llvm/lib/CGData/CodeGenData.cpp
+++ b/llvm/lib/CGData/CodeGenData.cpp
@@ -165,7 +165,7 @@ CodeGenData &CodeGenData::getInstance() {
         Instance->publishOutlinedHashTree(Reader->releaseOutlinedHashTree());
     }
   });
-  return *(Instance.get());
+  return *Instance;
 }
 
 namespace IndexedCGData {
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 6006ea7be806b2..2ae6b4f2c64c9b 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -1370,7 +1370,7 @@ void MachineOutliner::emitOutlinedHashTree(Module &M) {
 
     Triple TT(M.getTargetTriple());
     embedBufferInModule(
-        M, *Buffer.get(),
+        M, *Buffer,
         getCodeGenDataSectionName(CG_outline, TT.getObjectFormat()));
   }
 }
diff --git a/llvm/lib/Support/TimeProfiler.cpp b/llvm/lib/Support/TimeProfiler.cpp
index 29c1c97ddf3c52..865a663115e1ed 100644
--- a/llvm/lib/Support/TimeProfiler.cpp
+++ b/llvm/lib/Support/TimeProfiler.cpp
@@ -160,7 +160,7 @@ struct llvm::TimeTraceProfiler {
     if (Stack.empty())
       return;
 
-    Stack.back().get()->InstantEvents.emplace_back(TimeTraceProfilerEntry(
+    Stack.back()->InstantEvents.emplace_back(TimeTraceProfilerEntry(
         ClockType::now(), TimePointType(), std::move(Name), Detail(),
         TimeTraceEventType::InstantEvent));
   }
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
index a367db70627748..e4e1412d7def9b 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp
@@ -191,7 +191,7 @@ class SchedGroup {
   bool allowedByRules(const SUnit *SU,
                       SmallVectorImpl<SchedGroup> &SyncPipe) const {
     for (auto &Rule : Rules) {
-      if (!Rule.get()->apply(SU, Collection, SyncPipe))
+      if (!Rule->apply(SU, Collection, SyncPipe))
         return false;
     }
     return true;
diff --git a/llvm/unittests/IR/DroppedVariableStatsTest.cpp b/llvm/unittests/IR/DroppedVariableStatsTest.cpp
index 63b7b4de1937cb..61f3a87bb355e0 100644
--- a/llvm/unittests/IR/DroppedVariableStatsTest.cpp
+++ b/llvm/unittests/IR/DroppedVariableStatsTest.cpp
@@ -84,7 +84,7 @@ TEST(DroppedVariableStats, BothDeleted) {
                       llvm::Any(const_cast<const llvm::Module *>(M.get())));
 
   // This loop simulates an IR pass that drops debug information.
-  for (auto &F : *M.get()) {
+  for (auto &F : *M) {
     for (auto &I : instructions(&F)) {
       I.dropDbgRecords();
       I.eraseFromParent();
@@ -141,7 +141,7 @@ TEST(DroppedVariableStats, DbgValLost) {
                       llvm::Any(const_cast<const llvm::Module *>(M.get())));
 
   // This loop simulates an IR pass that drops debug information.
-  for (auto &F : *M.get()) {
+  for (auto &F : *M) {
     for (auto &I : instructions(&F)) {
       I.dropDbgRecords();
       break;
@@ -198,7 +198,7 @@ TEST(DroppedVariableStats, UnrelatedScopes) {
                       llvm::Any(const_cast<const llvm::Module *>(M.get())));
 
   // This loop simulates an IR pass that drops debug information.
-  for (auto &F : *M.get()) {
+  for (auto &F : *M) {
     for (auto &I : instructions(&F)) {
       I.dropDbgRecords();
       break;
@@ -255,7 +255,7 @@ TEST(DroppedVariableStats, ChildScopes) {
                       llvm::Any(const_cast<const llvm::Module *>(M.get())));
 
   // This loop simulates an IR pass that drops debug information.
-  for (auto &F : *M.get()) {
+  for (auto &F : *M) {
     for (auto &I : instructions(&F)) {
       I.dropDbgRecords();
       break;
@@ -313,7 +313,7 @@ TEST(DroppedVariableStats, InlinedAt) {
                       llvm::Any(const_cast<const llvm::Module *>(M.get())));
 
   // This loop simulates an IR pass that drops debug information.
-  for (auto &F : *M.get()) {
+  for (auto &F : *M) {
     for (auto &I : instructions(&F)) {
       I.dropDbgRecords();
       break;
@@ -371,7 +371,7 @@ TEST(DroppedVariableStats, InlinedAtShared) {
                       llvm::Any(const_cast<const llvm::Module *>(M.get())));
 
   // This loop simulates an IR pass that drops debug information.
-  for (auto &F : *M.get()) {
+  for (auto &F : *M) {
     for (auto &I : instructions(&F)) {
       I.dropDbgRecords();
       break;
@@ -430,7 +430,7 @@ TEST(DroppedVariableStats, InlinedAtChild) {
                       llvm::Any(const_cast<const llvm::Module *>(M.get())));
 
   // This loop simulates an IR pass that drops debug information.
-  for (auto &F : *M.get()) {
+  for (auto &F : *M) {
     for (auto &I : instructions(&F)) {
       I.dropDbgRecords();
       break;



More information about the llvm-commits mailing list