[all-commits] [llvm/llvm-project] f4bb62: [JITLink][RISCV] Support relaxable edges without r...

Job Noorman via All-commits all-commits at lists.llvm.org
Mon Jun 26 00:45:02 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f4bb62e85c167c49dfc4027a684b230f75c39374
      https://github.com/llvm/llvm-project/commit/f4bb62e85c167c49dfc4027a684b230f75c39374
  Author: Job Noorman <jnoorman at igalia.com>
  Date:   2023-06-26 (Mon, 26 Jun 2023)

  Changed paths:
    M llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp

  Log Message:
  -----------
  [JITLink][RISCV] Support relaxable edges without relaxation pass

Relaxable edges are created unconditionally, even when the relaxation
pass will not run. However, they were not recognized by applyFixup
causing them to not be applied.

To support configurations without the relaxation pass, this patch adds
these relaxable edges to applyFixup:
- CallRelaxable: Can be treated as R_RISCV_CALL
- AlignRelaxable: Can simply be ignored

An alternative could be to unconditionally run the relaxation pass, even
in contexts where shouldAddDefaultTargetPasses returns false. However, I
could imagine there being use cases for disabling relaxation which
wouldn't be possible anymore then.

Reviewed By: StephenFan

Differential Revision: https://reviews.llvm.org/D153541


  Commit: de5198b00dd7d4df2d30dcae5f9bd4ebc85f5d17
      https://github.com/llvm/llvm-project/commit/de5198b00dd7d4df2d30dcae5f9bd4ebc85f5d17
  Author: Job Noorman <jnoorman at igalia.com>
  Date:   2023-06-26 (Mon, 26 Jun 2023)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/JITLink/ELF_riscv.h
    M llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp

  Log Message:
  -----------
  [JITLink][RISCV] Expose relaxation pass publicly

This is useful for contexts where shouldAddDefaultTargetPasses returns
false but that still want to perform relaxation.

Reviewed By: StephenFan

Differential Revision: https://reviews.llvm.org/D153538


  Commit: 794970988e9fd02fdb8ddc8479f4dcc7cdd93474
      https://github.com/llvm/llvm-project/commit/794970988e9fd02fdb8ddc8479f4dcc7cdd93474
  Author: Job Noorman <jnoorman at igalia.com>
  Date:   2023-06-26 (Mon, 26 Jun 2023)

  Changed paths:
    M llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
    A llvm/test/ExecutionEngine/JITLink/RISCV/ELF_relax_nonrelaxable.s

  Log Message:
  -----------
  [JITLink][RISCV] Adjust offsets of non-relaxable edges

The relaxation algorithm used to only update offsets of relaxable edges.
This caused non-relaxable edges that appear after a relaxed instruction
to have an incorrect offset and be applied at the wrong location. This
patch fixes this by updating the offsets of all edges.

Note that this bug was caused by an incorrect translation of LLD's
relaxation algorithm. LLD always uses all edges during relaxation while
I decided to filter-out relaxable edges to prevent having to iterate
non-relaxable edges at each step. However, this had the side-effect of
only updating offsets of relaxable edges. This patch leaves the
filtering of relaxable edges as-is but iterates all edges when updating
offsets.

Reviewed By: StephenFan

Differential Revision: https://reviews.llvm.org/D153515


Compare: https://github.com/llvm/llvm-project/compare/5eb8cb094981...794970988e9f


More information about the All-commits mailing list