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

via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 00:25:05 PDT 2024


Author: Kazu Hirata
Date: 2024-06-16T00:25:02-07:00
New Revision: a74a86cd4b301959f8f57a22aa33a7152143bb7f

URL: https://github.com/llvm/llvm-project/commit/a74a86cd4b301959f8f57a22aa33a7152143bb7f
DIFF: https://github.com/llvm/llvm-project/commit/a74a86cd4b301959f8f57a22aa33a7152143bb7f.diff

LOG: [TargetLibraryInfo] Use the default move constructor/assignment operator (#95685)

commit ecea8371ff03c15fb3dc27ee4108b98335fd2d63
  Author: Kazu Hirata <kazu at 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.

Added: 
    

Modified: 
    llvm/include/llvm/Analysis/TargetLibraryInfo.h

Removed: 
    


################################################################################
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,


        


More information about the llvm-commits mailing list