[llvm] [memprof] Simplify IndexedMemProfRecord::operator== (NFC) (PR #88986)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 14:05:48 PDT 2024


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

llvm::SmallVector::operator== exactly meets our needs.


>From db5e7cb486c13895c28c2f3df4b21325d67f269f Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Tue, 16 Apr 2024 13:58:12 -0700
Subject: [PATCH] [memprof] Simplify IndexedMemProfRecord::operator== (NFC)

llvm::SmallVector::operator== exactly meets our needs.
---
 llvm/include/llvm/ProfileData/MemProf.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/llvm/include/llvm/ProfileData/MemProf.h b/llvm/include/llvm/ProfileData/MemProf.h
index d43fb1c93bb8ef..7f3956bd739390 100644
--- a/llvm/include/llvm/ProfileData/MemProf.h
+++ b/llvm/include/llvm/ProfileData/MemProf.h
@@ -370,14 +370,9 @@ struct IndexedMemProfRecord {
   size_t serializedSize(IndexedVersion Version) const;
 
   bool operator==(const IndexedMemProfRecord &Other) const {
-    if (Other.AllocSites.size() != AllocSites.size())
+    if (Other.AllocSites != AllocSites)
       return false;
 
-    for (size_t I = 0; I < AllocSites.size(); I++) {
-      if (AllocSites[I] != Other.AllocSites[I])
-        return false;
-    }
-
     if (Other.CallSiteIds != CallSiteIds)
       return false;
     return true;



More information about the llvm-commits mailing list