[llvm] [TargetLibraryInfo] Use std::move (NFC) (PR #95671)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 15 10:28:01 PDT 2024


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

The std::move here saves 0.11% of heap allocations during the
compilation of a large preprocessed file, namely X86ISelLowering.cpp,
for the X86 target.

>From 18d8b08ba473ab417cc5ea738f3ed6f6aa724cba Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 21 Jan 2024 19:29:04 -0800
Subject: [PATCH] [TargetLibraryInfo] Use std::move (NFC)

The std::move here saves 0.11% of heap allocations during the
compilation of a large preprocessed file, namely X86ISelLowering.cpp,
for the X86 target.
---
 llvm/include/llvm/Analysis/TargetLibraryInfo.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Analysis/TargetLibraryInfo.h b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
index f5da222d11f55..b29046a969448 100644
--- a/llvm/include/llvm/Analysis/TargetLibraryInfo.h
+++ b/llvm/include/llvm/Analysis/TargetLibraryInfo.h
@@ -316,7 +316,8 @@ class TargetLibraryInfo {
   // Provide value semantics.
   TargetLibraryInfo(const TargetLibraryInfo &TLI) = default;
   TargetLibraryInfo(TargetLibraryInfo &&TLI)
-      : Impl(TLI.Impl), OverrideAsUnavailable(TLI.OverrideAsUnavailable) {}
+      : Impl(TLI.Impl),
+        OverrideAsUnavailable(std::move(TLI.OverrideAsUnavailable)) {}
   TargetLibraryInfo &operator=(const TargetLibraryInfo &TLI) = default;
   TargetLibraryInfo &operator=(TargetLibraryInfo &&TLI) {
     Impl = TLI.Impl;



More information about the llvm-commits mailing list