Skip to content

[TargetLibraryInfo] Use the default move constructor/assignment operator #95685

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

Merged

Conversation

kazutakahirata
Copy link
Contributor

commit ecea837
Author: Kazu Hirata [email protected]
Date: Sat Jun 15 14:02:42 2024 -0700

added std::move to the move constructor and assignment operator, but
we can just use = default to have the compiler to generate them.

As expected, the number of heap allocations is virtually unchanged.

  commit ecea837
  Author: Kazu Hirata <[email protected]>
  Date:   Sat Jun 15 14:02:42 2024 -0700

added std::move to the move constructor and assignment operator, but
we can just use = default to have the compiler to generate them.

As expected, the number of heap allocations is virtually unchanged.
@llvmbot
Copy link
Member

llvmbot commented Jun 16, 2024

@llvm/pr-subscribers-llvm-analysis

Author: Kazu Hirata (kazutakahirata)

Changes

commit ecea837
Author: Kazu Hirata <[email protected]>
Date: Sat Jun 15 14:02:42 2024 -0700

added std::move to the move constructor and assignment operator, but
we can just use = default to have the compiler to generate them.

As expected, the number of heap allocations is virtually unchanged.


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

1 Files Affected:

  • (modified) llvm/include/llvm/Analysis/TargetLibraryInfo.h (+2-8)
diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
index ee19bc816b4e0..37e8bcbcc009e 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
@@ -315,15 +315,9 @@ class TargetLibraryInfo {
 
   // Provide value semantics.
   TargetLibraryInfo(const TargetLibraryInfo &TLI) = default;
-  TargetLibraryInfo(TargetLibraryInfo &&TLI)
-      : Impl(TLI.Impl),
-        OverrideAsUnavailable(std::move(TLI.OverrideAsUnavailable)) {}
+  TargetLibraryInfo(TargetLibraryInfo &&TLI) = default;
   TargetLibraryInfo &operator=(const TargetLibraryInfo &TLI) = default;
-  TargetLibraryInfo &operator=(TargetLibraryInfo &&TLI) {
-    Impl = TLI.Impl;
-    OverrideAsUnavailable = std::move(TLI.OverrideAsUnavailable);
-    return *this;
-  }
+  TargetLibraryInfo &operator=(TargetLibraryInfo &&TLI) = default;
 
   /// Determine whether a callee with the given TLI can be inlined into
   /// caller with this TLI, based on 'nobuiltin' attributes. When requested,

Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kazutakahirata kazutakahirata merged commit a74a86c into llvm:main Jun 16, 2024
7 of 9 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_memory_TargetLibraryInfo branch June 16, 2024 07:25
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