[all-commits] [llvm/llvm-project] 0b2d5b: [clang] allow const structs/unions/arrays to be co...

Qiu Chaofan via All-commits all-commits at lists.llvm.org
Thu Aug 3 00:03:16 PDT 2023


  Branch: refs/heads/release/17.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 0b2d5b967d98375793897295d651f58f6fbd3034
      https://github.com/llvm/llvm-project/commit/0b2d5b967d98375793897295d651f58f6fbd3034
  Author: Nick Desaulniers <ndesaulniers at google.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/AST/ExprConstant.cpp
    M clang/test/CodeGen/builtin-constant-p.c
    M clang/test/CodeGen/const-init.c
    M clang/test/Sema/builtins.c
    M clang/test/Sema/init.c

  Log Message:
  -----------
  [clang] allow const structs/unions/arrays to be constant expressions for C

For code like:
struct foo { ... };
struct bar { struct foo foo; };
const struct foo my_foo = { ... };
struct bar my_bar = { .foo = my_foo };

Eli Friedman points out the relevant part of the C standard seems to
have some flexibility in what is considered a constant expression:

6.6 paragraph 10:
An implementation may accept other forms of constant expressions.

GCC 8 added support for these, so clang not supporting them has been a
constant thorn in the side of source code portability within the Linux
kernel.

Fixes: https://github.com/llvm/llvm-project/issues/44502

Reviewed By: efriedma

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

(cherry picked from commit 610ec954e1f81c0e8fcadedcd25afe643f5a094e)


  Commit: c278f4c0a576d499cba9de158f09ddbd60752b39
      https://github.com/llvm/llvm-project/commit/c278f4c0a576d499cba9de158f09ddbd60752b39
  Author: Kishan Parmar <kparmar2101 at gmail.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/Driver/ppc-abi.c

  Log Message:
  -----------
  clang driver throws error for -mabi=elfv2 or elfv2

After clang release/16.x there is a regression that -mabi=elfv1
or -mabi=elfv2 are being unused and throws warning. But clang-trunk
throws error for -mabi=elfv2 or elfv1. Intent of this patch to accept
elfv1 or elfv2 for -mabi.

Reviewed By : nemanjai
Differential Revision: https://reviews.llvm.org/D156351

(cherry picked from commit 065da3574b4fe9d4ee6283de2c82b8ce1c08af08)


  Commit: d921e450da7d2df230059c80fcd46a478dbd5cf5
      https://github.com/llvm/llvm-project/commit/d921e450da7d2df230059c80fcd46a478dbd5cf5
  Author: Alexander Kornienko <alexfh at google.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
    M llvm/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp
    M llvm/test/CodeGen/AArch64/ldrpre-ldr-merge.mir

  Log Message:
  -----------
  Revert "[AArch64] Merge LDRSWpre-LD[U]RSW pair into LDPSWpre"

This reverts commit b0093e13fcfdd4eea5bbd7ae57d3d1b82f4135c3 due to a miscompile
under MSan. See https://reviews.llvm.org/D152407#4533478 for more details.

Reviewed By: asmok-g

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

(cherry picked from commit 0def4e6b0f638b97a73bd4674365961d8fabda28)


  Commit: a6224595f957933392699e4153bfb0fddfb7d495
      https://github.com/llvm/llvm-project/commit/a6224595f957933392699e4153bfb0fddfb7d495
  Author: Jim Lin <jim at andestech.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
    M llvm/test/CodeGen/RISCV/push-pop-popret.ll

  Log Message:
  -----------
  [RISCV] Fix the CFI offset for callee-saved registers stored by Zcmp push.

Issue mentioned: https://github.com/riscv/riscv-code-size-reduction/issues/182

The order of callee-saved registers stored by Zcmp push in memory is reversed.

Pseudo code for cm.push in https://github.com/riscv/riscv-code-size-reduction/releases/download/v1.0.4-1/Zc.1.0.4-1.pdf

```
if (XLEN==32) bytes=4; else bytes=8;

addr=sp-bytes;
for(i in 27,26,25,24,23,22,21,20,19,18,9,8,1)  {
  //if register i is in xreg_list
  if (xreg_list[i]) {
    switch(bytes) {
      4:  asm("sw x[i], 0(addr)");
      8:  asm("sd x[i], 0(addr)");
    }
    addr-=bytes;
  }
}
```

The placement order for push is s11, s10, ..., ra.

CFI offset should be calculed as reversed order for correct stack unwinding.

Reviewed By: fakepaper56, kito-cheng

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


  Commit: 1f7ff62d055c8c848fb27aaa2595ae544fce2e69
      https://github.com/llvm/llvm-project/commit/1f7ff62d055c8c848fb27aaa2595ae544fce2e69
  Author: Piotr Fusik <fox at scene.pl>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M libcxx/include/sstream
    M libcxx/test/std/input.output/string.streams/istringstream/istringstream.members/str.move.pass.cpp
    M libcxx/test/std/input.output/string.streams/ostringstream/ostringstream.members/str.move.pass.cpp
    M libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.members/str.move.pass.cpp
    M libcxx/test/std/input.output/string.streams/stringstream/stringstream.members/str.move.pass.cpp

  Log Message:
  -----------
  [libc++] Fix `std::out_of_range` thrown from `basic_stringbuf::str() &&`

Reviewed By: #libc, Mordante, philnik

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

(cherry picked from commit f418cb1a9367d85c7c9b1aa93dc3fa60c8ef9849)


  Commit: 0af7e5e54a8c7ac665773ac1ada328713e8338f5
      https://github.com/llvm/llvm-project/commit/0af7e5e54a8c7ac665773ac1ada328713e8338f5
  Author: Qiu Chaofan <qiucofan at cn.ibm.com>
  Date:   2023-08-03 (Thu, 03 Aug 2023)

  Changed paths:
    M llvm/lib/Target/PowerPC/PPCInstrFormats.td
    M llvm/lib/Target/PowerPC/PPCInstrInfo.td
    M llvm/lib/Target/PowerPC/PPCScheduleP9.td
    M llvm/test/MC/PowerPC/ppc64-encoding-bookIII.s

  Log Message:
  -----------
  [PowerPC][MC] Recognize tlbilx and its mnemonics

This fixes issue 64080. tlbilx exists in ISA 2.07 Book III-E. Since
contents of Book III-E were eliminated after ISA 3.0, tlbilx does not
exist in ISA 3.0 and ISA 3.1.

Reviewed By: nickdesaulniers

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

(cherry picked from commit 53648ac1d0c953ae6d008864dd2eddb437a92468)


Compare: https://github.com/llvm/llvm-project/compare/3ada195d2fca...0af7e5e54a8c


More information about the All-commits mailing list