Skip to content
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

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

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 23, 2024

@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-llvm-ir

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/113415.diff

5 Files Affected:

  • (modified) llvm/lib/CGData/CodeGenData.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/MachineOutliner.cpp (+1-1)
  • (modified) llvm/lib/Support/TimeProfiler.cpp (+1-1)
  • (modified) llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp (+1-1)
  • (modified) llvm/unittests/IR/DroppedVariableStatsTest.cpp (+7-7)
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;

@kazutakahirata kazutakahirata force-pushed the cleanup_001_redundant_get branch from 03c7f87 to 451f28a Compare October 23, 2024 13:34
@kazutakahirata kazutakahirata merged commit 141574b into llvm:main Oct 23, 2024
8 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_redundant_get branch October 23, 2024 17:44
@frobtech frobtech mentioned this pull request Oct 25, 2024
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
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.

3 participants