1. [Coroutines] Reuse storage for local variables with non-overlapping lifetimes (details)
  2. [lldb] Remove nothreadallow from SWIG's __str__ wrappers to work around a Python>=3.7 crash (details)
  3. [ARM] Expand cannotInsertWDLSTPBetween to the last instruction (details)
  4. [ARM][MVE] tail-predication: overflow checks for elementcount, cont'd (details)
  5. [Coroutines] Remove unused includes. NFC. (details)
  6. [obj2yaml][yaml2obj] - Stop recognizing SHT_MIPS_ABIFLAGS on non-MIPS targets. (details)
  7. [lldb] Reference STL types in import-std-module tests (details)
  8. [yaml2obj][obj2yaml] - Add a support for SHT_ARM_EXIDX section. (details)
Commit b3a722e66b75328ab5e2eb5c8572022cb083855b by yedeng.yd
[Coroutines] Reuse storage for local variables with non-overlapping lifetimes

bug 45566 shows the process of building coroutine frame won't consider
that the lifetimes of different local variables are not overlapped,
which means the compiler could generates smaller frame.

This patch calculate the lifetime range of each alloca by StackLifetime
class. Then the patch build non-overlapped sets for allocas whose
lifetime ranges are not overlapped. We use the largest type in a
non-overlapped set as the field type in the frame. In insertSpills
process, if we find the type of field is not the same with the alloca,
we cast the pointer to the field type to the pointer to the alloca type.
Since the lifetime range of alloca in one non-overlapped set is not
overlapped with each other, it should be ok to reuse the storage space
in the frame.

Test plan: check-llvm, check-clang, cppcoro, folly

Reviewers: junparser, lxfind, modocache

Differential Revision:
The file was modifiedllvm/include/llvm/Transforms/Coroutines.h (diff)
The file was modifiedllvm/lib/Transforms/Coroutines/Coroutines.cpp (diff)
The file was modifiedllvm/include/llvm/Transforms/Coroutines/CoroSplit.h (diff)
The file was modifiedllvm/lib/Transforms/Coroutines/CMakeLists.txt (diff)
The file was modifiedllvm/lib/Transforms/Coroutines/CoroFrame.cpp (diff)
The file was modifiedllvm/lib/Transforms/Coroutines/CoroSplit.cpp (diff)
The file was addedllvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-01.ll
The file was addedllvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-03.ll
The file was modifiedllvm/lib/Passes/PassBuilder.cpp (diff)
The file was addedllvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-00.ll
The file was modifiedllvm/lib/Transforms/Coroutines/CoroInternal.h (diff)
The file was addedllvm/test/Transforms/Coroutines/coro-frame-reuse-alloca-02.ll
Commit 070a1d562b303e564e40d831f6dc125793e19b38 by Raphael Isemann
[lldb] Remove nothreadallow from SWIG's __str__ wrappers to work around a Python>=3.7 crash

Usually when we enter a SWIG wrapper function from Python, SWIG automatically
adds a `Py_BEGIN_ALLOW_THREADS`/`Py_END_ALLOW_THREADS` around the call to the SB
API C++ function. This will ensure that Python's GIL is released when we enter
LLDB and locked again when we return to the wrapper code.

D51569 changed this behaviour but only for the generated `__str__` wrappers. The
added `nothreadallow` disables the injection of the GIL release/re-acquire code
and the GIL is now kept locked when entering LLDB and is expected to be still
locked when returning from the LLDB implementation. The main reason for that was
that back when D51569 landed the wrapper itself created a Python string. These
days it just creates a std::string and SWIG itself takes care of getting the GIL
and creating the Python string from the std::string, so that workaround isn't
necessary anymore.

This patch just removes `nothreadallow` so that our `__str__` functions now
behave like all other wrapper functions in that they release the GIL when
calling into the SB API implementation.

The motivation here is actually to work around another potential bug in LLDB.
When one calls into the LLDB SB API while holding the GIL and that call causes
LLDB to interpret some Python script via `ScriptInterpreterPython`, then the GIL
will be unlocked when the control flow returns from the SB API. In the case of
the `__str__` wrapper this would cause that the next call to a Python function
requiring the GIL would fail (as SWIG will not try to reacquire the GIL as it
isn't aware that LLDB removed it).

The reason for this unexpected GIL release seems to be a workaround for recent
Python versions:
    // The only case we should go further and acquire the GIL: it is unlocked.
    if (PyGILState_Check())

The early-exit here causes `InitializePythonRAII::m_was_already_initialized` to
be always false and that causes that `InitializePythonRAII`'s destructor always
directly unlocks the GIL via `PyEval_SaveThread`. I'm investigating how to
properly fix this bug in a follow up patch, but for now this straightforward
patch seems to be enough to unblock my other patches (and it also has the
benefit of removing this workaround).

The test for this is just a simple test for `std::deque` which has a synthetic
child provider implemented as a Python script. Inspecting the deque object will
cause `expect_expr` to create a string error message by calling
`str(deque_object)`. Printing the ValueObject causes the Python script for the
synthetic children to execute which then triggers the bug described above where
the GIL ends up being unlocked.

Reviewed By: JDevlieghere

Differential Revision:
The file was addedlldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/main.cpp
The file was modifiedlldb/bindings/macros.swig (diff)
The file was addedlldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/
The file was addedlldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/deque/Makefile
Commit e4b9867cb69acc272157ef1baaecd9848ad18ecc by
[ARM] Expand cannotInsertWDLSTPBetween to the last instruction

9d9a11c7be037 added this check for predicatable instructions between the
D/WLSTP and the loop's start, but it was missing the last instruction in
the block. Change it to use some iterators instead.

Differential Revision:
The file was modifiedllvm/test/CodeGen/Thumb2/LowOverheadLoops/it-block-mov.mir (diff)
The file was modifiedllvm/lib/Target/ARM/ARMLowOverheadLoops.cpp (diff)
The file was modifiedllvm/test/CodeGen/Thumb2/LowOverheadLoops/mov-operand.ll (diff)
Commit f39f92c1f610fcdfad74730a3e3df881e32a28c2 by sjoerd.meijer
[ARM][MVE] tail-predication: overflow checks for elementcount, cont'd

This is a reimplementation of the overflow checks for the elementcount,
i.e. the 2nd argument of intrinsic The element
count is lowered in each iteration of the tail-predicated loop, and
we must prove that this expression doesn't overflow.

Many thanks to Eli Friedman and Sam Parker for all their help with
this work.

Differential Revision:
The file was modifiedllvm/lib/Target/ARM/MVETailPredication.cpp (diff)
The file was modifiedllvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-basic.ll (diff)
The file was modifiedllvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-const.ll (diff)
The file was removedllvm/test/CodeGen/Thumb2/LowOverheadLoops/tail-pred-forced.ll
Commit 7e5a356d2bd232267aac2484519ac2c5658eca08 by benny.kra
[Coroutines] Remove unused includes. NFC.
The file was modifiedllvm/lib/Transforms/Coroutines/CoroSplit.cpp (diff)
The file was modifiedllvm/include/llvm/Transforms/Coroutines/CoroSplit.h (diff)
Commit ea0f66e84856519e08b255fd1010d7f07ad0dabd by grimar
[obj2yaml][yaml2obj] - Stop recognizing SHT_MIPS_ABIFLAGS on non-MIPS targets.

Currently we are always recognizing the `SHT_MIPS_ABIFLAGS` section,
even on non-MIPS targets.

The problem of doing this is briefly discussed in D88228 which does the same for `SHT_ARM_EXIDX`:

"The problem is that `SHT_ARM_EXIDX` shares the value with `SHT_X86_64_UNWIND (0x70000001U)`.
We might have other machine specific conflicts, e.g.

I think we should only recognize target specific sections when the machine type
matches. I.e. `SHT_MIPS_*` should be recognized only on `MIPS`, `SHT_ARM_*`
only on `ARM` etc.

This patch stops recognizing `SHT_MIPS_ABIFLAGS` on `non-MIPS` targets.

Note: I had to update `ScalarEnumerationTraits<ELFYAML::MIPS_ISA>::enumeration`, because
otherwise test crashes, calling `llvm_unreachable`.

Differential revision:
The file was modifiedllvm/tools/obj2yaml/elf2yaml.cpp (diff)
The file was modifiedllvm/test/tools/yaml2obj/ELF/mips-abi-flags.yaml (diff)
The file was modifiedllvm/lib/ObjectYAML/ELFYAML.cpp (diff)
The file was modifiedllvm/test/tools/obj2yaml/ELF/mips-abi-flags.yaml (diff)
Commit cabee89bed69ce37c9e588f9190ed9c33f6bfdee by Raphael Isemann
[lldb] Reference STL types in import-std-module tests

With the recent patches to the ASTImporter that improve template type importing
(D87444), most of the import-std-module tests can now finally import the
type of the STL container they are testing. This patch removes most of the casts
that were added to simplify types to something the ASTImporter can import
(for example, std::vector<int>::size_type was casted to `size_t` until now).
Also adds the missing tests that require referencing the container type (for
example simply printing the whole container) as here we couldn't use a casting

The only casts that remain are in the forward_list tests that reference
the iterator and the stack test. Both tests are still failing to import the
respective container type correctly (or crash while trying to import).
The file was modifiedlldb/test/API/commands/expression/import-std-module/unique_ptr/main.cpp (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/forward_decl_from_module/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/shared_ptr-dbg-info-content/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/vector/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/list/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/forward_list/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/deque-dbg-info-content/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/forward_list-dbg-info-content/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/unique_ptr/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/empty-module/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/weak_ptr-dbg-info-content/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/vector-bool/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/shared_ptr/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/vector-dbg-info-content/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/basic/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/unique_ptr-dbg-info-content/main.cpp (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/weak_ptr/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/deque-basic/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/list-dbg-info-content/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/vector-of-vectors/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/pair/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/conflicts/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/no-std-module/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/queue/ (diff)
The file was modifiedlldb/test/API/commands/expression/import-std-module/sysroot/ (diff)
Commit dab991716483f2b80bf8dbf8e7ba26ba3d49855d by grimar
[yaml2obj][obj2yaml] - Add a support for SHT_ARM_EXIDX section.

This adds the support for SHT_ARM_EXIDX sections to obj2yaml/yaml2obj tools.

SHT_ARM_EXIDX is a ARM specific index table filled with entries.
Each entry consists of two 4-bytes values (words).

Differential revision:
The file was addedllvm/test/tools/yaml2obj/ELF/arm-exidx-section.yaml
The file was addedllvm/test/tools/obj2yaml/ELF/arm-exidx-section.yaml
The file was modifiedllvm/test/tools/llvm-readobj/ELF/ARM/unwind-non-relocatable.test (diff)
The file was modifiedllvm/lib/ObjectYAML/ELFYAML.cpp (diff)
The file was modifiedllvm/lib/ObjectYAML/ELFEmitter.cpp (diff)
The file was modifiedllvm/include/llvm/ObjectYAML/ELFYAML.h (diff)
The file was modifiedllvm/tools/obj2yaml/elf2yaml.cpp (diff)