[all-commits] [llvm/llvm-project] 4d502f: [clang] Skip stores in init for fields that are em...

Ryan Burns via All-commits all-commits at lists.llvm.org
Tue Aug 15 23:19:24 PDT 2023


  Branch: refs/heads/release/17.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d502f14aca55b8378e75373639cbee305c8c2ad
      https://github.com/llvm/llvm-project/commit/4d502f14aca55b8378e75373639cbee305c8c2ad
  Author: Martin Storsjö <martin at martin.st>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    A clang/test/CodeGenCXX/ctor-empty-nounique.cpp

  Log Message:
  -----------
  [clang] Skip stores in init for fields that are empty structs

An empty struct is handled as a struct with a dummy i8, on all targets.

Most targets treat an empty struct return value as essentially
void - but some don't. (Currently, at least x86_64-windows-* and
powerpc64le-* don't treat it as void.)

When intializing a struct with such a no_unique_address member,
make sure we don't write the dummy i8 into the struct where there's
no space allocated for it.

Previously it would clobber the actual valid data of the struct.

Fixes https://github.com/llvm/llvm-project/issues/64253, and
possibly https://github.com/llvm/llvm-project/issues/64077
and https://github.com/llvm/llvm-project/issues/64427 as well.

We should omit the store for any empty record (not only ones
declared with no_unique_address); we can have a situation where a
class doesn't have the no_unique_address attribute, but is embedded
in an outer struct with the no_unique_address attribute - like this:

    struct S {};
    S f();
    struct S2 : public S { S2();};
    S2::S2() : S(f()) {}
    struct S3 { int x; [[no_unique_address]] S2 y; S3(); };
    S3::S3() : x(1), y() {}

Here, the problematic store (which this patch omits) is in
the constructor of S2. In the case of S3, S2 has no valid storage
and aliases x - thus the constructor of S2 should omit the dummy
store.

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

(cherry picked from commit d60c3d08e78dfbb4b180776b83e910d810e1f36a)


  Commit: 9e87433217bd7cff6034a5a2672490e70c08bf7f
      https://github.com/llvm/llvm-project/commit/9e87433217bd7cff6034a5a2672490e70c08bf7f
  Author: Tulio Magno Quites Machado Filho <tuliom at redhat.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M flang/test/Lower/module-debug-file-loc-linux.f90

  Log Message:
  -----------
  flang: Fix module-debug-file-loc-linux.f90 in standalone

In a standalone build, there is no guarantee that flang code would be
saved in a directory named flang. Check only the path under flang's root
directory.

Reviewed By: #flang, kiranchandramohan

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

(cherry picked from commit 94f377d880376fa6d5653430cad2777e51759d48)


  Commit: f36309a39b28ecfc515a9e2b90ac6a40ece264ad
      https://github.com/llvm/llvm-project/commit/f36309a39b28ecfc515a9e2b90ac6a40ece264ad
  Author: Ryan Burns <rtburns at protonmail.com>
  Date:   2023-08-16 (Wed, 16 Aug 2023)

  Changed paths:
    M clang/lib/Headers/__clang_cuda_math.h

  Log Message:
  -----------
  Fix truncated __OPENMP_NVPTX__ preprocessor condition

I don't have a test case for this but noticed this warning when including system headers with `-I` rather than `-isystem`.

```
In file included from <built-in>:1:
In file included from /nix/store/jq6bpm0xmhnbffhs5rkxq4n88g5xi2zg-clang-wrapper-11.0.1/resource-root/include/__clang_cuda_runtime_wrapper.h:157:
/nix/store/jq6bpm0xmhnbffhs5rkxq4n88g5xi2zg-clang-wrapper-11.0.1/resource-root/include/__clang_cuda_math.h:39:25: warning: extra tokens at end of #ifdef directive [-Wextra-tokens]
                        ^
```

Reviewed By: tra

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

(cherry picked from commit c49142e4f5c8645a4d741d233f0cb55ef1ef87a2)


Compare: https://github.com/llvm/llvm-project/compare/2f0fb9346d0b...f36309a39b28


More information about the All-commits mailing list