[all-commits] [llvm/llvm-project] 43f508: [Coroutines] Fix premature conversion of return ob...

Bruno Cardoso Lopes via All-commits all-commits at lists.llvm.org
Tue Mar 21 21:43:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 43f5085fa80f716acf93870618b1d93ec85c1d01
      https://github.com/llvm/llvm-project/commit/43f5085fa80f716acf93870618b1d93ec85c1d01
  Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
  Date:   2023-03-21 (Tue, 21 Mar 2023)

  Changed paths:
    M clang/include/clang/AST/StmtCXX.h
    M clang/lib/AST/StmtCXX.cpp
    M clang/lib/CodeGen/CGCoroutine.cpp
    M clang/lib/Sema/SemaCoroutine.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/test/CodeGenCoroutines/coro-gro.cpp
    M clang/test/CodeGenCoroutines/pr59221.cpp
    M clang/test/SemaCXX/coroutine-no-move-ctor.cpp
    M clang/test/SemaCXX/coroutines.cpp
    M clang/test/SemaCXX/warn-throw-out-noexcept-coro.cpp

  Log Message:
  -----------
  [Coroutines] Fix premature conversion of return object

Fix https://github.com/llvm/llvm-project/issues/56532

Effectively, this reverts behavior introduced in https://reviews.llvm.org/D117087,
which did two things:

1. Change delayed to early conversion of return object.
2. Introduced RVO possibilities because of early conversion.

This patches fixes (1) and removes (2). I already worked on a follow up for (2)
in a separated patch. I believe it's important to split these two because if the RVO
causes any problems we can explore reverting (2) while maintaining (1).

Notes on some testcase changes:
- `pr59221.cpp` changed to `-O1` so we can check that the front-end honors
  the value checked for. Sounds like `-O3` without RVO is more likely
  to work with LLVM optimizations...
- Comment out delete members `coroutine-no-move-ctor.cpp` since behavior
  now requires copies again.

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


  Commit: fa0d4e1f12a3f69dd0afb07c0928c867ab921537
      https://github.com/llvm/llvm-project/commit/fa0d4e1f12a3f69dd0afb07c0928c867ab921537
  Author: Bruno Cardoso Lopes <bruno.cardoso at gmail.com>
  Date:   2023-03-21 (Tue, 21 Mar 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/AST/StmtCXX.h
    M clang/lib/CodeGen/CGCoroutine.cpp
    M clang/lib/Sema/SemaCoroutine.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/test/CodeGenCoroutines/coro-gro.cpp
    M clang/test/SemaCXX/coroutine-no-move-ctor.cpp

  Log Message:
  -----------
  [Coroutines] Implement fix for cwg2563 issue and enable RVO under certain conditions

- The cwg2563 issue is fixed by delaying GRO initialization only when the types
  mismatch between GRO and function return.
- When the types match directly initialize, which indirectly enables RVO to
  kick in, partially restores behavior introduced in
  https://reviews.llvm.org/D117087.
- Add entry to release notes.

Background:
https://github.com/llvm/llvm-project/issues/56532
https://cplusplus.github.io/CWG/issues/2563.html
https://github.com/cplusplus/papers/issues/1414

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


Compare: https://github.com/llvm/llvm-project/compare/f64dc9bc6ea0...fa0d4e1f12a3


More information about the All-commits mailing list