[llvm] [LTO] Remove extraneous ArrayRef (NFC) (PR #90306)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 26 18:01:05 PDT 2024


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

We don't need to explicitly create these instances of ArrayRef because
Hasher::update takes ArrayRef, and ArrayRef can be implicitly
constructed from C arrays.


>From 6facbed37656fefe59e72598d21fe9a83b7fdfdd Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Fri, 26 Apr 2024 16:53:22 -0700
Subject: [PATCH] [LTO] Remove extraneous ArrayRef (NFC)

We don't need to explicitly create these instances of ArrayRef because
Hasher::update takes ArrayRef, and ArrayRef can be implicitly
constructed from C arrays.
---
 llvm/lib/LTO/LTO.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 53060df7f503e0..21cad1de0ced57 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -114,12 +114,12 @@ void llvm::computeLTOCacheKey(
   auto AddUnsigned = [&](unsigned I) {
     uint8_t Data[4];
     support::endian::write32le(Data, I);
-    Hasher.update(ArrayRef<uint8_t>{Data, 4});
+    Hasher.update(Data);
   };
   auto AddUint64 = [&](uint64_t I) {
     uint8_t Data[8];
     support::endian::write64le(Data, I);
-    Hasher.update(ArrayRef<uint8_t>{Data, 8});
+    Hasher.update(Data);
   };
   AddString(Conf.CPU);
   // FIXME: Hash more of Options. For now all clients initialize Options from



More information about the llvm-commits mailing list