[all-commits] [llvm/llvm-project] 9d0754: [MC] Relax fragments eagerly

Fangrui Song via All-commits all-commits at lists.llvm.org
Sun Jun 9 23:05:28 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9d0754ada5dbbc0c009bcc2f7824488419cc5530
      https://github.com/llvm/llvm-project/commit/9d0754ada5dbbc0c009bcc2f7824488419cc5530
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-06-09 (Sun, 09 Jun 2024)

  Changed paths:
    M llvm/include/llvm/MC/MCAsmLayout.h
    M llvm/include/llvm/MC/MCAssembler.h
    M llvm/include/llvm/MC/MCFragment.h
    M llvm/include/llvm/MC/MCSection.h
    M llvm/lib/MC/MCAssembler.cpp
    M llvm/lib/MC/MCExpr.cpp
    M llvm/lib/MC/MCFragment.cpp
    M llvm/lib/MC/MCSection.cpp
    M llvm/test/MC/ELF/layout-interdependency.s
    M llvm/test/MC/ELF/relax-recompute-align.s
    M llvm/test/MC/ELF/subsection-if.s

  Log Message:
  -----------
  [MC] Relax fragments eagerly

Lazy relaxation caused hash table lookups (`getFragmentOffset`) and
complex use/compute interdependencies. Some expressions involding
forward declared symbols (e.g. `subsection-if.s`) cannot be computed.
Recursion detection requires complex `IsBeingLaidOut`
(https://reviews.llvm.org/D79570).

D76114's `invalidateFragmentsFrom` makes lazy relaxation even less
useful.

Switch to eager relaxation to greatly simplify code and resolve these
issues. This change also removes a `getPrevNode` use, which makes it
more feasible to replace the fragment representation, which might yield
a large peak RSS win.

Minor downsides: The number of section relaxations may increase (offset
by avoiding the hash table lookup). For relax-recompute-align.s, the
computed layout is not optimal.



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