[llvm-branch-commits] [lld] 74a0c1e - [NFC][ELF][Hexagon] Avoid pointless ArrayRef::drop_front
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 5 01:56:31 PDT 2025
Author: Jessica Clarke
Date: 2025-08-05T10:56:10+02:00
New Revision: 74a0c1e962c04a500f79d2d02b8cdf6c170c2937
URL: https://github.com/llvm/llvm-project/commit/74a0c1e962c04a500f79d2d02b8cdf6c170c2937
DIFF: https://github.com/llvm/llvm-project/commit/74a0c1e962c04a500f79d2d02b8cdf6c170c2937.diff
LOG: [NFC][ELF][Hexagon] Avoid pointless ArrayRef::drop_front
Fixes: b42f96bc057f ("[lld] Add thunks for hexagon (#111217)")
(cherry picked from commit de15d365743e16848a9d15fc32ae6ab98d399ec2)
Added:
Modified:
lld/ELF/Relocations.cpp
Removed:
################################################################################
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index b6c676e294e44..9549cc6f56326 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -2154,9 +2154,8 @@ static int getHexagonPacketOffset(const InputSection &isec,
if (i == 3 || rel.offset < (i + 1) * 4)
return i * 4;
uint32_t instWord = 0;
- const ArrayRef<uint8_t> instWordContents =
- data.drop_front(rel.offset - (i + 1) * 4);
- memcpy(&instWord, instWordContents.data(), sizeof(instWord));
+ memcpy(&instWord, data.data() + (rel.offset - (i + 1) * 4),
+ sizeof(instWord));
if (((instWord & HEXAGON_MASK_END_PACKET) == HEXAGON_END_OF_PACKET) ||
((instWord & HEXAGON_MASK_END_PACKET) == HEXAGON_END_OF_DUPLEX))
return i * 4;
More information about the llvm-branch-commits
mailing list