Manna, Soumi [Tue, 18 Apr 2023 00:50:41 +0000 (20:50 -0400)]
[NFC][clang] Fix coverity static analyzer concerns about AUTO_CAUSES_COPY
Reported by Coverity:
AUTO_CAUSES_COPY
Unnecessary object copies can affect performance.
1. [NFC] Fix auto keyword use without an & causes the copy of an object of type SimpleRegistryEntry in clang::getAttributePluginInstances()
2. [NFC] Fix auto keyword use without an & causes the copy of an object of type tuple in CheckStmtInlineAttr<clang::NoInlineAttr, 2>(clang::Sema &, clang::Stmt const *, clang::Stmt const *, clang::AttributeCommonInfo const &)
3. [NFC] Fix auto keyword use without an & causes the copy of an object of type QualType in <unnamed>::SystemZTargetCodeGenInfo::isVectorTypeBased(clang::Type const *, bool)
4. [NFC] Fix auto keyword use without an & causes the copy of an object of type Policy in <unnamed>::RISCVIntrinsicManagerImpl::InitIntrinsicList()
5. [NFC] Fix auto keyword use without an & causes the copy of an object of type pair in checkUndefinedButUsed(clang::Sema &)
Reviewed By: tahonermann
Differential Revision: <https://reviews.llvm.org/D147543>
Slava Zakharin [Sun, 16 Apr 2023 20:21:25 +0000 (13:21 -0700)]
[flang] Added missing _Complex for COMPLEX(10) C reduction API.
I noticed _Complex was missing for the long double case.
I might be missing something, but it looks like the compiler
does not call the C wrappers directly. Do we need to keep
the complex-reduction.[ch] at all?
Differential Revision: https://reviews.llvm.org/D148479
Johannes Doerfert [Tue, 18 Apr 2023 00:57:12 +0000 (17:57 -0700)]
[Attributor][FIX] Ensure to cache all intra procedural AA queries
We failed to cache queries without an exclusion set that resulted in
non-reachable results. That is obviously bad as changes to liveness can
influence the result.
Fixes: https://github.com/llvm/llvm-project/issues/61883
max [Tue, 18 Apr 2023 00:59:08 +0000 (19:59 -0500)]
[MLIR] Patch StandalonePlugin CMake for MacOS
Differential Revision: https://reviews.llvm.org/D148058
Alexander Yermolovich [Tue, 18 Apr 2023 00:48:54 +0000 (17:48 -0700)]
[BOLT][DWARF] Fix handling of CUs without TU reference
When input is DWP with DWARF5 bolt wasn't handling correctly CUs that didn't
have TU references. Which resulted in a crash.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D148589
Noah Goldstein [Tue, 18 Apr 2023 00:49:55 +0000 (19:49 -0500)]
[X86] Fix whitespace issue in CombineSetCC; NFC
Differential Revision: https://reviews.llvm.org/D148595
Vitaly Buka [Tue, 18 Apr 2023 00:37:11 +0000 (17:37 -0700)]
Revert "[sanitizer] Try to fix windows bot"
Not needed.
This reverts commit
e864e6f234b24ae2e05dcc1ea9a516859db9c9b5.
Vitaly Buka [Tue, 18 Apr 2023 00:35:52 +0000 (17:35 -0700)]
[sanitizer] Fix Windows build
Vitaly Buka [Tue, 18 Apr 2023 00:27:45 +0000 (17:27 -0700)]
[sanitizer] Try to fix windows bot
https://lab.llvm.org/buildbot/#/builders/127/builds/46887/steps/4/logs/stdio
Alex Langford [Mon, 17 Apr 2023 23:11:07 +0000 (16:11 -0700)]
[lldb] Change parameter type of StructuredData::ParseJSON
Instead of taking a `const std::string &` we can take an
`llvm::StringRef`. The motivation for this change is that many of the
callers of `ParseJSON` end up creating a temporary `std::string` from an existing
`StringRef` or `const char *` in order to satisfy the API. There's no
reason we need to do this.
Differential Revision: https://reviews.llvm.org/D148579
Vitaly Buka [Tue, 18 Apr 2023 00:19:57 +0000 (17:19 -0700)]
Revert "[VPlan] Unify Value2VPValue and VPExternalDefs maps (NFCI)."
Asan detects heap-use-after-free, see D147892.
This reverts commit
4fc190351e5af901b6107d162d07e1fbca90934f.
This reverts commit
668045eb77628be13e448ffbb855473ffca1cc43.
Prem Chintalapudi [Tue, 18 Apr 2023 00:14:30 +0000 (17:14 -0700)]
Expose PassBuilder extension point callbacks
This patch allows access to callbacks registered by TargetMachines to allow custom pipelines to run those callbacks.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D148561
Vitaly Buka [Tue, 18 Apr 2023 00:08:11 +0000 (17:08 -0700)]
[NFC][sanitizer] Clang-format some includes
Jorge Gorbe Moya [Mon, 17 Apr 2023 23:35:21 +0000 (16:35 -0700)]
[lldb] Build libcxx unique_ptr and shared_ptr test programs with -glldb.
The functionality added by https://reviews.llvm.org/D145803 is gated by
lldb tuning, so we need to build the test programs with `-glldb` to make
these tests print the expected preferred name.
Differential Revision: https://reviews.llvm.org/D148582
Aaron Siddhartha Mondal [Mon, 17 Apr 2023 23:53:46 +0000 (01:53 +0200)]
[Bazel] Use dynamic workspace root determination
The `clang:ast` and `clang:builtin_headers_gen` targets currently use hardcoded `external/llvm-project`
paths to access generated headers.
With bzlmod this path becomes dependent on the module name, module version and module extension,
so we need a more dynamic approach.
Does not affect the WORKSPACE build.
Reviewed By: GMNGeoffrey, #bazel_build
Differential Revision: https://reviews.llvm.org/D137007
Sterling Augustine [Mon, 17 Apr 2023 23:50:29 +0000 (16:50 -0700)]
Make gentable outputs and strip_include_prefix match llvm directory.
Lei Zhang [Mon, 17 Apr 2023 23:29:28 +0000 (16:29 -0700)]
[mlir][linalg] Promote operands for convolution vectorization
We are already doing this for depthwise convolution and pooling.
This helps to preserve the promotion semantics from Linalg op
definitions to lower layers.
Along the way, fixed the type mismatch issue in the existing
`promote` implementation.
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D148471
Vitaly Buka [Mon, 17 Apr 2023 23:35:19 +0000 (16:35 -0700)]
[lsan] Fix Darwin build
Brad Smith [Mon, 17 Apr 2023 23:21:15 +0000 (19:21 -0400)]
[Android] Use ELF TLS for Android API level 29+
Use ELF TLS by default instead of emulated TLS for Android build targets when
the API level is >= 29.
Android Q features full TLS support. See release notes
(https://developer.android.com/preview/features#elf-tls) and implementation details
(https://android.googlesource.com/platform/bionic/+/master/docs/elf-tls.md#Workaround_Use-Variant-2-on-arm32_arm64).
Reviewed By: rprichard, danalbert
Differential Revision: https://reviews.llvm.org/D147849
Vitaly Buka [Mon, 17 Apr 2023 23:29:18 +0000 (16:29 -0700)]
[lsan] Fix Darwin build
Ilya Kuklin [Mon, 17 Apr 2023 22:26:48 +0000 (15:26 -0700)]
[lldb] Add support for MSP430 in LLDB.
Add MSP430 to the list of available targets, implement MSP430 ABI, add support for debugging targets with 16-bit address size.
The update is intended for use with MSPDebug, a GDB server implementation for MSP430.
Reviewed By: bulbazord, DavidSpickett
Differential Revision: https://reviews.llvm.org/D146965
Johannes Doerfert [Mon, 17 Apr 2023 22:53:13 +0000 (15:53 -0700)]
[OpenMP][NFC] Silence warning
chenglin.bi [Mon, 17 Apr 2023 22:49:16 +0000 (06:49 +0800)]
[AMDGPU] Ressociate patterns with sub to use SALU
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D148463
Vitaly Buka [Fri, 14 Apr 2023 23:27:19 +0000 (16:27 -0700)]
[lsan] Don't crash on ThreadRegistry::threads_ data race
Comment "No lock needed" in CurrentThreadContext was wrong.
Concurent ThreadRegistry::CreateThread can resize and relocate
ThreadRegistry::threads_ the same time CurrentThreadContext reads it.
To mitigate lock cost we store ThreadContext* instead of tid in
THREADLOCAL cache, we can tid from the ThreadContext*.
Reviewed By: kstoimenov, MaskRay
Differential Revision: https://reviews.llvm.org/D148281
Johannes Doerfert [Tue, 21 Mar 2023 01:55:05 +0000 (18:55 -0700)]
[OpenMP] Ensure memory fences are created with barriers for AMDGPUs
It turns out that the __builtin_amdgcn_s_barrier() alone does not emit
a fence. We somehow got away with this and assumed it would work as it
(hopefully) is correct on the NVIDIA path where we just emit a
__syncthreads. After talking to @arsenm we now (mostly) align with the
OpenCL barrier implementation [1] and emit explicit fences for AMDGPUs.
It seems this was the underlying cause for #59759, but I am not 100%
certain. There is a chance this simply hides the problem.
Fixes: https://github.com/llvm/llvm-project/issues/59759
[1] https://github.com/RadeonOpenCompute/ROCm-Device-Libs/blob/
07b347366eb2c6ebc3414af323c623cbbbafc854/opencl/src/workgroup/wgbarrier.cl#L21
Alex Langford [Sat, 15 Apr 2023 00:13:55 +0000 (17:13 -0700)]
[lldb] Remove use of ConstString from Args::GetShellSafeArgument
Having the names of various shells in ConstString's StringPool is not
really necessary, especially if they are otherwise not going to be there
in the first place. For example, if the person debugging uses bash on
their system, the `shell` parameter will have its `m_filename` set to a
ConstString containing "bash". However, fish, tcsh, zsh, and sh will
probably never be used and are just taking up space in the StringPool.
Differential Revision: https://reviews.llvm.org/D148402
Alex Langford [Fri, 14 Apr 2023 21:16:26 +0000 (14:16 -0700)]
[lldb] Lock accesses to PathMappingLists's internals
This class is not safe in multithreaded code. It's possible for one
thread to modify a PathMappingList's `m_pair` vector while another
thread is iterating over it, effectively invalidating the iterator and
potentially leading to crashes or other difficult-to-diagnose bugs.
rdar://
107695786
Differential Revision: https://reviews.llvm.org/D148380
Peter Rong [Mon, 17 Apr 2023 19:10:18 +0000 (12:10 -0700)]
[FuzzMutate] RandomIRBuilder has more source and sink type now.
Source and Sink are required when generating a new instruction.
(Term defined by previous author, in LLVM terms it's probably Use and User.)
Previously, only instructions in the same block is considered when taking source and sink.
In this patch, more source and sink types are considered.
For source, we have SrcFromInstInCurBlock, FunctionArgument, InstInDominator, SrcFromGlobalVariable, and NewConstOrStack.
For sink, we have SinkToInstInCurBlock, PointersInDominator, InstInDominatee, NewStore, and SinkToGlobalVariable.
A unit test to make sure source always dominates an instruction, and the instruction always dominates the sink is included.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D139907
Alex Brachet [Mon, 17 Apr 2023 21:38:08 +0000 (21:38 +0000)]
[llvm-driver] Check more specific tools first
We allow tools to be called {tool}-{suffix} to support tools being
called something like clang-17. Many clang tools follow this pattern
too for example, clang-scan-deps. It is pure luck wether clang or
clang-scan-deps will appear first in the LLVMDriverTools.def file. If
the former appears first, clang-scan-deps will match against clang,
which is not preferable. Instead we can control the order that tools
are checked so that we always look at more specific tool names first.
Differential Revision: https://reviews.llvm.org/D148543
Michael Jones [Mon, 17 Apr 2023 21:26:07 +0000 (14:26 -0700)]
[libc][Bazel][NFC] add missing string deps
With the recent move away from StringStream some tests were given a
dependency on cpp::string. Some of these were missed for the bazel
build, causing build failures.
Differential Revision: https://reviews.llvm.org/D148572
Amir Ayupov [Mon, 17 Apr 2023 21:32:18 +0000 (23:32 +0200)]
[BOLT][test] Update AArch64/r_aarch64_prelxx.s test
Update section flags and type after https://reviews.llvm.org/D148386
Reviewed By: #bolt, rafauler, MaskRay
Differential Revision: https://reviews.llvm.org/D148511
Hiroshi Yamauchi [Mon, 17 Apr 2023 20:24:49 +0000 (13:24 -0700)]
[WebAssembly][NFC] Fix typos.
Differential Revision: https://reviews.llvm.org/D148567
Lang Hames [Mon, 17 Apr 2023 21:27:32 +0000 (14:27 -0700)]
[ORC-RT] Check for jit-compatible-osx-swift-runtime on tests that need one.
rdar://
107846455
Niclas Hedam [Mon, 17 Apr 2023 19:50:44 +0000 (22:50 +0300)]
Make BPF stack size overridable
With the emergence of TP 4091 for NVMe, eBPF can be used to offload programs to computational storage processors.
This change introduces the possibility of overriding the default stack size of 512 bytes for non-kernel runtime environments.
Reviewed By: yonghong-song, eddyz87
Differential Revision: https://reviews.llvm.org/D147707
Rahman Lavaee [Mon, 17 Apr 2023 21:15:23 +0000 (21:15 +0000)]
Allow using getters for metadata fields of BBAddrMap::BBEntry.
This is a prequel for D148360.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D148361
Vitaly Buka [Sat, 15 Apr 2023 05:38:58 +0000 (22:38 -0700)]
[test][sanitizer] Add another stress test for pthread_create
Lang Hames [Mon, 17 Apr 2023 20:40:42 +0000 (13:40 -0700)]
[ORC-RT] Don't check for objc image registration functions unless needed.
If we don't have any ObjC metadata to register we shouldn't require these
symbols to be available.
Artem Belevich [Mon, 10 Apr 2023 22:55:39 +0000 (15:55 -0700)]
[LSV] Improve chain splitting in some corner cases.
Currently we happen to split a chain of 12xi8 accesses into 6xi8 + 6xi8, which
produces rather suboptimal code.
This change attempts to split-off non-multiples of 4bytes at the end and if that
does not work, splits on the smaller power-of-2 boundary.
Differential Revision: https://reviews.llvm.org/D147976
Michael Buch [Mon, 17 Apr 2023 14:04:57 +0000 (15:04 +0100)]
[lldb][DataFormatter] Fix libcxx std::deque formatter for references and pointers
(Addresses GH#62153)
The `SBType` APIs to retrieve details about template arguments,
such as `GetTemplateArgumentType` or `GetTemplateArgumentKind`
don't "desugar" LValueReferences/RValueReferences or pointers.
So when we try to format a `std::deque&`, the python call to
`GetTemplateArgumentType` fails to get a type, leading to
an `element_size` of `0` and a division-by-zero python exception
(which gets caught by the summary provider silently). This leads
to the contents of such `std::deque&` to be printed incorrectly.
This patch dereferences the reference/pointer before calling
into the above SBAPIs.
**Testing**
* Add API test
Differential Revision: https://reviews.llvm.org/D148531
LLVM GN Syncbot [Mon, 17 Apr 2023 20:21:50 +0000 (20:21 +0000)]
[gn build] Port
b0b2b2e047ca
Nick Desaulniers [Mon, 17 Apr 2023 20:18:16 +0000 (13:18 -0700)]
[arcanist] rm -f for write protected temp files
When running `arc diff` on a newly added file,
utils/arcanist/clang-format.sh is run. For new files there is no change,
but the script will bail. Without the use of the -f flag, we get
interactive prompts like:
rm: remove write-protected regular file '/tmp/tmp.ReMybrBw35'?
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148555
Eli Friedman [Mon, 17 Apr 2023 20:15:46 +0000 (13:15 -0700)]
[COFF] Add MC support for emitting IMAGE_WEAK_EXTERN_ANTI_DEPENDENCY symbols
This is mostly useful for ARM64EC, which uses such symbols extensively.
One interesting quirk of ARM64EC is that we need to be able to emit weak
symbols that point at each other (so if either symbol is defined
elsewhere, both symbols point at the definition). This required a few
changes to the way we handle weak symbols on Windows.
Differential Revision: https://reviews.llvm.org/D145208
Nick Desaulniers [Mon, 17 Apr 2023 20:10:16 +0000 (13:10 -0700)]
Revert "[ADT] add StringViewExtras llvm::starts_with for std::string_view"
This reverts commit
d6d30dd9590b41fbcdc88b43767b27a31bfb1c73.
These helpers were added to be used by LLVMDemangle, which would be a
layering violation for that to depend on LLVMSupport. Undo this commit,
and I'll these these directly in LLVMDemangle.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148547
Caslyn Tonelli [Sun, 16 Apr 2023 19:07:09 +0000 (19:07 +0000)]
[scudo] Tune FuchsiaConfig for RiscV
Reduce `PrimaryRegionSizeLog` to 28U to be compatible with a 38bit user
address space on the fuchsia-riscv platform. `PrimaryGroupSizeLog` is
reduced to 19 to preserve 512 BatchGroups per region.
This change can be tested on Fuchsia with:
```
fx set --auto-dir bringup.riscv64 --with //bundles:boot_tests \
fx build bundles:boot_tests \
fx run-boot-test --args={-s,1} boot-libc-unittests \
--cmdline='--gtest_filter=-*DeathTest*:PthreadGetSet*:ScudoSecondaryTest*'
```
The gtest filter ignores pthread and death tests due to non-scudo
related issues on fuchsia-riscv (ScudoSecondaryTest includes a death
check).
Related Ticket: https://fxbug.dev/125263
Differential Revision: https://reviews.llvm.org/D148475
Congcong Cai [Mon, 17 Apr 2023 20:06:59 +0000 (22:06 +0200)]
[InstCombine] support fold select(X|Y,X|Y,X) to X|Y
Fixed: https://github.com/llvm/llvm-project/issues/62113
Add addtional check in `visitSelectInst` to:
1. match `select(X|Y==0, X, X|Y)` and replaced with `X|Y`
2. match `select(X&Y==-1, X, X&Y)` and replaced with `X&Y`
alive proof:
https://alive2.llvm.org/ce/z/4qHmv-
https://alive2.llvm.org/ce/z/c2MBGy
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D148275
Congcong Cai [Mon, 17 Apr 2023 20:06:43 +0000 (22:06 +0200)]
[InstCombine][NFC] Add tests for simplifying select(X|Y,X|Y,X) to X|Y
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D148562
Mikhail R. Gadelha [Mon, 17 Apr 2023 19:45:46 +0000 (16:45 -0300)]
[libc] Partial revert of "[libc] Update supported riscv libs"
Partial revert of commit
ee917996708c936dd7f275de06b7895f5e3c11ec.
I can't reproduce the error locally, so let's revert it to keep the bots
happy.
Valentin Clement [Mon, 17 Apr 2023 19:44:36 +0000 (12:44 -0700)]
[mlir][openacc][NFC] Use assembly format for acc.loop
Use the assembly format with custom parser/printer
for specific clauses instead of a full custom parser/printer.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D148391
Ashay Rane [Mon, 17 Apr 2023 16:17:43 +0000 (11:17 -0500)]
[lldb] fix build issue on MSVC because of missing byte-swap builtins
The `__builtin_bswap{32,64}()` builtins (introduced in commit
e07a421d)
are missing from MSVC, which causes build errors when compiling LLDB on
Windows (tested with MSVC 19.34.31943.0). This patch replaces the
builtins with either MSVC's `_byteswap_u{long,64}()` or the original
builtins, or the `bswap_{32,64}()` functions from byteswap.h, depending
on which ones are available.
Reviewed By: bulbazord
Differential Revision: https://reviews.llvm.org/D148541
Manoj Gupta [Mon, 17 Apr 2023 18:39:07 +0000 (11:39 -0700)]
Revert "[VPlan] Switch to checking sinking legality for recurrences in VPlan."
This reverts commit
7fc0b3049df532fce726d1ff6869a9f6e3183780.
Causes a clang hang when building xz utils, github issue #62187.
Mikhail R. Gadelha [Mon, 17 Apr 2023 19:13:14 +0000 (16:13 -0300)]
[libc] Update supported riscv libs
This patch updates the list of supported libs according to the latest changes to x86_64
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D147961
Jack Grigg [Mon, 17 Apr 2023 18:59:56 +0000 (11:59 -0700)]
github: Add manual workflow to build and upload release binaries
Reviewed By: kwk
Differential Revision: https://reviews.llvm.org/D143535
Jonas Devlieghere [Mon, 17 Apr 2023 18:58:27 +0000 (11:58 -0700)]
[lldb] Fix TestObjectFileJSON and TestSymbolFileJSON
- Separate the two test and only have TestSymbolFileJSON rely on strip.
- Use different file names to make sure LLDB reloads the module.
This should address all the post commit review from D148062.
Lang Hames [Mon, 17 Apr 2023 17:58:29 +0000 (10:58 -0700)]
[JITLink][ELF] Check that ELF buffer has at least ELF::EI_NIDENT bytes.
This allows the subsequent code to access the E_IDENT fields, which will be
used in the upcoming JITLink ppc64 backend (https://reviews.llvm.org/D148192).
Shraiysh Vaishay [Sun, 16 Apr 2023 02:16:16 +0000 (21:16 -0500)]
[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting functions.
This patch replaces the uses of PointerUnion.is function by llvm::isa,
PointerUnion.get function by llvm::cast, and PointerUnion.dyn_cast by
llvm::dyn_cast_if_present. This is according to the FIXME in
the definition of the class PointerUnion.
This patch does not remove them as they are being used in other
subprojects.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D148449
mydeveloperday [Mon, 17 Apr 2023 18:38:53 +0000 (19:38 +0100)]
[clang-format] CSharp don't allow there not to be a space between `is` and `[`
as `is` is a keyword in C# ensure there is always a space before the `[` regardless of `SpaceBeforeSquareBrackets` setting
Fixes: #61965
https://github.com/llvm/llvm-project/issues/61965
Reviewed By: owenpan, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D148472
Anton Korobeynikov [Mon, 17 Apr 2023 18:29:59 +0000 (11:29 -0700)]
Revert "[lldb] Add support for MSP430 in LLDB."
This reverts commit
82c02b733c7736507a41a26bebd37d3f8e88bd4e.
Apparently, the original patch was not rebased onto `main
Lei Zhang [Mon, 17 Apr 2023 18:23:27 +0000 (11:23 -0700)]
[mlir][vector] Fix integer promotion type mismatch
We need to create a new type with transposed shape after
transposing the operand in `CanonicalizeContractMatmulToMMT`.
Reviewed By: kuhar, dcaballe
Differential Revision: https://reviews.llvm.org/D148470
Jonas Devlieghere [Mon, 17 Apr 2023 18:26:56 +0000 (11:26 -0700)]
Revert "[ADT] Apply fixes from modernize-type-traits (NFC)"
This reverts commit
9395cf063a013003704118deccf7633533170a5b because it
breaks the modules build:
STLFunctionalExtras.h:54:3: error:
'llvm::function_ref<std::__1::optional<std::__1::basic_string<char>>
(llvm::StringRef, llvm::StringRef)>::function_ref' from module
'LLVM_Utils.ADT.STLFunctionalExtras' is not present in definition of
'llvm::function_ref<std::__1::optional<std::__1::basic_string<char>>
(llvm::StringRef, llvm::StringRef)>' in module
'LLVM_Utils.ADT.STLFunctionalExtras'
https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/53806/
Anton Korobeynikov [Mon, 17 Apr 2023 17:56:01 +0000 (10:56 -0700)]
[lldb] Add support for MSP430 in LLDB.
Add MSP430 to the list of available targets, implement MSP430 ABI, add support for debugging targets with 16-bit address size.
The update is intended for use with MSPDebug, a GDB server implementation for MSP430.
Reviewed By: bulbazord, DavidSpickett
Differential Revision: https://reviews.llvm.org/D146965
Yitzhak Mandelbaum [Fri, 14 Apr 2023 21:00:24 +0000 (21:00 +0000)]
[clang][dataflow] Drop optional model's dependency on libc++ internals.
Adjusts the matchers in the optional model to avoid dependency on internal
implementation details of libc++'s `std::optional`. In the process, factors out
the code to check the name of these types so that it's shared throughout.
Differential Revision: https://reviews.llvm.org/D148377
Yitzhak Mandelbaum [Fri, 14 Apr 2023 14:21:41 +0000 (14:21 +0000)]
[clang][dataflow] Refine matching of optional types to anchor at top level.
This patch refines the matching of the relevant optional types to anchor on the
global namespace. Previously, we could match anything with the right name
(e.g. `base::Optional`) even if nested within other namespaces. This over
matching resulted in an assertion violation when _different_ `base::Optional`
was encountered nested inside another namespace.
Fixes issue #57036.
Differential Revision: https://reviews.llvm.org/D148344
Markus Mützel [Mon, 17 Apr 2023 16:15:54 +0000 (09:15 -0700)]
[flang] Complex numbers in function arguments on Windows
Function arguments or return values that are complex floating point values
aren't correctly lowered for Windows x86 32-bit and 64-bit targets.
See: https://github.com/llvm/llvm-project/issues/61976
Add targets that are specific for these platforms and OS.
With thanks to @mstorsjo for pointing out the fix.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D147768
Han Zhu [Mon, 10 Apr 2023 22:40:15 +0000 (15:40 -0700)]
Second try: [clang][cmake] Add options to pass in vcs repo and revision info
V2: Fix cmake error when -DLLVM_APPEND_VC_REV=OFF
Clang may be built in an environment where Git is not available. In our case,
Clang is part of a larger monorepo which is not Git-based, and
GenerateVersionFromVCS was not able to get source info.
Provide options to pass in repo and revision info from cmake.
```
cmake \
-DCLANG_VC_REPOSITORY=abc://repo.url.com \
-DCLANG_VC_REVISION=
abcd1234 \
...
```
This would allow us to prepare the source info beforehand and pass it to the
clang binary.
Differential Revision: https://reviews.llvm.org/D148262
Snehasish Kumar [Fri, 14 Apr 2023 05:12:09 +0000 (05:12 +0000)]
[memprof] Print out profile build ids in the error message.
When no --profiled-binary flag is provided we can print out the build
ids of the modules in the profile. This can help the user fetch the
correct binary from e.g. remote object store.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D148301
Siva Chandra Reddy [Sun, 16 Apr 2023 07:28:41 +0000 (07:28 +0000)]
[libc][NFC] Remove the unused FDReader testutil.
Differential Revision: https://reviews.llvm.org/D148454
Peiming Liu [Tue, 4 Apr 2023 18:41:00 +0000 (18:41 +0000)]
[mlir][sparse] enable more sparse convolution kernels.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D147670
Alexandros Lamprineas [Mon, 20 Mar 2023 12:17:23 +0000 (12:17 +0000)]
[FuncSpec] Consider constant struct arguments when specializing.
Optionally enabled just like integer and floating point arguments.
Differential Revision: https://reviews.llvm.org/D145374
Caslyn Tonelli [Sun, 16 Apr 2023 02:03:58 +0000 (02:03 +0000)]
[scudo] Descriptive Fucshia errors
`dieOnError` in fuchsia.cpp takes the syscall name, status code, and
relevant size parameter to describe what failed, the reason, and size
context. Several different Fuchsia syscalls can fail underlying Scudo's
map operation and gets hidden if using `dieOnMapUnmapError`.
The reason for this change is to provide an error status code and more
helpful information to debug failures.
Nikolas Klauser [Sun, 16 Apr 2023 14:16:34 +0000 (16:16 +0200)]
[libc++][NFC] Remove some dead code in common_type
Reviewed By: #libc, Mordante
Spies: Mordante, libcxx-commits
Differential Revision: https://reviews.llvm.org/D148466
John-Earnshaw [Mon, 17 Apr 2023 17:11:20 +0000 (10:11 -0700)]
[Docs] Added RTTI, Run-time Type Information
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148538
Han Zhu [Mon, 17 Apr 2023 17:08:34 +0000 (10:08 -0700)]
Revert "[clang][cmake] Add options to pass in vcs repo and revision info"
This reverts commit
1f5e737fc135bf991889a1364b8f8c5edc3953d2.
Eduard Zingerman [Tue, 11 Apr 2023 18:08:45 +0000 (21:08 +0300)]
[BPF] Make sure ALU32 feature is set in MCSubtargetInfo for mcpu=v3
`BPF.td` is used to generate (among other things) `MCSubtargetInfo`
setup function for BPF target.
Specifically, the `BPFGenSubtargetInfo.inc` file:
enum {
ALU32 = 0,
...
};
...
extern const llvm::SubtargetSubTypeKV BPFSubTypeKV[] = {
{ "generic", { { { 0x0ULL, ... } } }, ... },
{ "probe", { { { 0x0ULL, ... } } }, ... },
{ "v1", { { { 0x0ULL, ... } } }, ... },
{ "v2", { { { 0x0ULL, ... } } }, ... },
{ "v3", { { { 0x1ULL, ... } } }, ... },
};
...
static inline MCSubtargetInfo *createBPFMCSubtargetInfoImpl(...) {
return new BPFGenMCSubtargetInfo(..., BPFSubTypeKV, ...);
}
The `SubtargetSubTypeKV` is defined in `MCSubtargetInfo.h` as:
/// Used to provide key value pairs for feature and CPU bit flags.
struct SubtargetSubTypeKV {
const char *Key; ///< K-V key string
FeatureBitArray Implies; ///< K-V bit mask
FeatureBitArray TuneImplies; ///< K-V bit mask
const MCSchedModel *SchedModel;
...
}
The first bit array specifies features enabled by default for a
specific CPU. This commit makes sure that this information is
communicated to `tablegen` and correct `BPFSubTypeKV` table is
generated. This allows tools like `objdump` to detect available
features when `--mcpu` flag is specified.
Differential Revision: https://reviews.llvm.org/D148037
Zequan Wu [Thu, 30 Mar 2023 19:01:21 +0000 (15:01 -0400)]
[DebugInfo] Fix file path separator when targeting windows.
This fixes two problems:
1. When crossing compiling for windows on linux, source file path in debug info is concatenated with directory by host native separator ('/'). For windows local build, they are concatenated by '\'. This causes non-determinism bug.
The solution here is to let `LangOptions.UseTargetPathSeparator` to control if we should use host native separator or not.
2. Objectfile path in CodeView also uses host native separator when generated.
It's fixed by changing the path separator in `/Fo` to '\' if the path is not an absolute path when adding the `-object-file-name=` flag.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D147256
Fangrui Song [Mon, 17 Apr 2023 16:57:53 +0000 (09:57 -0700)]
[Parse] Remove TimeTraceScope for "ParseTemplate"
Fix https://github.com/llvm/llvm-project/issues/56554
```
#include "1.h"
#include "2.h"
int foo();
```
Suppose that 1.h ends with a template function. When parsing the function,
the `ParseFunctionDefinition` call after the TimeTraceScope object
may consume a `r_brace` token and lex the end of file (1.h), resulting
in an ExitFile event in SemaPPCallbacks::FileChanged. This event will call `llvm::timeTraceProfilerEnd();`,
which incorrectly ends "ParseTemplate" instead of "Source" (1.h).
Once 2.h has been fully parsed, the destructor of 1.h's TimeTraceScope object
will end "Source" (1.h).
This behavior erroneously extends the end of "Source" (1.h), which makes
"Source" (2.h) appear to be nested inside "Source" (1.h). This bug is difficult
to fix correctly in an elegant way, and we have two options: either end
"ParseTemplate" when ending "Source" (1.h), or delay the ExitFile event.
However, both approaches require complex code. For now, we can remove the
"ParseTemplate" TimeTraceScope. This can be re-added if properly repaired.
Reviewed By: anton-afanasyev
Differential Revision: https://reviews.llvm.org/D148410
Peiming Liu [Tue, 4 Apr 2023 18:41:00 +0000 (18:41 +0000)]
[mlir][sparse] use macro to build common operations in LoopEmitter
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D147553
Thurston Dang [Mon, 17 Apr 2023 16:55:24 +0000 (16:55 +0000)]
Revert "[test][sanitizer] Add another stress test for pthread_create"
Reverting
364884e088d45b162ecb47d093f955a2333eeee1 because it appears the sanitizers are not yet ready to be stressed out (build failures starting from https://lab.llvm.org/buildbot/#/builders/37/builds/21483).
Joseph Huber [Mon, 17 Apr 2023 14:11:09 +0000 (09:11 -0500)]
[libc] Add special handling for CUDA PTX features
The NVIDIA compilation path requires some special options. This is
mostly because compilation is dependent on having a valid CUDA
toolchain. We don't actually need the CUDA toolchain to create the
exported `libcgpu.a` library because it's pure LLVM-IR. However, for
some language features we need the PTX version to be set. This is
normally set by checking the CUDA version, but without one installed it
will fail to build. We instead choose a minimum set of features on the
desired target, inferred from
https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#release-notes
and the PTX refernece for functions like `nanosleep`.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D148532
Han Zhu [Mon, 10 Apr 2023 22:40:15 +0000 (15:40 -0700)]
[clang][cmake] Add options to pass in vcs repo and revision info
Clang may be built in an environment where Git is not available. In our case,
Clang is part of a larger monorepo which is not Git-based, and
GenerateVersionFromVCS was not able to get source info.
Provide options to pass in repo and revision info from cmake.
```
cmake \
-DCLANG_VC_REPOSITORY=abc://repo.url.com \
-DCLANG_VC_REVISION=
abcd1234 \
...
```
This would allow us to prepare the source info beforehand and pass it to the
clang binary.
Differential Revision: https://reviews.llvm.org/D148262
OCHyams [Mon, 17 Apr 2023 16:18:36 +0000 (17:18 +0100)]
[NFC][Assignment Tracking] Rename flag variable in Options.td
Prefix the variable with 'f' to match other 'f' options.
Lang Hames [Mon, 17 Apr 2023 15:26:28 +0000 (15:26 +0000)]
[ORC][LLJIT] Use JITLink by default on ELF/x86-64.
This patch switches LLJIT's default JIT linker for ELF/x86-64 from RuntimeDyld
to JITLink.
Most clients should not be affected, but if you were explicitly accessing the
old RTDyldObjectLinkingLayer (e.g. to install JITEventListeners) you will need
to either force use of RuntimeDyld (following the example in
llvm/examples/OrcV2Examples/LLJITWithCustomObjectLinkingLayer), or switch to
using JITLink plugins instead.
Peiming Liu [Fri, 24 Mar 2023 16:16:21 +0000 (16:16 +0000)]
[mlir][sparse] implement index redution on dense level (for CSR)
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D147550
NAKAMURA Takumi [Mon, 17 Apr 2023 16:17:38 +0000 (01:17 +0900)]
[Bazel] Move InstCombineTableGen from InstCombine to AMDGPUCodeGen
David Green [Mon, 17 Apr 2023 16:22:46 +0000 (17:22 +0100)]
[AArch64][GISel] Add FP16 fcmp lowering
This adds v4f16 and v8f16 lowering for fp16 vector compares. It splits the
getActionDefinitionsBuilder of G_FCMP from G_ICMP, as they are quite different
operations, and adds fp16 vector lowering.
Differential Revision: https://reviews.llvm.org/D147947
V Donaldson [Fri, 14 Apr 2023 18:54:07 +0000 (11:54 -0700)]
[flang] REAL(KIND=3) and COMPLEX(KIND=3) descriptors
Update descriptor generation to correctly set the `type` field for
REAL(3) and COMPLEX(3) objects.
Siva Chandra Reddy [Fri, 14 Apr 2023 22:11:33 +0000 (22:11 +0000)]
[libc][NFC] Remove the StreamWrapper class and use the new test logger.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D148452
aabhinavg [Mon, 17 Apr 2023 15:43:37 +0000 (21:13 +0530)]
Fix the indentation error.
Differential Revision: https://reviews.llvm.org/D148535
Siva Chandra Reddy [Mon, 17 Apr 2023 06:41:22 +0000 (06:41 +0000)]
[libc][NFC] Move RandUtils.h to test/src/math.
It is currently used only by math tests so moving it to test/src/math
keeps it closer to where it is used.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D148497
David Spickett [Mon, 17 Apr 2023 13:40:16 +0000 (13:40 +0000)]
[clang] Replace find_executable with shutil.which in creduce script
distutils is deprecated and shutil.which is the suggested
replacement for this function.
https://peps.python.org/pep-0632/#migration-advice
https://docs.python.org/3/library/shutil.html#shutil.which
which was added in 3.3 (https://docs.python.org/3/library/shutil.html#shutil.which)
and LLVM requires at least 3.6 (https://llvm.org/docs/GettingStarted.html#software).
There is one small differnce here that shutil.which ignores the PATH
when given a path argument. However in this case I think that's actually
the behaviour we want.
Reviewed By: zequanwu
Differential Revision: https://reviews.llvm.org/D148529
Jay Foad [Fri, 10 Mar 2023 14:14:06 +0000 (14:14 +0000)]
[AMDGPU] Don't select _SGPR forms of SMEM instructions on GFX9+
On GFX9+, SMEM instructions have an _SGPR_IMM form which is strictly
more powerful than the _SGPR form. It simplifies codegen if we always
select the _SGPR_IMM form with an immediate offset of 0 instead of the
_SGPR form.
Note that this patch just makes minimal changes to the selection
patterns to prove the concept. Further simplifications are possible to
reduced the number of selection patterns.
On GFX9 the _SGPR form of the Real instruction is still required for
assembly/disassembly but on GFX10+ it can be removed completely.
Differential Revision: https://reviews.llvm.org/D147334
Florian Hahn [Mon, 17 Apr 2023 15:19:12 +0000 (16:19 +0100)]
[LV] Precommit test for D147963.
Reduced test case for #58811.
aabhinavg [Mon, 17 Apr 2023 14:48:38 +0000 (20:18 +0530)]
[docs][LangRef] Added minor update inside the `frem`. Fix : #61653
Added minor update inside the `frem`. Fix : #61653
Differential Revision: https://reviews.llvm.org/D146900
Valentin Clement [Mon, 17 Apr 2023 15:05:51 +0000 (08:05 -0700)]
Revert "[mlir][openacc][NFC] Use assembly format for acc.loop"
This reverts commit
7960993e4638c6243c4b37f05bb61b080fe13d43.
David Spickett [Mon, 17 Apr 2023 13:28:22 +0000 (13:28 +0000)]
[libcxx] Replace find_executable with shutil.which
distutils is deprecated and shutil.which is the suggested
replacement for this function.
https://peps.python.org/pep-0632/#migration-advice
https://docs.python.org/3/library/shutil.html#shutil.which
which was added in 3.3 (https://docs.python.org/3/library/shutil.html#shutil.which)
and LLVM requires at least 3.6 (https://llvm.org/docs/GettingStarted.html#software).
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D148527
David Green [Mon, 17 Apr 2023 15:00:57 +0000 (16:00 +0100)]
[AArch64] Add a basic pattern for FACGE and FACGT
These instructions take the absolute of two values and perform a FCMGE/FCMGT
between them. This patch adds some basic patterns for them.
Differential Revision: https://reviews.llvm.org/D147945
Kadir Cetinkaya [Mon, 27 Mar 2023 10:29:22 +0000 (12:29 +0200)]
[clangd] Use all inputs to SystemIncludeExtractor in cache key
Instead of passing in a tooling::CompileCommand into system include
extraction, pass a limited set, whose elements are used as keys.
Also fix the issue around accepting `-isysroot=/foo` which isn't a valid
argument (or the directory should be `=/foo` not `/foo`).
Fixes https://github.com/clangd/clangd/issues/1404
Fixes https://github.com/clangd/clangd/issues/1403
This should also unblock https://reviews.llvm.org/D138546
Differential Revision: https://reviews.llvm.org/D146941
Saleem Abdulrasool [Mon, 17 Apr 2023 14:52:38 +0000 (07:52 -0700)]
PECOFF: consume errors properly
We would not ensure that the error is consumed in the case that logging
is disabled. Ensure that we properly drop the error on the floor or we
would re-trigger the checked failure.
Differential Revision: https://reviews.llvm.org/D147669
Reviewed By: sgraenitz
Valentin Clement [Mon, 17 Apr 2023 14:52:50 +0000 (07:52 -0700)]
[mlir][openacc][NFC] Use assembly format for acc.loop
Use the assembly format with custom parser/printer
for specific clauses instead of a full custom parser/printer.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D148391
Martin Storsjö [Wed, 5 Apr 2023 11:52:30 +0000 (14:52 +0300)]
[libcxxabi] [test] Use the correct printf formats for printing pointers
Don't cast the pointers to long, as that's not large enough for
pointers on 64 bit Windows.
Differential Revision: https://reviews.llvm.org/D147640
Joseph Huber [Mon, 17 Apr 2023 14:36:13 +0000 (09:36 -0500)]
[libc][fix] Only use the object files when targeting NVPTX
Summary:
The `nvlink` linker doesn't support static libraries, so we just pass in
the object files. The condition was erroneously doing this for every
single GPU architecture and not just NVIDIA. The AMDGPU support handles
static libraries just fine.