[PATCH] D117614: [lld][ELF] Add support for ADRP+ADD optimization for AArch64

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 18 14:43:19 PST 2022


alexander-shaposhnikov created this revision.
alexander-shaposhnikov added reviewers: peter.smith, MaskRay.
alexander-shaposhnikov created this object with visibility "All Users".
alexander-shaposhnikov added a project: lld.
Herald added subscribers: kristof.beyls, arichardson, emaste.
alexander-shaposhnikov requested review of this revision.
Herald added a project: LLVM.

This diff adds support for ADRP+ADD optimization for AArch64
described in https://github.com/ARM-software/abi-aa/commit/d2ca58c54b8e955cfef25c71822f837ae0439d73 
i.e. under appropriate constraints

  ADRP  x0, symbol                        // R_<CLS>_ADR_PREL_PG_HI21
  ADD   x0, x0, :lo12: symbol        // R_<CLS>_ADD_ABS_LO12_NC

can be turned into

  NOP
  ADR   x0, symbol                         // R_<CLS>_ADR_PREL_LO21

Test plan: make check-all


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117614

Files:
  lld/ELF/Arch/AArch64.cpp
  lld/ELF/InputSection.cpp
  lld/ELF/Target.h
  lld/test/ELF/aarch64-adrp-add.s
  lld/test/ELF/aarch64-adrp-ldr-got.s
  lld/test/ELF/aarch64-copy.s
  lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117614.400995.patch
Type: text/x-patch
Size: 9526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220118/dcf64672/attachment.bin>


More information about the llvm-commits mailing list