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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lto

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

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.


---
Full diff: https://github.com/llvm/llvm-project/pull/90306.diff


1 Files Affected:

- (modified) llvm/lib/LTO/LTO.cpp (+2-2) 


``````````diff
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

``````````

</details>


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


More information about the llvm-commits mailing list