[all-commits] [llvm/llvm-project] ae23a3: [lld][LoongArch] GOT indirection to PC relative op...

Zhaoxin Yang via All-commits all-commits at lists.llvm.org
Tue May 13 21:09:49 PDT 2025


  Branch: refs/heads/users/ylzsx/r-got-to-pcrel
  Home:   https://github.com/llvm/llvm-project
  Commit: ae23a3d336aaf825cb6b2b47cd79f4e9c0703c3b
      https://github.com/llvm/llvm-project/commit/ae23a3d336aaf825cb6b2b47cd79f4e9c0703c3b
  Author: yangzhaoxin <yangzhaoxin at loongson.cn>
  Date:   2025-05-14 (Wed, 14 May 2025)

  Changed paths:
    M lld/ELF/Arch/LoongArch.cpp
    M lld/test/ELF/loongarch-relax-pc-hi20-lo12.s

  Log Message:
  -----------
  [lld][LoongArch] GOT indirection to PC relative optimization.

In LoongArch, this optimization is only supported when relaxation is enabled.
From:
 * pcalau12i $a0, %got_pc_hi20(sym_got)
 * ld.w/d $a0, $a0, %got_pc_lo12(sym_got)
To:
 * pcalau12i $a0, %pc_hi20(sym)
 * addi.w/d $a0, $a0, %pc_lo12(sym)

If the original code sequence can be relaxed into a single instruction
`pcaddi`, this patch will not be taken (see https://).
The implementation related to `got` is split into two locations because
the `relax()` function is part of an iteration fixed-point algorithm. We
should minimize it to achieve better linker performance.

FIXME: Althouth the optimization has been performed, the GOT entries still
exists, similarly to AArch64. Eliminating the entries may be require
additional marking in the common code.


  Commit: a2768a558ca995fe65a37582664984839e2b57a5
      https://github.com/llvm/llvm-project/commit/a2768a558ca995fe65a37582664984839e2b57a5
  Author: yangzhaoxin <yangzhaoxin at loongson.cn>
  Date:   2025-05-14 (Wed, 14 May 2025)

  Changed paths:
    M lld/ELF/Arch/LoongArch.cpp

  Log Message:
  -----------
  Add check for register.


  Commit: 2d92dc3684b5b50be2ec69d7f5f6f151d7ff4e51
      https://github.com/llvm/llvm-project/commit/2d92dc3684b5b50be2ec69d7f5f6f151d7ff4e51
  Author: yangzhaoxin <yangzhaoxin at loongson.cn>
  Date:   2025-05-14 (Wed, 14 May 2025)

  Changed paths:
    M lld/ELF/Arch/LoongArch.cpp

  Log Message:
  -----------
  Delete FIXME according to review.


Compare: https://github.com/llvm/llvm-project/compare/47d84d9f79fa...2d92dc3684b5

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list