SuccessChanges

Summary

  1. [NFC] Fix -Wsometimes-uninitialized (details)
  2. ADT: Fix reference invalidation in SmallVector::resize (details)
  3. ADT: Reduce code duplication in SmallVector::resize by using pop_back_n, NFC (details)
  4. ADT: Reduce code duplication in SmallVector by reusing reserve, NFC (details)
  5. [Driver] -gsplit-dwarf: Produce .dwo regardless of -gN for -fthinlto-index= (details)
  6. ADT: Reduce code duplication in SmallVector by calling reserve and clear, NFC (details)
Commit 752fafda3dbf1f4885c64408a13ddb67c91ccb13 by rupprecht
[NFC] Fix -Wsometimes-uninitialized

After 49142991a685bd427d7e877c29c77371dfb7634c, clang detects that MUL may be uninitialized. Set it to nullptr to suppress this check.

Adding an assert to check that it is ultimately set fails two test cases. Since this is not a new issue, leave the assertion commented out until a code owner can fix the bug. The two failing test cases are noted in the assertion comment.
The file was modifiedllvm/lib/Target/AArch64/AArch64InstrInfo.cpp
Commit 260a856c2abcef49c7cb3bdcd999701db3e2af38 by Duncan P. N. Exon Smith
ADT: Fix reference invalidation in SmallVector::resize

For small enough, trivially copyable `T`, take the parameter by-value in
`SmallVector::resize`.  Otherwise, when growing, update the arugment
appropriately.

Differential Revision: https://reviews.llvm.org/D93781
The file was modifiedllvm/unittests/ADT/SmallVectorTest.cpp
The file was modifiedllvm/include/llvm/ADT/SmallVector.h
Commit c224a834583ccbb3f8e8047d409ef3bf356abc01 by Duncan P. N. Exon Smith
ADT: Reduce code duplication in SmallVector::resize by using pop_back_n, NFC
The file was modifiedllvm/include/llvm/ADT/SmallVector.h
Commit 3f98b66f23f9844a61f63ee00a81b9914f9a039d by Duncan P. N. Exon Smith
ADT: Reduce code duplication in SmallVector by reusing reserve, NFC
The file was modifiedllvm/include/llvm/ADT/SmallVector.h
Commit 53b34601abf1d48e8df210ab8127b16fd35e275a by i
[Driver] -gsplit-dwarf: Produce .dwo regardless of -gN for -fthinlto-index=

-g is an IR generation option while -gsplit-dwarf is an object file generation option.
For -gsplit-dwarf in the backend phase of a distributed ThinLTO (-fthinlto-index=) which does object file generation and no IR generation, -g should not be needed.

This patch makes `-fthinlto-index= -gsplit-dwarf` emit .dwo even in the absence of -g.
This should fix https://crbug.com/1158215 after D80391.

```
// Distributed ThinLTO usage
clang -g -O2 -c -flto=thin -fthin-link-bitcode=a.indexing.o a.c
clang -g -O2 -c -flto=thin -fthin-link-bitcode=b.indexing.o b.c
clang -fuse-ld=lld -Wl,--thinlto-index-only=a.rsp -Wl,--thinlto-prefix-replace=';lto/' -Wl,--thinlto-object-suffix-replace='.indexing.o;.o' a.indexing.o b.indexing.o
clang -gsplit-dwarf -O2 -c -fthinlto-index=lto/a.o.thinlto.bc a.o -o lto/a.o
clang -gsplit-dwarf -O2 -c -fthinlto-index=lto/b.o.thinlto.bc b.o -o lto/b.o
clang -fuse-ld=lld @a.rsp -o exe
```

Note: for implicit regular/Thin LTO, .dwo emission works without this patch:
`clang -flto=thin -gsplit-dwarf a.o b.o` passes `-plugin-opt=dwo_dir=` to the linker.
The linker forwards the option to LTO. LTOBackend.cpp emits `$dwo_dir/[01234].dwo`.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D94647
The file was modifiedclang/lib/Driver/ToolChains/Clang.cpp
The file was modifiedclang/test/Driver/split-debug.c
Commit 6ed3083a96541a7483cb02bb3b2f52b1d0a37c84 by Duncan P. N. Exon Smith
ADT: Reduce code duplication in SmallVector by calling reserve and clear, NFC
The file was modifiedllvm/include/llvm/ADT/SmallVector.h