[all-commits] [llvm/llvm-project] 750064: [MC] Remove pending labels

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Jun 22 00:34:40 PDT 2024


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

  Changed paths:
    M llvm/include/llvm/MC/MCAsmLayout.h
    M llvm/include/llvm/MC/MCObjectStreamer.h
    M llvm/include/llvm/MC/MCSection.h
    M llvm/lib/MC/MCAssembler.cpp
    M llvm/lib/MC/MCObjectStreamer.cpp
    M llvm/lib/MC/MCSection.cpp
    M llvm/test/MC/MachO/pending-labels.s
    M llvm/tools/dsymutil/MachOUtils.cpp

  Log Message:
  -----------
  [MC] Remove pending labels

This commit removes the complexity introduced by pending labels in
https://reviews.llvm.org/D5915 by using a simpler approach. D5915 aimed
to ensure padding placement before `.Ltmp0` for the following code, but
at the cost of expensive per-instruction `flushPendingLabels`.

```
// similar to llvm/test/MC/X86/AlignedBundling/labeloffset.s
.bundle_lock align_to_end
  calll   .L0$pb
.bundle_unlock
.L0$pb:
  popl    %eax
.Ltmp0:   //// padding should be inserted before this label instead of after
  addl    $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %eax
```

(D5915 was adjusted by https://reviews.llvm.org/D8072 and
https://reviews.llvm.org/D71368)

This patch achieves the same goal by setting the offset of the empty
MCDataFragment (`Prev`) in `layoutBundle`. This eliminates the need for
pending labels and simplifies the code.

llvm/test/MC/MachO/pending-labels.s (D71368): relocation symbols are
changed, but the result is still supported by linkers.



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