LLVM/project bc11c85clang/lib/CodeGen CGCoroutine.cpp, clang/test/CodeGenCoroutines coro-elide.cpp

[clang][CodeGen] Emit coro.dead intrinsic to improve coroutine allocation elision (#190295)

Part 4/4: Implement HALO for coroutines that flow off final suspend.
Parent PR: #185336
DeltaFile
+26-1clang/test/CodeGenCoroutines/coro-elide.cpp
+3-0clang/lib/CodeGen/CGCoroutine.cpp
+29-12 files

LLVM/project 8b903feclang/test/DebugInfo/CXX hotpatch.cpp

[clang][DebugInfo][test] Set -fuse-lld for test matching linker invocation. (#190291)

This test doesn't work as intended when an alternative default linker is
specified via `-DCLANG_DEFAULT_LINKER=ld`. If this test isn't intended
to support alternate default linker, lmk I can just change the
downstream usage I'm seeing, though I figure other folks may have
similar configurations. Repro:

```
cmake -S llvm -B build -DLLVM_ENABLE_PROJECTS="clang" -DCLANG_DEFAULT_LINKER=ld -GNinja
ninja -C build
./build/bin/llvm-lit -v clang/test/DebugInfo/CXX/hotpatch.cpp

...

possible intended match
# |             6:  "/usr/bin/ld" "-out:hotpatch.exe" "-libpath:lib/amd64" "-libpath:atlmfc/lib/amd64" "-nologo" "-functionpadmin" "/tmp/lit-tmp-o7x0r1o_/hotpatch-4595de.obj" 
```


    [2 lines not shown]
DeltaFile
+2-1clang/test/DebugInfo/CXX/hotpatch.cpp
+2-11 files

LLVM/project 72b00e6clang CMakeLists.txt, clang/tools/libclang CMakeLists.txt

[CMake] Version Darwin dylib identities (#189004)
DeltaFile
+24-0llvm/CMakeLists.txt
+15-0llvm/docs/CMake.rst
+9-0llvm/tools/lto/CMakeLists.txt
+9-0clang/tools/libclang/CMakeLists.txt
+3-0llvm/cmake/modules/LLVMConfig.cmake.in
+3-0clang/CMakeLists.txt
+63-01 files not shown
+64-17 files

LLVM/project ed63780clang/lib/CodeGen CGCall.cpp CGCall.h, clang/test/CodeGen stack-usage-lifetimes.c lifetime-invoke-c.c

[clang] Use tighter lifetime bounds for C temporary arguments

In C, consecutive statements in the same scope are under
CompoundStmt/CallExpr, while in C++ they typically fall under
CompoundStmt/ExprWithCleanup. This leads to different behavior with
respect to where pushFullExprCleanUp inserts the lifetime end markers
(e.g., at the end of scope).

For these cases, we can track and insert the lifetime end markers right
after the call completes. Allowing the stack space to be reused
immediately. This partially addresses #109204 and #43598 for improving
stack usage.
DeltaFile
+89-0clang/test/CodeGen/stack-usage-lifetimes.c
+29-19clang/test/CodeGen/lifetime-invoke-c.c
+20-6clang/lib/CodeGen/CGCall.cpp
+12-12clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
+15-5clang/test/CodeGen/lifetime-bug.cpp
+19-0clang/lib/CodeGen/CGCall.h
+184-422 files not shown
+186-448 files

LLVM/project 1f9be2bclang/lib/AST ExprConstant.cpp, clang/lib/Sema SemaExprCXX.cpp

Use setExprNeedsCleanups in BuildCXXNew and avoid breaking c++98

This approach is much cleaner, but broke checkICE reporting in c++98.
Stepping through a debugger shows that this happend because the
static_assert test didn not recognize ExprWithCleanups as transparent to
constant evaluation. To addresse this, we update CheckICE to recurse
into the sub-expression, and keep the old behavior.
DeltaFile
+1-15clang/lib/Sema/SemaExprCXX.cpp
+4-1clang/lib/AST/ExprConstant.cpp
+5-162 files

LLVM/project a9ea799clang/test/CodeGen lifetime-bug-2.cpp

Save test for conflicting cleanups
DeltaFile
+8-2clang/test/CodeGen/lifetime-bug-2.cpp
+8-21 files

LLVM/project 57cc6fcclang/lib/CodeGen CGCall.cpp CGCall.h, clang/test/CodeGen lifetime-invoke-c.c lifetime-bug.cpp

Try to control the scope
DeltaFile
+21-3clang/lib/CodeGen/CGCall.cpp
+16-3clang/lib/CodeGen/CGCall.h
+7-9clang/test/CodeGen/lifetime-invoke-c.c
+1-9clang/test/CodeGen/lifetime-bug.cpp
+4-4clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
+49-285 files

LLVM/project 66bee4eclang/lib/AST ExprConstant.cpp

Use more restrictive condition for adding ExprWithCleanups
DeltaFile
+1-4clang/lib/AST/ExprConstant.cpp
+1-41 files

LLVM/project c18baf7clang/lib/CodeGen CGCall.cpp, clang/lib/Sema SemaExprCXX.cpp

[clang] Use uniform lifetime bounds under exceptions

To do this we have to slightly modify how some expressions are handled
in Sema. Principally, we need to ensure that calls to new for
non-trivial types still have their destructors run. Generally this isn't
an issue, since these just get sunk into the surrounding scope. With
more lifetime annotations being produced for the expressions, we found
that some calls to `new` in an unreachable switch arm would not be
wrapped in ExprWithCleanups. As a result, they remain on the EhStack
when processing the default label, and since the dead arm doesn't
dominate the default label, we can end up with a case where the def-use
chain is broken (e.g. the def doesn't dominate all uses). Technically
this path would be impossible to reach due to the active bit, but it
still failed to satisfy a dominance relationship.

With that in place, we can remove the constraint on only using tighter
lifetimes when exceptions are disabled.
DeltaFile
+36-0clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
+15-1clang/lib/Sema/SemaExprCXX.cpp
+2-4clang/lib/CodeGen/CGCall.cpp
+53-53 files

LLVM/project 05360a2clang-tools-extra/clang-tidy/bugprone SmartPtrArrayMismatchCheck.cpp, clang-tools-extra/clang-tidy/cppcoreguidelines OwningMemoryCheck.cpp

clang-format
DeltaFile
+16-15clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
+11-11clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.cpp
+2-1clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
+29-273 files

LLVM/project b8a3539clang/lib/CodeGen CGCall.cpp CGCall.h, clang/test/CodeGen lifetime-invoke-c.c lifetime-bug.cpp

Try to control the scope
DeltaFile
+21-3clang/lib/CodeGen/CGCall.cpp
+16-3clang/lib/CodeGen/CGCall.h
+7-9clang/test/CodeGen/lifetime-invoke-c.c
+1-9clang/test/CodeGen/lifetime-bug.cpp
+4-4clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
+49-285 files

LLVM/project 5675c1aclang/lib/CodeGen CGCall.cpp CGCall.h, clang/test/CodeGen stack-usage-lifetimes.c lifetime-invoke-c.c

[clang] Use tighter lifetime bounds for C temporary arguments

In C, consecutive statements in the same scope are under
CompoundStmt/CallExpr, while in C++ they typically fall under
CompoundStmt/ExprWithCleanup. This leads to different behavior with
respect to where pushFullExprCleanUp inserts the lifetime end markers
(e.g., at the end of scope).

For these cases, we can track and insert the lifetime end markers right
after the call completes. Allowing the stack space to be reused
immediately. This partially addresses #109204 and #43598 for improving
stack usage.
DeltaFile
+89-0clang/test/CodeGen/stack-usage-lifetimes.c
+29-19clang/test/CodeGen/lifetime-invoke-c.c
+20-6clang/lib/CodeGen/CGCall.cpp
+12-12clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
+15-5clang/test/CodeGen/lifetime-bug.cpp
+19-0clang/lib/CodeGen/CGCall.h
+184-422 files not shown
+186-448 files

LLVM/project 0dad12dclang/lib/AST ExprConstant.cpp

Use more restrictive condition for adding ExprWithCleanups
DeltaFile
+1-4clang/lib/AST/ExprConstant.cpp
+1-41 files

LLVM/project a8d3a1aclang/lib/AST ExprConstant.cpp, clang/lib/Sema SemaExprCXX.cpp

Use setExprNeedsCleanups in BuildCXXNew and avoid breaking c++98

This approach is much cleaner, but broke checkICE reporting in c++98.
Stepping through a debugger shows that this happend because the
static_assert test didn not recognize ExprWithCleanups as transparent to
constant evaluation. To addresse this, we update CheckICE to recurse
into the sub-expression, and keep the old behavior.
DeltaFile
+1-15clang/lib/Sema/SemaExprCXX.cpp
+4-1clang/lib/AST/ExprConstant.cpp
+5-162 files

LLVM/project af790c0clang/test/CodeGen lifetime-bug-2.cpp

Save test for conflicting cleanups
DeltaFile
+8-2clang/test/CodeGen/lifetime-bug-2.cpp
+8-21 files

LLVM/project d65c56bclang/lib/CodeGen CGCall.cpp, clang/lib/Sema SemaExprCXX.cpp

[clang] Use uniform lifetime bounds under exceptions

To do this we have to slightly modify how some expressions are handled
in Sema. Principally, we need to ensure that calls to new for
non-trivial types still have their destructors run. Generally this isn't
an issue, since these just get sunk into the surrounding scope. With
more lifetime annotations being produced for the expressions, we found
that some calls to `new` in an unreachable switch arm would not be
wrapped in ExprWithCleanups. As a result, they remain on the EhStack
when processing the default label, and since the dead arm doesn't
dominate the default label, we can end up with a case where the def-use
chain is broken (e.g. the def doesn't dominate all uses). Technically
this path would be impossible to reach due to the active bit, but it
still failed to satisfy a dominance relationship.

With that in place, we can remove the constraint on only using tighter
lifetimes when exceptions are disabled.
DeltaFile
+36-0clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
+15-1clang/lib/Sema/SemaExprCXX.cpp
+2-4clang/lib/CodeGen/CGCall.cpp
+53-53 files

LLVM/project 9cc15f8clang-tools-extra/clang-tidy/bugprone SmartPtrArrayMismatchCheck.cpp, clang-tools-extra/clang-tidy/cppcoreguidelines OwningMemoryCheck.cpp

Fix tidy checks
DeltaFile
+14-8clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
+12-9clang-tools-extra/clang-tidy/bugprone/SmartPtrArrayMismatchCheck.cpp
+16-0clang-tools-extra/clang-tidy/utils/Matchers.h
+6-4clang-tools-extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
+48-214 files

LLVM/project 7084f18llvm/lib/Target/AMDGPU FLATInstructions.td, llvm/test/CodeGen/AMDGPU flat-saddr-store.ll llvm.amdgcn.cvt.sat.pk.ll

[AMDGPU] Fix i16/i8 flat store in true16 with sramecc (#190238)

The pattern was guarded by the D16PreservesUnusedBits predicate
which is not needed for stores.
DeltaFile
+43-12llvm/test/CodeGen/AMDGPU/flat-saddr-store.ll
+4-4llvm/test/CodeGen/AMDGPU/llvm.amdgcn.cvt.sat.pk.ll
+1-1llvm/lib/Target/AMDGPU/FLATInstructions.td
+48-173 files

LLVM/project 935f21ellvm/utils/gn/secondary/llvm/lib/Transforms/Vectorize BUILD.gn

gn build: Port d8e9e0af1cb6



Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/190290
DeltaFile
+1-0llvm/utils/gn/secondary/llvm/lib/Transforms/Vectorize/BUILD.gn
+1-01 files

LLVM/project f20b40ellvm/utils/gn/secondary/clang/lib/Options BUILD.gn

gn build: Port f63d33da0a51 more



Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/190289
DeltaFile
+1-0llvm/utils/gn/secondary/clang/lib/Options/BUILD.gn
+1-01 files

LLVM/project 34b1e26clang/lib/CodeGen CGCleanup.cpp

Remove unneeded conditions from CGCleanup.cpp
DeltaFile
+3-4clang/lib/CodeGen/CGCleanup.cpp
+3-41 files

LLVM/project 829a62aclang/test/CodeGen lifetime-bug-2.cpp

Add test case
DeltaFile
+30-0clang/test/CodeGen/lifetime-bug-2.cpp
+30-01 files

LLVM/project 1c1eb74clang/lib/Sema SemaExprCXX.cpp

Avoid canThrow, and just check for Exceptions being enabled
DeltaFile
+1-1clang/lib/Sema/SemaExprCXX.cpp
+1-11 files

LLVM/project e56e264clang/test/CodeGen lifetime-bug-2.c

Remove test that no longer repros error case

Something changed w/in clang to prevent this crash from happening.
DeltaFile
+0-58clang/test/CodeGen/lifetime-bug-2.c
+0-581 files

LLVM/project dcdf413clang/lib/CodeGen CGCall.cpp, clang/lib/Sema SemaExprCXX.cpp

Improve exception compatibility.
DeltaFile
+92-19clang/test/CodeGen/lifetime-invoke-c.c
+61-18clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
+18-3clang/test/CodeGen/lifetime-bug.cpp
+1-4clang/lib/CodeGen/CGCall.cpp
+4-0clang/lib/Sema/SemaExprCXX.cpp
+176-445 files

LLVM/project 9c65fdaclang/lib/CodeGen CGCall.cpp, clang/test/CodeGen lifetime-call-temp.c lifetime-bug-2.c

Reapply "[clang] Limit lifetimes of temporaries to the full expression (#170517)"

This reverts commit 6d38c876478dac4a42f9d6e37692348deabf6a25. The
current version only works when exceptions are not enabled until we
determine how to resolve issues around broken dominance relationships
with the def-use chain.
DeltaFile
+98-0clang/test/CodeGen/lifetime-call-temp.c
+58-0clang/test/CodeGen/lifetime-bug-2.c
+58-0clang/test/CodeGen/lifetime-bug.cpp
+40-0clang/test/CodeGenCXX/aggregate-lifetime-invoke.cpp
+36-0clang/test/CodeGen/lifetime-invoke-c.c
+24-1clang/lib/CodeGen/CGCall.cpp
+314-17 files not shown
+365-413 files

LLVM/project 89f31f2llvm/lib/Target/AArch64 MachineSMEABIPass.cpp, llvm/test/CodeGen/AArch64 sme-agnostic-za-without-sme.ll

[AArch64][SME] Preserve ZA in agnostic ZA functions without +sme (#190141)

`__arm_agnostic("sme_za_state")` does not require +sme, but we must
still preserve ZA in case the function is used with code that makes use
of ZA:

> The use of `__arm_agnostic("sme_za_state")` allows writing functions
> that are compatible with ZA state without having to share ZA state
> with the caller, as required by `__arm_preserves`. The use of this
> attribute does not imply that SME is available.
DeltaFile
+33-0llvm/test/CodeGen/AArch64/sme-agnostic-za-without-sme.ll
+3-2llvm/lib/Target/AArch64/MachineSMEABIPass.cpp
+36-22 files

LLVM/project 124b0a8lldb/source/Plugins/Platform/MacOSX PlatformDarwinKernel.cpp

[lldb][kernel debug] Add a missing call to scan local fs for kexts (#190281)

A kernel developer noticed that I missed a call to index the local
filesystem in one of our codepaths, and had a use case that depended on
that working.

rdar://173814556
DeltaFile
+1-0lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+1-01 files

LLVM/project 1f75f31cmake/Modules GetToolchainDirs.cmake

[Runtimes] Gracefully handle invalid LLVM_TARGET_TRIPLE (#190284)

In some situations such as reported at
https://github.com/llvm/llvm-project/pull/177953#issuecomment-4179014239,
LLVM_(DEFAULT_)TARGET_TRIPLE is not set. It is used to derive the output
directory in #177953. Only flang-rt currently uses
RUNTIMES_(INSTALL|OUTPUT)_RESOURCE_LIB_PATH, we should not fail building
other despite a missing LLVM_TARGET_TRIPLE.

Compiler-rt uses COMPILER_RT_DEFAULT_TARGET_TRIPLE instead which it
derives itself. Most other LLVM runtimes libraries just skip the target
portion of the library path (explicitly so since #93354). Do the same
for RUNTIMES_(INSTALL|OUTPUT)_RESOURCE_LIB_PATH which we hope eventually
can replace the other mechanisms.
DeltaFile
+16-6cmake/Modules/GetToolchainDirs.cmake
+16-61 files

LLVM/project 2600533clang-tools-extra/clang-doc YAMLGenerator.cpp Representation.h

[clang-doc] Switch to string internment (#190044)

This is the first step in migrating all the Info types to be POD. We
introduced a shared string saver that can be used safely across threads,
and updated the internal represntation of various data types to use
these over owned strings, like SmallString or std::string.

This also required changes to YAMLGenerator to keep the single quoted
string formatting and to update the YAML traits.

This change gives an almost 50% reduction in peak memory when building
documentation for clang, at about a 10% performance loss. Future patches
can mitigate the performance penalties, and further reduce memory use.

| Metric | Baseline | Prev | This | Culm% | Seq% |
| :--- | :--- | :--- | :--- | :--- | :--- |
| Time | 920.5s | 920.5s | 1011.0s | +9.8% | +9.8% |
| Memory | 86.0G | 86.0G | 44.9G | -47.8% | -47.8% |


    [30 lines not shown]
DeltaFile
+160-39clang-tools-extra/clang-doc/YAMLGenerator.cpp
+90-45clang-tools-extra/clang-doc/Representation.h
+51-51clang-tools-extra/clang-doc/Serialize.cpp
+27-29clang-tools-extra/clang-doc/Representation.cpp
+10-5clang-tools-extra/clang-doc/BitcodeReader.cpp
+5-5clang-tools-extra/clang-doc/Serialize.h
+343-1743 files not shown
+353-1839 files