[all-commits] [llvm/llvm-project] 1b7406: [XCOFF] Do not put MergeableCStrings in their own ...

Yueh-Ting (eop) Chen via All-commits all-commits at lists.llvm.org
Tue Aug 1 01:27:37 PDT 2023


  Branch: refs/heads/release/17.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 1b7406b272bae79cf7ce8d39ba8fa408c08720fe
      https://github.com/llvm/llvm-project/commit/1b7406b272bae79cf7ce8d39ba8fa408c08720fe
  Author: Wael Yehia <wyehia at ca.ibm.com>
  Date:   2023-08-01 (Tue, 01 Aug 2023)

  Changed paths:
    M llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    M llvm/test/CodeGen/PowerPC/aix-return55.ll
    M llvm/test/CodeGen/PowerPC/aix-xcoff-data-sections.ll
    M llvm/test/CodeGen/PowerPC/aix-xcoff-mergeable-str.ll
    M llvm/test/tools/llvm-objdump/XCOFF/symbol-table.test

  Log Message:
  -----------
  [XCOFF] Do not put MergeableCStrings in their own section

The current implementation generates a csect with a
".rodata.str.x.y" prefix for a MergeableCString variable definition.
However, a reference to such variable does not get the prefix in its
name because there's not enough information in the containing IR.
In particular, without seeing the initializer and absent of some other
indicators, we cannot tell that the referenced variable is a null-
terminated string.

When the AIX codegen in llvm was being developed, the prefixing was copied
from ELF without having the linker take advantage of the info.
Currently, the AIX linker does not have the capability to merge
MergeableCString variables. If such feature would ever get implemented,
the contract between the linker and compiler would have to be reconsidered.

Here's the before and after of this change:
```
@a = global i64 320255973571806, align 8
@strA = unnamed_addr constant [7 x i8] c"hello\0A\00", align 1  ;; Mergeable1ByteCString
@strB = unnamed_addr constant [8 x i8] c"Blahah\0A\00", align 1 ;; Mergeable1ByteCString
@strC = unnamed_addr constant [2 x i16] [i16 1, i16 0], align 2 ;; Mergeable2ByteCString
@strD = unnamed_addr constant [2 x i16] [i16 1, i16 1], align 2 ;; !isMergeableCString
@strE = external unnamed_addr constant [2 x i16], align 2

-fdata-sections:
  .text  extern        .rodata.str1.1strA        .text  extern        strA
    0    SD       RO                               0    SD       RO
  .text  extern        .rodata.str1.1strB        .text  extern        strB
    0    SD       RO                               0    SD       RO
  .text  extern        .rodata.str2.2strC  ===>  .text  extern        strC
    0    SD       RO                               0    SD       RO
  .text  extern        strD                      .text  extern        strD
    0    SD       RO                               0    SD       RO
  .data  extern        a                         .data  extern        a
    0    SD       RW                               0    SD       RW
  undef  extern        strE                      undef  extern        strE
    0    ER       UA                               0    ER       UA

-fno-data-sections:
  .text  unamex        .rodata.str1.1            .text  unamex        .rodata
    0    SD       RO                               0    SD       RO
  .text  extern        strA                      .text  extern        strA
    0    LD       RO                               0    LD       RO
  .text  extern        strB                      .text  extern        strB
    0    LD       RO                               0    LD       RO
  .text  unamex        .rodata.str2.2      ===>  .text  extern        strC
    0    SD       RO                               0    LD       RO
  .text  extern        strC                      .text  extern        strD
    0    LD       RO                               0    LD       RO
  .text  unamex        .rodata                   .data  unamex        .data
    0    SD       RO                               0    SD       RW
  .text  extern        strD                      .data  extern        a
    0    LD       RO                               0    LD       RW
  .data  unamex        .data                     undef  extern        strE
    0    SD       RW                               0    ER       UA
  .data  extern        a
    0    LD       RW
  undef  extern        strE
    0    ER       UA
```

Reviewed by: David Tenty, Fangrui Song

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

(cherry picked from commit 9d4e8c09f493280acc7637d904bdc84abc11fdc3)


  Commit: fcf0d0ba9c051ea7042490147148f67f0ea9a1b3
      https://github.com/llvm/llvm-project/commit/fcf0d0ba9c051ea7042490147148f67f0ea9a1b3
  Author: eopXD <yueh.ting.chen at gmail.com>
  Date:   2023-08-01 (Tue, 01 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst

  Log Message:
  -----------
  [docs] Add release notes for the LLVM 17 RVV intrinsics support


Compare: https://github.com/llvm/llvm-project/compare/6ee03f13f4dc...fcf0d0ba9c05


More information about the All-commits mailing list