SuccessChanges

Summary

  1. [BuildLibCalls] Add argmemonly to more lib calls. (details)
  2. [mlir][Linalg] Enhance Linalg fusion on generic op and tensor_reshape op. (details)
  3. [NFC][asan] Don't unwind stack before pool check (details)
  4. [DSE,MemorySSA] Add memcmp test case. (details)
  5. [BasicAA] Add first libfunc tests with memcmp. (details)
  6. [MemLoc] Support memcmp in MemoryLocation::getForArgument. (details)
  7. [cmake] Don't build with -O3 -fPIC on Solaris/sparcv9 (details)
  8. [doxygen] Fix bad doxygen results for BugReporterVisitors.h (details)
  9. [lldb] Reduce intentation in SymbolFileDWARF::ParseVariableDIE (details)
  10. [lldb/Utility] Polish the Scalar class (details)
  11. [DSE,MemorySSA] Check if Current is valid for elimination first. (details)
  12. [clang-format] Parse volatile as a pointer qualifier (details)
  13. [clang-format] Parse restrict as a pointer qualifier (details)
  14. [clang-format] Parse __attribute((foo)) as a pointer qualifier (details)
  15. [clang-format] Parse nullability attributes as a pointer qualifier (details)
  16. [clang-format] Detect pointer qualifiers in cast expressions (details)
  17. [AArch64][CodeGen] Restrict bfloat vector operations to what's actually supported (details)
  18. [FunctionAttrs] Bulk remove attributes. NFC. (details)
Commit 20e989e9de6abcf9a684978a2688acc4ea01036f by flo
[BuildLibCalls] Add argmemonly to more lib calls.

strspn, strncmp, strcspn, strcasecmp, strncasecmp, memcmp, memchr,
memrchr, memcpy, memmove, memcpy, mempcpy, strchr, strrchr, bcmp
should all only access memory through their arguments.

I broke out strcoll, strcasecmp, strncasecmp because the result
depends on the locale, which might get accessed through memory.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D86724
The file was modifiedllvm/lib/Transforms/Utils/BuildLibCalls.cpp
The file was modifiedllvm/test/Transforms/InferFunctionAttrs/annotate.ll
Commit eb4efa883212352b2b32ba8aca8525ad17898ed4 by hanchung
[mlir][Linalg] Enhance Linalg fusion on generic op and tensor_reshape op.

The tensor_reshape op was only fusible only if it is a collapsing case. Now we
propagate the op to all the operands so there is a further chance to fuse it
with generic op. The pre-conditions are:

1) The producer is not an indexed_generic op.
2) All the shapes of the operands are the same.
3) All the indexing maps are identity.
4) All the loops are parallel loops.
5) The producer has a single user.

It is possible to fuse the ops if the producer is an indexed_generic op. We
still can compute the original indices. E.g., if the reshape op collapses the d0
and d1, we can use DimOp to get the width of d1, and calculate the index
`d0 * width + d1`. Then replace all the uses with it. However, this pattern is
not implemented in the patch.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D86314
The file was modifiedmlir/lib/Dialect/Linalg/Transforms/Fusion.cpp
The file was modifiedmlir/test/Dialect/Linalg/fusion-tensor.mlir
The file was modifiedmlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
Commit 6cf72ad3b3d4e475a25b7879f28996a78c8f62e5 by Vitaly Buka
[NFC][asan] Don't unwind stack before pool check
The file was modifiedcompiler-rt/lib/asan/asan_malloc_linux.cpp
Commit bfbd63d51a7b3930482637d867e15014088ba711 by flo
[DSE,MemorySSA] Add memcmp test case.
The file was modifiedllvm/test/Transforms/DeadStoreElimination/MSSA/libcalls.ll
Commit 85dacca29f8280fe72ee00adf3678ba06a9e2348 by flo
[BasicAA] Add first libfunc tests with memcmp.
The file was addedllvm/test/Analysis/BasicAA/libfuncs.ll
Commit fd6ebea50db5257381d44258c1ff76a9b5da0f0b by flo
[MemLoc] Support memcmp in MemoryLocation::getForArgument.

This patch adds support for memcmp in MemoryLocation::getForArgument.
memcmp reads from the first 2 arguments up to the number of bytes of the
third argument.

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D86725
The file was modifiedllvm/test/Analysis/BasicAA/libfuncs.ll
The file was modifiedllvm/test/Transforms/DeadStoreElimination/MSSA/libcalls.ll
The file was modifiedllvm/lib/Analysis/MemoryLocation.cpp
Commit 15c66b10114d239c96282cf8fc5330186178974b by ro
[cmake] Don't build with -O3 -fPIC on Solaris/sparcv9

Tests on Solaris/sparcv9 currently show about 250 failures when building
with gcc, most of them like the following:

  FAIL: LLVM-Unit :: Support/./SupportTests/TaskQueueTest.UnOrderedFutures (4269 of 67884)
  ******************** TEST 'LLVM-Unit :: Support/./SupportTests/TaskQueueTest.UnOrderedFutures' FAILED ********************
  Note: Google Test filter = TaskQueueTest.UnOrderedFutures
  [==========] Running 1 test from 1 test case.
  [----------] Global test environment set-up.
  [----------] 1 test from TaskQueueTest
  [ RUN      ] TaskQueueTest.UnOrderedFutures
  0  SupportTests        0x0000000100753b20 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 32
  1  SupportTests        0x0000000100752974 llvm::sys::RunSignalHandlers() + 68
  2  SupportTests        0x0000000100752b18 SignalHandler(int) + 372
  3  libc.so.1           0xffffffff7eedc800 __sighndlr + 12
  4  libc.so.1           0xffffffff7eecf23c call_user_handler + 852
  5  libc.so.1           0xffffffff7eecf594 sigacthandler + 84
  6  SupportTests        0x00000001006f8cb8 std::thread::_State_impl<std::thread::_Invoker<std::tuple<llvm::ThreadPool::ThreadPool(llvm::ThreadPoolStrategy)::'lambda'()> > >::_M_run() + 512
  7  libstdc++.so.6.0.28 0xfffffffc628117cc execute_native_thread_routine + 16
  8  libc.so.1           0xffffffff7eedc6a0 _lwp_start + 0

Since it's effectively impossible to debug such a `SEGV` in a `Release`
build, I tried a `Debug` build instead, only to find that the failures had
gone away.

Further investigation revealed that most of the issue centers around
`llvm/lib/Support/ThreadPool.cpp`.  That file is built with `-O3 -fPIC` in
a `Release` build.  The failure vanishes if

- compiling without `-fPIC`
- compiling with `-O -fPIC`
- linking with GNU `ld` instead of Solaris `ld`

It has meanwhile been determined that `gcc` doesn't correctly heed some TLS
code sequences.  To make things worse, Solaris `ld` doesn't properly
validate its assumptions against the input, generating wrong code.

`gld` like `gcc` is more liberal here and correctly deals with the code it
gets fed from `gcc`.

There's PR target/96607: GCC feeds SPARC/Solaris linker with unrecognized
TLS sequences <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96607> now.

An attempt to build with `-DLLVM_ENABLE_PIC=Off` initially failed since
neither `libRemarks.so` (D85626 <https://reviews.llvm.org/D85626>) nor
`LLVMPolly.so` (D85627 <https://reviews.llvm.org/D85627>) heed that option.
Even with that fixed, a few codegen failures remain.

Next I tried to build just `ThreadPool.cpp` with `-O -fPIC`.  While that
fixed the vast majority of the failures, 16 `LLVM :: CodeGen/X86` failures
remained.

Given that that solution was both incomplete and fragile, I went for
building the whole tree with `-O -fPIC` for `Release` and `RelWithDebInfo`
builds.

As detailed in Bug 47304, 2-stage builds also show large numbers of
failures when building with `-O3` or `-O2`, which are likewise worked
around by building with `-O` until they are sufficiently analyzed and
fixed.

This way, all failures relative to a `Debug` build go away.

Tested on `sparcv9-sun-solaris2.11`.

Differential Revision: https://reviews.llvm.org/D85630
The file was modifiedllvm/cmake/modules/HandleLLVMOptions.cmake
Commit 9300ca541164b80efb7d42dc45219b5d8e05de68 by vsavchenko
[doxygen] Fix bad doxygen results for BugReporterVisitors.h

`{@code xxxxx}` triggers a Doxygen bug. The bug may be matching the
close brace with the open brace of the namespace
declaration (`namespace clang {` or `namespace ento {`).

Differential Revision: https://reviews.llvm.org/D85105
The file was modifiedclang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h
Commit 1f9595ede48d694b8506d22fd71f7ce13e00dafa by pavel
[lldb] Reduce intentation in SymbolFileDWARF::ParseVariableDIE

using early exits. NFC.
The file was modifiedlldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Commit 9b50546b0b4087ec2ee8479d68e70b89c7956aaa by pavel
[lldb/Utility] Polish the Scalar class

This patch is mostly about removing the "Category" enum, which was
very useful when the Type enum contained a large number of types, but
now the two are completely identical.

It also removes some other artifacts like unused typedefs and macros.
The file was modifiedlldb/include/lldb/Utility/Scalar.h
The file was modifiedlldb/source/Utility/Scalar.cpp
Commit 43aa7227dfab8f847a346ce6da7318584182ddf1 by flo
[DSE,MemorySSA] Check if Current is valid for elimination first.

This changes getDomMemoryDef to check if a Current is a valid
candidate for elimination before checking for reads. Before the change,
we were spending a lot of compile-time in checking for read accesses for
Current that might not even be removable.

This patch flips the logic, so we skip Current if they cannot be
removed before checking all their uses. This is much more efficient in
practice.

It also adds a more aggressive limit for checking partially overlapping
stores. The main problem with overlapping stores is that we do not know
if they will lead to elimination until seeing all of them. This patch
limits adds a new limit for overlapping store candidates, which keeps
the number of modified overlapping stores roughly the same.

This is another substantial compile-time improvement (while also
increasing the number of stores eliminated). Geomean -O3 -0.67%,
ReleaseThinLTO -0.97%.

http://llvm-compile-time-tracker.com/compare.php?from=0a929b6978a068af8ddb02d0d4714a2843dd8ba9&to=2e630629b43f64b60b282e90f0d96082fde2dacc&stat=instructions

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D86487
The file was modifiedllvm/test/Transforms/DeadStoreElimination/MSSA/combined-partial-overwrites.ll
The file was modifiedllvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
The file was modifiedllvm/test/Transforms/DeadStoreElimination/MSSA/multiblock-overlap.ll
The file was modifiedllvm/test/Transforms/DeadStoreElimination/MSSA/debug-counter.ll
The file was modifiedllvm/test/Transforms/DeadStoreElimination/MSSA/simple.ll
The file was modifiedllvm/test/Transforms/DeadStoreElimination/MSSA/memoryssa-scan-limit.ll
Commit 1908da2658fc26154e4103a50faeeca804c7c57d by Alexander.Richardson
[clang-format] Parse volatile as a pointer qualifier

Before: void f() { MACRO(A * volatile a); }
After:  void f() { MACRO(A *volatile a); }

Also check that the __volatile and __volatile__ aliases are handled.

Reviewed By: JakeMerdichAMD

Differential Revision: https://reviews.llvm.org/D86708
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
The file was modifiedclang/unittests/Format/FormatTest.cpp
Commit 4f103695646bb9e16609a276072781f5a933570d by Alexander.Richardson
[clang-format] Parse restrict as a pointer qualifier

Before: void f() { MACRO(A * restrict a); }
After:  void f() { MACRO(A *restrict a); }

Also check that the __restrict and __restrict__ aliases are handled.

Reviewed By: JakeMerdichAMD

Differential Revision: https://reviews.llvm.org/D86710
The file was modifiedclang/unittests/Format/FormatTest.cpp
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
The file was modifiedclang/lib/Format/Format.cpp
Commit 37cdabdb82e33e0d659c92a6cbb7049c31e0acbc by Alexander.Richardson
[clang-format] Parse __attribute((foo)) as a pointer qualifier

Before: void f() { MACRO(A * __attribute((foo)) a); }
After:  void f() { MACRO(A *__attribute((foo)) a); }

Also check that the __attribute__ alias is handled.

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D86711
The file was modifiedclang/unittests/Format/FormatTest.cpp
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
Commit d304360decefae3fa5c807a8cd0d7d4501a1cc4b by Alexander.Richardson
[clang-format] Parse nullability attributes as a pointer qualifier

Before:
void f() { MACRO(A * _Nonnull a); }
void f() { MACRO(A * _Nullable a); }
void f() { MACRO(A * _Null_unspecified a); }

After:
void f() { MACRO(A *_Nonnull a); }
void f() { MACRO(A *_Nullable a); }
void f() { MACRO(A *_Null_unspecified a); }

Reviewed By: JakeMerdichAMD

Differential Revision: https://reviews.llvm.org/D86713
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
The file was modifiedclang/unittests/Format/FormatTest.cpp
Commit 96824abe7d80fc499032dab598968436132fcfb5 by Alexander.Richardson
[clang-format] Detect pointer qualifiers in cast expressions

When guessing whether a closing paren is then end of a cast expression also
skip over pointer qualifiers while looking for TT_PointerOrReference.
This prevents some address-of and dereference operators from being parsed
as a binary operator.

Before:
x = (foo *const) * v;
x = (foo *const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified _Nonnull) & v;

After:
x = (foo *const)*v;
x = (foo *const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified _Nonnull)&v;

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D86716
The file was modifiedclang/lib/Format/FormatToken.h
The file was modifiedclang/lib/Format/TokenAnnotator.cpp
The file was modifiedclang/unittests/Format/FormatTest.cpp
Commit d678e14c55bea734524c2a294c93a7d9c0b8d99f by ties.stuij
[AArch64][CodeGen] Restrict bfloat vector operations to what's actually supported

Previously in addTypeForNeon, we would set the operations for bfloat vectors
like other generic types. But as bfloat is a storage-only type a number of
operations shouldn't be set. This patch fixes that.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D85101
The file was modifiedllvm/test/CodeGen/AArch64/bf16-vector-shuffle.ll
The file was modifiedllvm/lib/Target/AArch64/AArch64ISelLowering.cpp
The file was modifiedllvm/test/CodeGen/AArch64/bf16.ll
The file was modifiedllvm/test/CodeGen/AArch64/bf16-vector-bitcast.ll
Commit dce72dc87040499208ca2e43b6366750431f9a78 by benny.kra
[FunctionAttrs] Bulk remove attributes. NFC.
The file was modifiedllvm/lib/Transforms/IPO/FunctionAttrs.cpp