platform/upstream/llvm.git
20 months ago[InstCombine] add tests for disguised smin/smax; NFC
Sanjay Patel [Sat, 11 Feb 2023 14:26:18 +0000 (09:26 -0500)]
[InstCombine] add tests for disguised smin/smax; NFC

Adapted from the existing umin/umax tests.

20 months ago[bazel][libc] Add a few more missing dependency that show up when parsing headers
Benjamin Kramer [Sun, 12 Feb 2023 12:03:54 +0000 (13:03 +0100)]
[bazel][libc] Add a few more missing dependency that show up when parsing headers

20 months agollvm-tblgen: Apply IWYU in some files
NAKAMURA Takumi [Sun, 12 Feb 2023 03:41:55 +0000 (12:41 +0900)]
llvm-tblgen: Apply IWYU in some files

20 months agoCodeGenTarget.cpp: Reformat.
NAKAMURA Takumi [Sun, 12 Feb 2023 03:03:40 +0000 (12:03 +0900)]
CodeGenTarget.cpp: Reformat.

20 months agoLLVMFuzzerCLI: [CMake] Prune the last PARTIAL_SOURCES_INTENDED to cover all sources.
NAKAMURA Takumi [Fri, 20 Jan 2023 22:33:24 +0000 (07:33 +0900)]
LLVMFuzzerCLI: [CMake] Prune the last PARTIAL_SOURCES_INTENDED to cover all sources.

20 months agoLLVMProcessSources.cmake: Improve PARTIAL_SOURCES_INTENDED.
NAKAMURA Takumi [Mon, 17 May 2021 15:01:30 +0000 (00:01 +0900)]
LLVMProcessSources.cmake: Improve PARTIAL_SOURCES_INTENDED.

The last non-partial-specified target can collect and check source files.

Case A:
  llvm_add_library(foo PARTIAL_SOURCES_INTENDED ...)
  llvm_add_library(bar PARTIAL_SOURCES_INTENDED ...)
  llvm_add_library(baz ...)

  baz checks source files in foo, bar, and baz.

Case B:
  llvm_add_library(hoge PARTIAL_SOURCES_INTENDED ...)
  llvm_add_library(fuga PARTIAL_SOURCES_INTENDED ...)
  llvm_add_library(piyo PARTIAL_SOURCES_INTENDED ...)
  llvm_check_source_file_list() # Explicitly checks sources in hoge, fuga, and piyo.

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

20 months agoReland "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing"
Michael Buch [Sun, 12 Feb 2023 01:49:07 +0000 (01:49 +0000)]
Reland "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing"

This relands the commit previously reverted in
`d2cc2c5610ffa78736aa99512bc85a85417efb0a` due to failures on Linux
when debugging split-debug-info enabled executables.

The problem was we called `SymbolFileDWARF::FindFunctions` directly
instead of `Module::FindFunctions` which resulted in a nullptr
dereference because the backing `SymbolFileDWARFDwo` didn't have
an index attached to it. The relanded version calls `Module::FindFunctions`
instead.

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

20 months ago[test] Remove occurences of br undef in Transform/Util tests [NFC]
Kriti Gupta [Sun, 12 Feb 2023 10:12:25 +0000 (10:12 +0000)]
[test] Remove occurences of br undef in Transform/Util tests [NFC]

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

20 months agoRevert "[C++20] [Modules] [ClangScanDeps] Add ClangScanDeps support for C++20 Named...
NAKAMURA Takumi [Sun, 12 Feb 2023 09:36:11 +0000 (18:36 +0900)]
Revert "[C++20] [Modules] [ClangScanDeps] Add ClangScanDeps support for C++20 Named Modules in P1689 format (2/4)"

This reverts commit de17c665e3f995c7f5a0e453461ce3a1b8aec196.

See also D137527

20 months agoRevert "[C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified...
NAKAMURA Takumi [Sun, 12 Feb 2023 09:35:40 +0000 (18:35 +0900)]
Revert "[C++20] [Modules] [ClangScanDeps] Allow clang-scan-deps to without specified compilation database in P1689 (3/4)"

This reverts commit 591fdcde921334b2d502779006d7c168307a2106.

See also D137527

20 months agoRevert "[ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm"
NAKAMURA Takumi [Sun, 12 Feb 2023 09:34:29 +0000 (18:34 +0900)]
Revert "[ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm"

This reverts commit 79a3803bb2ccdd852436cd1653017a1159a12157.

See also D137527

20 months ago[docs] Make consistent between MLIR tutorial doc and example code
Hsiangkai Wang [Sat, 11 Feb 2023 15:08:00 +0000 (15:08 +0000)]
[docs] Make consistent between MLIR tutorial doc and example code

In MLIR tutorial example code, use `Pure` to remove the side-effects of
operations. Update the document to be consistent with the example code.

Reviewed By: mehdi_amini

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

20 months ago[AArch64] Consider tiny code model in emitLoadFromConstantPool.
Hsiangkai Wang [Sat, 11 Feb 2023 15:17:35 +0000 (15:17 +0000)]
[AArch64] Consider tiny code model in emitLoadFromConstantPool.

We should be able to use load(literal) to access constant pool under
the tiny code model.

Reviewed By: aemerson

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

20 months ago[Clang][perf-training] Remove trailing whitespace in perf-helper
Amir Ayupov [Sun, 12 Feb 2023 05:10:27 +0000 (21:10 -0800)]
[Clang][perf-training] Remove trailing whitespace in perf-helper

20 months ago[AArch64] Use llvm::countr_{zero,one} (NFC)
Kazu Hirata [Sun, 12 Feb 2023 01:53:01 +0000 (17:53 -0800)]
[AArch64] Use llvm::countr_{zero,one} (NFC)

20 months ago[JITLink] Don't initialize local ArrayRefs with initializer lists.
Lang Hames [Sun, 12 Feb 2023 00:52:33 +0000 (16:52 -0800)]
[JITLink] Don't initialize local ArrayRefs with initializer lists.

This can lead to use-after-free errors (see e.g.
https://lab.llvm.org/buildbot/#/builders/168/builds/11848).

20 months ago[RISCV] Remove dead code from RISCVDAGToDAGISel::selectVSETVLI. NFC
Craig Topper [Sun, 12 Feb 2023 00:51:07 +0000 (16:51 -0800)]
[RISCV] Remove dead code from RISCVDAGToDAGISel::selectVSETVLI. NFC

vsetvli no longer has side effects so we don't need code for
handling INSTRINSIC_W_CHAIN.

20 months agoSpecify target triple for bb-prefix-dump.ll
Mircea Trofin [Sat, 11 Feb 2023 16:01:06 +0000 (08:01 -0800)]
Specify target triple for bb-prefix-dump.ll

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

20 months ago[JITLink] Add explicit conversion to silence warnings / errors on bots.
Lang Hames [Sat, 11 Feb 2023 21:11:02 +0000 (13:11 -0800)]
[JITLink] Add explicit conversion to silence warnings / errors on bots.

Commit 10b5fec2563 uses a char -1 value, which triggers narrowing conversion
warnings / errors on some platforms (see e.g.
https://lab.llvm.org/buildbot/#/builders/36/builds/30312). Adding an explicit
conversion should fix this.

20 months ago[libcxx][ranges] mark new join view tests unsupported without experimental flag
Hui [Sat, 11 Feb 2023 20:41:43 +0000 (20:41 +0000)]
[libcxx][ranges] mark new join view tests unsupported without experimental flag

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

20 months ago[RISCV] Fix mistake in comment. NFC
Craig Topper [Sat, 11 Feb 2023 20:30:32 +0000 (12:30 -0800)]
[RISCV] Fix mistake in comment. NFC

20 months ago[JITLink][ORC] Add LinkGraph::allocateCString method.
Lang Hames [Sat, 11 Feb 2023 19:58:25 +0000 (11:58 -0800)]
[JITLink][ORC] Add LinkGraph::allocateCString method.

Renames the existing allocateString method to allocateContent and adds a pair of
allocateCString methods.

The previous allocateString method did not include a null-terminator. It behaved
the same as allocateContent except with a Twine input, rather than an
ArrayRef<char>. Renaming allocateString to allocateBuffer (overloading the
existing method) makes this clearer.

The new allocateCString methods allocate the given content plus a
null-terminator character, and return a buffer covering both the string and
null-terminator. This makes them suitable for creating c-string content for
jitlink::Blocks.

Existing users of the old allocateString method have been updated to use the
new allocateContent overload.

20 months ago[libc++] fix `shared_ptr`'s incorrect constraints
Hui [Sun, 5 Feb 2023 19:31:30 +0000 (19:31 +0000)]
[libc++] fix `shared_ptr`'s incorrect constraints

Fix several bugs:
1. https://llvm.org/PR60258
   The conversion constructors' constraint `__compatible_with` incorrectly allow array types conversion to scalar types
2. https://llvm.org/PR53368
   The constructor that takes `unique_ptr` are not suffiently constrained.
3. The constructors that take raw pointers incorretly use `__compatible_with`. They have different constraints

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

20 months ago[X86] combineX86ShufflesRecursively - treat ISD::TRUNCATE as faux shuffle
Simon Pilgrim [Sat, 11 Feb 2023 19:16:01 +0000 (19:16 +0000)]
[X86] combineX86ShufflesRecursively - treat ISD::TRUNCATE as faux shuffle

getFauxShuffleMask can't handle ISD::TRUNCATE itself as it can't handle inputs that are larger than the output

Another step towards removing combineX86ShuffleChainWithExtract

20 months ago[libc++] Enable radability-identifier-naming for local variables and fix any problems
Nikolas Klauser [Fri, 10 Feb 2023 15:25:40 +0000 (16:25 +0100)]
[libc++] Enable radability-identifier-naming for local variables and fix any problems

Fixes #60658

Reviewed By: Mordante, #libc

Spies: aheejin, sstefan1, libcxx-commits

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

20 months ago[gn build] Port 3d4e9d5eb0f7
LLVM GN Syncbot [Sat, 11 Feb 2023 18:52:12 +0000 (18:52 +0000)]
[gn build] Port 3d4e9d5eb0f7

20 months ago[JITLink] Add a predicate to test for C-string blocks.
Lang Hames [Sat, 11 Feb 2023 06:27:44 +0000 (22:27 -0800)]
[JITLink] Add a predicate to test for C-string blocks.

20 months ago[ORC] Move ORC-specific object format details into OrcShared.
Lang Hames [Sat, 11 Feb 2023 06:12:11 +0000 (22:12 -0800)]
[ORC] Move ORC-specific object format details into OrcShared.

This allows these details to be shared with JITLink, which is allowed to
depend on the OrcShared library (but not on OrcJIT).

20 months agollvm/utils/TableGen/CodeGenIntrinsics.h: Fix a comment line (since 2006!)
NAKAMURA Takumi [Sat, 11 Feb 2023 18:29:48 +0000 (03:29 +0900)]
llvm/utils/TableGen/CodeGenIntrinsics.h: Fix a comment line (since 2006!)

20 months ago[libc++][NFC] Reorganize the std::pair constructor tests to be more consistently...
Louis Dionne [Sat, 11 Feb 2023 18:16:30 +0000 (10:16 -0800)]
[libc++][NFC] Reorganize the std::pair constructor tests to be more consistently named

This makes it much easier to figure out what is and what isn't
implemented.

20 months agoLLVMTableGenGlobalISel: Provide `INTERFACE_INCLUDE_DIRECTORIES`
NAKAMURA Takumi [Sat, 11 Feb 2023 18:01:10 +0000 (03:01 +0900)]
LLVMTableGenGlobalISel: Provide `INTERFACE_INCLUDE_DIRECTORIES`

Its user may include its headers as `GlobalISel/*.h`

20 months ago[libc++][NFC] Change some std::pair tests from .compile.fail.cpp to .verify.cpp
Louis Dionne [Sat, 11 Feb 2023 17:41:56 +0000 (09:41 -0800)]
[libc++][NFC] Change some std::pair tests from .compile.fail.cpp to .verify.cpp

Those tests are arguably not great anyways, but it's better to have
then as .verify tests than compile failure tests, which are too brittle.

20 months ago[libc++] Remove _LIBCPP_CONSTEVAL
Nikolas Klauser [Sat, 11 Feb 2023 10:54:55 +0000 (11:54 +0100)]
[libc++] Remove _LIBCPP_CONSTEVAL

All supported compilers support `consteval`, so there is no more need for the macro.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

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

20 months ago[libc++][NFC] Fix leftover #endif comments
Louis Dionne [Sat, 11 Feb 2023 17:25:16 +0000 (09:25 -0800)]
[libc++][NFC] Fix leftover #endif comments

20 months ago[libc++][NFC] Use using instead of typedef in pair.h
Louis Dionne [Sat, 11 Feb 2023 17:20:20 +0000 (09:20 -0800)]
[libc++][NFC] Use using instead of typedef in pair.h

20 months ago[libc++][NFC] Always define __non_trivially_copyable_base in pair.h
Louis Dionne [Sat, 11 Feb 2023 17:18:03 +0000 (09:18 -0800)]
[libc++][NFC] Always define __non_trivially_copyable_base in pair.h

Only the actual inheritance needs to be guarded.

20 months ago[libc++][NFC] Use std:: instead of _VSTD:: in pair.h
Louis Dionne [Sat, 11 Feb 2023 17:17:14 +0000 (09:17 -0800)]
[libc++][NFC] Use std:: instead of _VSTD:: in pair.h

20 months ago[libc++][NFC] Use >= 23 instead of > 20 in pair.h
Louis Dionne [Sat, 11 Feb 2023 17:15:57 +0000 (09:15 -0800)]
[libc++][NFC] Use >= 23 instead of > 20 in pair.h

20 months ago[libc++][NFC] Use std:: instead of _VSTD:: in construct_at.h
Louis Dionne [Sat, 11 Feb 2023 16:44:19 +0000 (08:44 -0800)]
[libc++][NFC] Use std:: instead of _VSTD:: in construct_at.h

20 months ago[libc] Update dependency for __support_fputil_nearest_integer in bazel overlay.
Tue Ly [Sat, 11 Feb 2023 15:47:42 +0000 (10:47 -0500)]
[libc] Update dependency for __support_fputil_nearest_integer in bazel overlay.

20 months ago[libc++][ranges] move all range iterators back in class
Hui [Sat, 4 Feb 2023 17:09:17 +0000 (17:09 +0000)]
[libc++][ranges] move all range iterators back in class

move all range iterators back in class, as out of class iterators
requires extra template parameters, which changes ADL

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

20 months ago[libcxx][ranges] revert join_view::iterator and sentinel to be in-class
Hui [Sat, 28 Jan 2023 14:36:56 +0000 (14:36 +0000)]
[libcxx][ranges] revert join_view::iterator and sentinel to be in-class

20 months ago[X86][Win64] Precommit test for D143812
Markus Böck [Sat, 11 Feb 2023 14:02:15 +0000 (15:02 +0100)]
[X86][Win64] Precommit test for D143812

20 months ago[X86] combineVectorInsert - pull out Vec/Scl/Idx operands. NFC.
Simon Pilgrim [Sat, 11 Feb 2023 14:02:00 +0000 (14:02 +0000)]
[X86] combineVectorInsert - pull out Vec/Scl/Idx operands. NFC.

These will be reused in a future patch

20 months ago[X86] combineX86ShufflesRecursively - don't widen shuffle subvector inputs
Simon Pilgrim [Sat, 11 Feb 2023 13:23:04 +0000 (13:23 +0000)]
[X86] combineX86ShufflesRecursively - don't widen shuffle subvector inputs

combineX86ShuffleChain and combineX86ShuffleChainWithExtract no longer require the shuffle inputs to be the same width as the root vector, so we can stop generating widening nodes on the fly (combineX86ShuffleChain should handles all of this).

This requires a couple of additional folds to avoid a couple of notable regressions:

getFauxShuffleMask - recognise INSERT_SUBVECTOR(X,Y,C) as a shuffle pattern as long as its not just widening the subvector.

combineConcatVectorOps - folds CONCAT_VECTORS(AssertSext(X,Ty),AssertSext(Y,Ty)) -> AssertSext(CONCAT_VECTORS(X,Y),Ty)

One of the final stages towards fixing Issue #45319 and addressing the regressions in the interleaved tests in D127115

20 months agoReland "[mlir][func] Use the generated pass options in func to llvm."
Tobias Gysi [Sat, 11 Feb 2023 11:27:50 +0000 (12:27 +0100)]
Reland "[mlir][func] Use the generated pass options in func to llvm."

Update the FuncToLLVM pass to use the generated constructors and
the generated pass option struct. The hand written constructor
got out of sync after some refactorings. Using a generated constructor
and options struct ensures the everything remains in sync.

Reviewed By: zero9178

This reverts commit 39da46826da82c24ca4407c13ad7feb8e5dc32a1
and relands commit 771d9c05afc2515b474fb53db857716dfdfc1dcf

which was originally reverted due to
https://lab.llvm.org/buildbot#builders/61/builds/39694

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

20 months ago[MLGO] Disable BB Profile Dump Test on NVPTX
Aiden Grossman [Sat, 11 Feb 2023 11:05:11 +0000 (03:05 -0800)]
[MLGO] Disable BB Profile Dump Test on NVPTX

20 months ago[MLGO] Enable BB Profile Dump Test without TFLite
Aiden Grossman [Sat, 11 Feb 2023 10:38:37 +0000 (02:38 -0800)]
[MLGO] Enable BB Profile Dump Test without TFLite

In the very initial version of the patch that introduced this test I had
it only being conditionally compiled when in MLGO development mode (ie
when HAVE_TFLITE is true), but after some revision it is enabled all the
time and thus should be tested all the time. This patch fixes this
leftover behavior that should've been fixed in the original change set.

20 months agoRevert "[mlir][func] Use the generated pass options in func to llvm."
Tobias Gysi [Sat, 11 Feb 2023 09:42:20 +0000 (10:42 +0100)]
Revert "[mlir][func] Use the generated pass options in func to llvm."

The commit breaks the mlir-vulkan runner:
https://lab.llvm.org/buildbot#builders/61/builds/39694

This reverts commit 771d9c05afc2515b474fb53db857716dfdfc1dcf.

20 months ago[mlir][func] Use the generated pass options in func to llvm.
Tobias Gysi [Sat, 11 Feb 2023 09:31:19 +0000 (10:31 +0100)]
[mlir][func] Use the generated pass options in func to llvm.

Update the FuncToLLVM pass to use the generated constructors and
the generated pass option struct. The hand written constructor
got out of sync after some refactorings. Using a generated constructor
and options struct ensures the everything remains in sync.

Reviewed By: zero9178

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

20 months ago[DFAPacketizer] Move DefaultVLIWScheduler class declaration to header file
Darshan Bhat [Sat, 11 Feb 2023 08:12:29 +0000 (13:42 +0530)]
[DFAPacketizer] Move DefaultVLIWScheduler class declaration to header file

This change moves "DefaultVLIWScheduler" class declaration from
DFAPacketizer.cpp to DFAPacketizer.h.
This is needed because there is a protected class member of
type "DefaultVLIWScheduler*" in "VLIWPacketizerList" class.
The derived classes cannot use this memeber unless declaration
is available to it. More specifically :

// Without this change

```
class HexagonPacketizerList : public VLIWPacketizerList {
  public :
HexagonPacketizerList() {
// Below line will cause incomplete class error since
// declaration was not available through header.
VLIWScheduler->schedule();
  }
}
```

Reviewed By: kparzysz

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

20 months ago[clang] Add test for CWG1111
Vlad Serebrennikov [Sat, 11 Feb 2023 07:52:26 +0000 (10:52 +0300)]
[clang] Add test for CWG1111

Also mark [[ https://wg21.link/cwg2385 | CWG2385 ]] as `na`, because it eliminates wording inconsistency introduced by [[ https://wg21.link/cwg1111 | CWG1111 ]] resolution.

Reviewed By: #clang-language-wg, erichkeane

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

20 months ago[clang][NFC] Add another example to CWG952 test
Vlad Serebrennikov [Sat, 11 Feb 2023 07:25:19 +0000 (10:25 +0300)]
[clang][NFC] Add another example to CWG952 test

20 months ago[clang] Mark CWG2165 as N/A
Vlad Serebrennikov [Sat, 11 Feb 2023 06:42:48 +0000 (09:42 +0300)]
[clang] Mark CWG2165 as N/A

[[ https://wg21.link/p1787 | P1787 ]]: "CWG2165 is resolved by removing the conflicting definition of it in [basic.scope]."
Wording: [basic.namespace]/p1 changed and [basic.scope.declarative] removed entirely

Reviewed By: #clang-language-wg, cor3ntin

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

20 months agoRevert "[clang] Mark CWG2165 as N/A"
Vlad Serebrennikov [Sat, 11 Feb 2023 06:48:40 +0000 (09:48 +0300)]
Revert "[clang] Mark CWG2165 as N/A"

This reverts commit d0e24f0c97ecf4f4e72604adcae5cd4c6b02cb48.

20 months ago[clang] Mark CWG2165 as N/A
Vlad Serebrennikov [Sat, 11 Feb 2023 06:42:48 +0000 (09:42 +0300)]
[clang] Mark CWG2165 as N/A

[[ https://wg21.link/p1787 | P1787 ]]: "CWG2165 is resolved by removing the conflicting definition of it in [basic.scope]."
Wording: [basic.namespace]/p1 changed and [basic.scope.declarative] removed entirely

Reviewed By: #clang-language-wg, cor3ntin

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

20 months ago[libc] Update macros/optimization.h build dependency for CMake and Bazel.
Tue Ly [Sat, 11 Feb 2023 05:46:42 +0000 (00:46 -0500)]
[libc] Update macros/optimization.h build dependency for CMake and Bazel.

Update macros/optimization.h build dependency for CMake and Bazel.

Reviewed By: sivachandra

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

20 months ago[libc][Obvious] Fix static method declarations for FEnv class on macOS.
Tue Ly [Sat, 11 Feb 2023 06:17:57 +0000 (01:17 -0500)]
[libc][Obvious] Fix static method declarations for FEnv class on macOS.

20 months ago[libc] Fix the regex detecting architecture triplet for macOS.
Tue Ly [Sat, 11 Feb 2023 06:11:06 +0000 (01:11 -0500)]
[libc] Fix the regex detecting architecture triplet for macOS.

Summary: See https://github.com/llvm/llvm-project/issues/60666

Reviewers:

Subscribers:

20 months ago[CMake] Use `LLVM_ENABLE_ASSERTIONS` to enable assertions in `libc++`
Argyrios Kyrtzidis [Wed, 8 Feb 2023 23:34:44 +0000 (15:34 -0800)]
[CMake] Use `LLVM_ENABLE_ASSERTIONS` to enable assertions in `libc++`

Follow-up to https://reviews.llvm.org/D142279 for also enabling `libc++` assertions.
This is particularly useful to recover the assertion checks we had with `llvm::Optional`, before moving to `std::optional`.

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

20 months ago[lldb] Fix passing None as an env variable in TestMultipleDebuggers
Augusto Noronha [Sat, 11 Feb 2023 01:32:48 +0000 (17:32 -0800)]
[lldb] Fix passing None as an env variable in TestMultipleDebuggers

20 months agoAdapt TestCustomShell and TestMultipleDebuggers to run under ASAN
Augusto Noronha [Fri, 10 Feb 2023 19:21:14 +0000 (11:21 -0800)]
Adapt TestCustomShell and TestMultipleDebuggers to run under ASAN

In situations where only LLDB is ASANified, a false positive occurs
unless ASAN_OPTIONS=detect_container_overflow=0 is set in the
environment.

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

20 months ago[lldb] Add an SB API to get progress events as SBStructuredData
Jonas Devlieghere [Fri, 10 Feb 2023 19:55:02 +0000 (11:55 -0800)]
[lldb] Add an SB API to get progress events as SBStructuredData

This is a preparatory patch to add an SB API to get the progress data as
SBStructuredData. The advantage of using SBStructuredData is that the
dictionary can grow over time with more fields.

This approach is identical to the way this is implemented for diagnostic
events.

Differential revision: https://reviews.llvm.org/D143687

20 months ago[mlir][sparse] implement lowering rules for sparse_tensor::unpack
Peiming Liu [Thu, 9 Feb 2023 20:31:51 +0000 (20:31 +0000)]
[mlir][sparse] implement lowering rules for sparse_tensor::unpack

Reviewed By: aartbik

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

20 months ago[mlir][sparse] introduce sparse_tensor::unpack operation
Peiming Liu [Thu, 9 Feb 2023 19:08:36 +0000 (19:08 +0000)]
[mlir][sparse] introduce sparse_tensor::unpack operation

An inverse operation of sparse_tenosr::pack

Reviewed By: aartbik

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

20 months ago[libc++] Remove unused std::function test
Louis Dionne [Sat, 11 Feb 2023 00:46:55 +0000 (16:46 -0800)]
[libc++] Remove unused std::function test

We don't support std::function in C++03 anymore, and the test had
started failing due to compilation errors instead of the ABI bug it
was supposed to demonstrate.

20 months ago[dfsan] Fix some build-libc-list.py lint issues
Fangrui Song [Sat, 11 Feb 2023 00:48:34 +0000 (16:48 -0800)]
[dfsan] Fix some build-libc-list.py lint issues

20 months ago[mlir][sparse] fixed pack op documentation and purity
Aart Bik [Thu, 9 Feb 2023 21:55:18 +0000 (13:55 -0800)]
[mlir][sparse] fixed pack op documentation and purity

Example did not have correct shapes. Also the operation
has no side effects (since it slaps a clean SSA tensor
around the data).

Reviewed By: Peiming, wrengr

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

20 months ago[SanitizerBinaryMetadata] Fix ignorelist test with -Assert
Marco Elver [Fri, 10 Feb 2023 23:31:52 +0000 (00:31 +0100)]
[SanitizerBinaryMetadata] Fix ignorelist test with -Assert

%clang and %clang_cc1 have different behaviour, and with -Assert %clang
seems to not match +Assert behaviour. Fix it by switching to %clang_cc1
for the test.

Fixes: 421215b919d0 ("[SanitizerBinaryMetadata] Support ignore list")

20 months ago[flang] Do not print backtrace for most TODOs.
Slava Zakharin [Fri, 10 Feb 2023 16:56:30 +0000 (08:56 -0800)]
[flang] Do not print backtrace for most TODOs.

There are two ways to interrupt flang when a TODO is hit: abort or
exit with non-zero exit code. Abort implies printing the backtrace
and "PLEASE submit a bug report" message. We used to use abort
only in debug compiler build. Since the TODOs are already known
problems it may be counterproductive to ask debug compiler users
to submit bug reports. In addition, the TODO messages are pretty
self-explanatory, so the backtrace printing seems to be redundant.

This change makes all TODOs non-aborting. I added TODO_.*TRACE macros
for TODOs that may benefit from the backtrace and the "bug report"
message in the debug compiler. These macros are currently unused.

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

20 months agoRevert "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing"
Michael Buch [Fri, 10 Feb 2023 23:02:57 +0000 (23:02 +0000)]
Revert "[lldb][DWARFASTParserClang] Attach linkage name to ctors/dtors if missing"

This reverts commit b296ddd91cb8e7676b3c38ca7f6d7bdbd84eb4af.

20 months agoRevert "[lldb][Test] TestExternalCtorDtorLookup.py: skip on Windows and dwo"
Michael Buch [Fri, 10 Feb 2023 23:02:50 +0000 (23:02 +0000)]
Revert "[lldb][Test] TestExternalCtorDtorLookup.py: skip on Windows and dwo"

This reverts commit f889d6f9d05b2b1bd188ddf40b3d38a3488c212e.

20 months ago[libc++] Simplify non_default_alloc
Louis Dionne [Fri, 10 Feb 2023 23:00:52 +0000 (15:00 -0800)]
[libc++] Simplify non_default_alloc

Also, since it is only used in two tests that are C++11/C++14 tests only,
I don't think it is worth keeping around in test_allocator.h.

20 months ago[Driver] Stop stack use after free
Alex Brachet [Fri, 10 Feb 2023 22:39:29 +0000 (22:39 +0000)]
[Driver] Stop stack use after free

In reality this would have always been fine because main's
stack frame will always be live when another thread is
executing the cc1_reproducer_main. But ASan and HWASan
were upset

20 months ago[bazel] Fix {clang,llvm}/unittests
Fangrui Song [Fri, 10 Feb 2023 22:41:21 +0000 (14:41 -0800)]
[bazel] Fix {clang,llvm}/unittests

20 months ago[libunwind] On Darwin, add a callback-based lookup scheme for JIT'd unwind info.
Lang Hames [Fri, 20 Jan 2023 04:45:05 +0000 (20:45 -0800)]
[libunwind] On Darwin, add a callback-based lookup scheme for JIT'd unwind info.

This commit adds support for a new callback-based lookup scheme for unwind
info that was inspired by the `_dyld_find_unwind_info_sections` SPI that
libunwind uses to find unwind-info in non-JIT'd frames. From
llvm-project/libunwind/src/AddressSpace.hpp:

```
struct dyld_unwind_sections {
  const struct mach_header*   mh;
  const void*                 dwarf_section;
  uintptr_t                   dwarf_section_length;
  const void*                 compact_unwind_section;
  uintptr_t                   compact_unwind_section_length;
};

extern bool _dyld_find_unwind_sections(void *, dyld_unwind_sections *);
```

During unwinding libunwind calls `_dyld_find_unwind_sections` to both find
unwind section addresses and identify the subarchitecture for frames (via the
MachO-header pointed to by the mh field).

This commit introduces two new libunwind SPI functions:

```
struct unw_dynamic_unwind_sections {
  unw_word_t dso_base;
  unw_word_t dwarf_section;
  size_t     dwarf_section_length;
  unw_word_t compact_unwind_section;
  size_t     compact_unwind_section_length;
};

typedef int (*unw_find_dynamic_unwind_sections)(
    unw_word_t addr, struct unw_dynamic_unwind_sections *info);

// Returns UNW_ESUCCESS if successfully registered, UNW_EINVAL for duplicate
// registrations, and UNW_ENOMEM to indicate too many registrations.
extern int __unw_add_find_dynamic_unwind_sections(
    unw_find_dynamic_unwind_sections find_dynamic_unwind_sections);

// Returns UNW_ESUCCESS if successfully deregistered, UNW_EINVAL to indicate
// no such registration.
extern int __unw_remove_find_dynamic_unwind_sections(
    unw_find_dynamic_unwind_sections find_dynamic_unwind_sections);
```

These can be used to register and deregister callbacks that have a similar
signature to `_dyld_find_unwind_sections`. During unwinding if
`_dyld_find_unwind_sections` returns false (indicating that no frame info
was found by dyld) then registered callbacks are run in registration order until
either the unwind info is found or the end of the list is reached.

With this commit, and by implementing the find-unwind-info callback in the ORC
runtime in LLVM, we (1) enable support for registering JIT'd compact-unwind info
with libunwind*, (2) provide a way to identify the subarchitecture for each frame
(by returning a pointer to a JIT'd MachO header), and (3) delegate tracking of
unwind info to the callback, which may be able to implement more efficient
address-based lookup than libunwind.

* JITLink does not process or register compact unwind info yet, so this patch
  does not fully enable compact unwind info in ORC, it simply provides some
  necessary plumbing. JITLink support for compact unwind should land some time
  in the LLVM 17 development cycle.

Reviewed By: pete

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

20 months ago[openmp] Fix building z_Linux_asm.S for armv5t
Martin Storsjö [Thu, 9 Feb 2023 22:40:48 +0000 (00:40 +0200)]
[openmp] Fix building z_Linux_asm.S for armv5t

Don't use the ldrd instruction; that one requires armv5te. Instead
do two separate loads (or only one if OMPT_SUPPORT isn't defined).

This should fix https://github.com/llvm/llvm-project/issues/60370.

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

20 months ago[MLIR] Reintroduce shared attribute names in the LLVM dialect
Frederik Gossen [Fri, 10 Feb 2023 20:24:06 +0000 (15:24 -0500)]
[MLIR] Reintroduce shared attribute names in the LLVM dialect

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

20 months ago[InstCombine] Add tests for D143766. NFC
Craig Topper [Fri, 10 Feb 2023 20:43:25 +0000 (12:43 -0800)]
[InstCombine] Add tests for D143766. NFC

20 months ago[AMDGPU] Add GFX11 HW_REG_PERF_SNAPSHOT_*
Jay Foad [Fri, 10 Feb 2023 15:43:44 +0000 (15:43 +0000)]
[AMDGPU] Add GFX11 HW_REG_PERF_SNAPSHOT_*

These are similar to hardware registers already added for GFX940,
but with different numbers and slightly different names.

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

20 months ago[mlir][tosa] Add TOSA f64 type support for cast op
AmosLewis [Fri, 10 Feb 2023 20:12:50 +0000 (12:12 -0800)]
[mlir][tosa] Add TOSA f64 type support for cast op

Add TOSA f64 type support for cast op

Reviewed By: eric-k256

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

20 months ago[mlir] Port Conversion Passes to LLVM to use TableGen generated constructors and...
Markus Böck [Fri, 10 Feb 2023 19:40:38 +0000 (20:40 +0100)]
[mlir] Port Conversion Passes to LLVM to use TableGen generated constructors and options

See https://github.com/llvm/llvm-project/issues/57475 for more context.

Using auto-generated constructors and options has significant advantages:
* It forces a uniform style and expectation for consuming a pass
* It allows to very easily add, remove or change options to a pass by simply making the changes in TableGen
* Its less code

This patch in particular ports all the conversion passes which lower to LLVM to use the auto generated constructors and options. For the most part, care was taken so that auto generated constructor functions have the same name as they previously did. Only following slight breaking changes (which I consider as worth the churn) have been made:
* `mlir::cf::createConvertControlFlowToLLVMPass` has been moved to the `mlir` namespace. This is consistent with basically all conversion passes
* `createGpuToLLVMConversionPass` now takes a proper options struct array for its pass options. The pass options are now also autogenerated.
* `LowerVectorToLLVMOptions` has been replaced by the autogenerated `ConvertVectorToLLVMPassOptions` which is automatically kept up to date by TableGen
* I had to move one function in the GPU to LLVM lowering as it is used as default value for an option.
* All passes that previously returned `unique_ptr<OperationPass<...>>` now simply return `unique_ptr<Pass>`

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

20 months ago[llvm-driver] Reinvoke clang as described by llvm driver extra args
Alex Brachet [Fri, 10 Feb 2023 19:41:43 +0000 (19:41 +0000)]
[llvm-driver] Reinvoke clang as described by llvm driver extra args

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

20 months ago[llvm-driver] Pass extra arguments to tools
Alex Brachet [Fri, 10 Feb 2023 19:40:56 +0000 (19:40 +0000)]
[llvm-driver] Pass extra arguments to tools

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

20 months ago[Propeller] Change SHT_LLVM_BB_ADDR_MAP version to 2.
Rahman Lavaee [Mon, 6 Feb 2023 21:39:28 +0000 (13:39 -0800)]
[Propeller] Change SHT_LLVM_BB_ADDR_MAP version to 2.

D100808 implemented the new version, but kept version 1 as the
emitted version. This patch changes the version to 2 and updates the
codegen tests.

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

20 months ago[libc++] In tests, use `abort` to terminate upon an error.
Konstantin Varlamov [Fri, 10 Feb 2023 19:31:26 +0000 (11:31 -0800)]
[libc++] In tests, use `abort` to terminate upon an error.

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

20 months agoAMDGPU: Use module flag to get code object version at IR level folow-up
Changpeng Fang [Fri, 10 Feb 2023 19:16:38 +0000 (11:16 -0800)]
AMDGPU: Use module flag to get code object version at IR level folow-up

Summary:
  This is part of the leftover work for https://reviews.llvm.org/D143138.
In this work, we pass code object version as an argument to initialize target ID
and use it for targetID dump.

Reviewers: arsenm

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

20 months agoA slightly more concise AST dump :)
Dani Ferreira Franco Moura [Tue, 31 Jan 2023 11:53:40 +0000 (11:53 +0000)]
A slightly more concise AST dump :)

If the modifiedType and the minimally desugared type of an AttributedType are the same, then we do not need to show both in an AST dump.

Here, we change VisitAttributedType to only visit the modifiedType when it is different from the equivalentType (the minimally desugared type), because the latter is already visited by default.

Reviewed By: sammccall

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

20 months ago[InstCombine] precommit tests for D143593
ManuelJBrito [Fri, 10 Feb 2023 19:04:14 +0000 (19:04 +0000)]
[InstCombine] precommit tests for D143593

20 months ago[mlir][sparse] Sparse reduction in lex order no longer produces dense output
Jim Kitchen [Fri, 10 Feb 2023 19:08:49 +0000 (13:08 -0600)]
[mlir][sparse] Sparse reduction in lex order no longer produces dense output

Previously, when performing a reduction on a sparse tensor, the result
would be different depending on iteration order. For expanded access pattern,
an empty row would contribute no entry in the output. For lex ordering, the
identity would end up in the output.

This code changes that behavior and keeps track of whether any entries were
actually reduced in lex ordering, making the output consistent between the
two iteration styles.

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

20 months ago[libc][math] Update exceptional cases for logf, log10f, log2f, log1pf.
Tue Ly [Fri, 10 Feb 2023 05:10:22 +0000 (00:10 -0500)]
[libc][math] Update exceptional cases for logf, log10f, log2f, log1pf.

Properly set floating point exceptions and add more exceptional
values for non-FMA x86-64 targets.

Reviewed By: michaelrj

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

20 months ago[dfsan] Fix build-libc-list.py for Python 3 after D143701
Fangrui Song [Fri, 10 Feb 2023 18:55:44 +0000 (10:55 -0800)]
[dfsan] Fix build-libc-list.py for Python 3 after D143701

20 months agoFix handling of -> calls for modernize-use-emplace
BigPeet [Fri, 10 Feb 2023 18:36:41 +0000 (18:36 +0000)]
Fix handling of -> calls for modernize-use-emplace

Fixes #55869

Reviewed By: njames93, nicovank

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

20 months ago[lldb][Test] TestExternalCtorDtorLookup.py: skip on Windows and dwo
Michael Buch [Fri, 10 Feb 2023 18:38:09 +0000 (18:38 +0000)]
[lldb][Test] TestExternalCtorDtorLookup.py: skip on Windows and dwo

Also make expected mangling more flexible since it's different
between Linux and Darwin

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

20 months ago[Passes] Remove some legacy passes
Arthur Eubanks [Fri, 10 Feb 2023 01:22:56 +0000 (17:22 -0800)]
[Passes] Remove some legacy passes

Namely CrossDSOCFI and GlobalSplit.

These are part of the optimization pipeline, of which the legacy pass manager version is deprecated.

20 months ago[libc] add standalone strtoint/float fuzzers
Michael Jones [Thu, 9 Feb 2023 00:38:35 +0000 (16:38 -0800)]
[libc] add standalone strtoint/float fuzzers

Fuzzing the string to integer and float functions without relying on the
system libc allows for tests to be run in a wider variety of places.

Reviewed By: sivachandra

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

20 months ago[ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm
Tom Weaver [Fri, 10 Feb 2023 18:29:41 +0000 (18:29 +0000)]
[ClangScanDeps] Add UNSUPPORTED: system-windows to test P1689.cppm

The revert of
  https://reviews.llvm.org/rG65f9719913eca9c7c72d1abf4eddab767abaebf6

removes a system-windows guard but does not remove the test causing windows
system failures. This patch adds back a guard to prevent further failures.

20 months ago[clang-tidy] Clarify documention of `bugprone-unchecked-optional-access`.
Yitzhak Mandelbaum [Fri, 10 Feb 2023 16:53:11 +0000 (16:53 +0000)]
[clang-tidy] Clarify documention of `bugprone-unchecked-optional-access`.

Removes a reference to google-internal document and expands the relevant material in place.

Fixes: #60633.

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

20 months ago[Assignment Tracking] Fix migrateDebuginfo in SROA
OCHyams [Fri, 10 Feb 2023 17:43:29 +0000 (17:43 +0000)]
[Assignment Tracking] Fix migrateDebuginfo in SROA

Without this patch, migrateDebugInfo doesn't understand how to handle existing
fragments that are smaller than the to-be-split store. This can occur
if. e.g. a vector store (1 dbg.assign) is split (many dbg.assigns - 1 fragment
for each scalar) and later those stores are re-vectorized (many dbg.assigns),
and then SROA runs on that.

The approach taken in this patch is to drop intrinsics with fragments outside
of the slice.

For example, starting with:

  store <2 x float> %v, ptr %dest !DIAssignID !1
  call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 0, 32), !1, ...)
  call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 32, 32), !1, ...)

When visiting the slice of bits 0 to 31 we get:

  store float %v.extract.0, ptr %dest !DIAssignID !2
  call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 0, 32), !2, ...)

The other dbg.assign associated with the currently-split store is dropped for
this split part. And visiting bits 32 to 63 we get the following:

  store float %v.extract.1, ptr %adjusted.dest !DIAssignID !3
  call void @llvm.dbg.assign(..., DIExpression(DW_OP_LLVM_fragment, 32, 32), !3, ...)

I've added two tests that cover this case.

Implementing this meant re-writing the fragment-calculation part of
migrateDebugInfo to work with the absolute offset of the new slice in terms of
the base alloca (instead of the offset of the slice into the new alloca), the
fragment (if any) of the variable associated with the base alloca, and the
fragment associated with the split store. Because we need the offset into the
base alloca for the variables being split, some careful wiring is required for
memory intrinsics due to the fact that memory intrinsics can be split when
either the source or dest allocas are split. In the case where the source
alloca drives the splitting, we need to be careful to pass migrateDebugInfo the
information in relation to the dest alloca.

Reviewed By: StephenTozer

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

20 months ago[AArch64] Reassociate sub(x, add(m1, m2)) to sub(sub(x, m1), m2)
David Green [Fri, 10 Feb 2023 18:09:11 +0000 (18:09 +0000)]
[AArch64] Reassociate sub(x, add(m1, m2)) to sub(sub(x, m1), m2)

The mid end will reassociate sub(sub(x, m1), m2) to sub(x, add(m1, m2)). This
reassociates it back to allow the creation of more mls instructions.

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