[llvm] [TargetLibraryInfo] Use the default move constructor/assignment operator (PR #95685)

via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 15 19:55:00 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

  commit ecea8371ff03c15fb3dc27ee4108b98335fd2d63
  Author: Kazu Hirata <kazu@<!-- -->google.com>
  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
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,

``````````

</details>


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


More information about the llvm-commits mailing list