[clang-repl] fix vtable symbol duplication error (closes #141039) (#185648)
In incremental mode, emit by ExternalLinkage causes duplicate symbol
error. A single targeted change in getVTableLinkage() fixes the issue by
returning LinkOnceODRLinkage when IncrementalExtensions is active. The
JIT linker then keeps the first definition a silently discards
subsequent ones.
closes issue #141039
Co-authored-by: Emery Conrad <emery.conrad at chicagotrading.com>
[PowerPC] Enable custom lowering for bswap64 builtin on Power8 64 bits with improved parallelism (#187259)
The current implementation for `__builtin_bswap64` does not do many
things in parallel. This patch splits the 64 bit swaps into 32 bit swaps
as high and low 32-bit swaps are independent and can execute
simultaneously.
Compared to the sequential approach, there are fewer instructions. These
changes should not alter the current assembly and there is default
fall-through for power9+.
---------
Co-authored-by: himadhith <himadhith.v at ibm.com>
[clang][NFC] Unify `MacroState` `isAmbiguous` and `getModuleInfo`
Every call to `MacroState::getModuleInfo`, and `MacroState::isAmbiguous` are paired in the same function. Rather than doing the same work twice, just unify them into a single function, `getModuleInfo`, that returns both pieces of information in a new type `ModuleMacroInfo`.
Unfortunately, `getModuleInfo` and`ModuleMacroInfo` already exist, so rename them to `getFullModuleInfo` and `FullModuleMacroInfo`, respectively, since the new type is a subset of the old type. The new type contains just the pieces consumers care about.
While we're there, use the range constructor of `llvm::DenseSet` instead of default constructing and calling `insert` in a loop.
[libc] Add all the toolchains needed for libc-shared-tests to the docker container. (#197735)
Toolchains include:
- gcc-7, 8, 9, 11
- qemu-static-user
- cross-build toolchain for aarch64, riscv64, ppc64le, including gcc,
g++, gmp, mpfr, mpc.
Container size before the change: ~ 500 MB
Container size after the change: ~ 1.3 - 1.4 GB
[flang] Diagnose BIND(C) procedures in submodules without ancestor interfaces (#194571)
This diagnoses `BIND(C)` procedures defined in submodules when their
interface is not declared in the ancestor module.
The check is added in `CheckBindC()` and covers plain `BIND(C)`,
explicit `NAME=`, empty/all-blank `NAME=`, valid ancestor-module
interfaces, and nested submodule cases.
Fixes #194570.
Co-authored-by: Sairudra More <moresair at pe31.hpc.amslabs.hpecorp.net>
[AtomicExpand] Add bitcasts when expanding store atomic vector
AtomicExpand fails for aligned \`store atomic <n x T>\` because it
does not find a compatible library call. This change adds appropriate
ptrtoint + bitcast so that the call can be lowered, mirroring the
load-side handling from #148900.
Require explicit yield in iterator op
Remove the implicit terminator trait from omp.iterator so iterator
modifiers must explicitly yield the value used to form the iterated list.
Add and update verfier and test accordingly.
Reject target map iterators without captures
Reject target map iterators until the follow-up capture-binding
representation is added since currently map_iterated on omp.target
only represents the dynamic map list and does not consider the
target-region arguments required by IsolatedFromAbove.
Simplify map iterator clause assembly
- Split MLIR map syntax into separate map_entries(...) and map_iterated(...),
removing the custom MapEntryList parser/printer.
- Moved omp.target map_iterated out of TargetOpRegion
- it now prints before the target region instead of as map_iterated_entries(...) after the region.
- Renamed LLVMIR TODO helper to clause-style checkMap.
- Added DeclareMapperInfoOp builder from DeclareMapperInfoOperands
and updated Flang call sites so they do not need to spell out newly
added operands..
Reject target map iterators without captures
Reject target map iterators until the follow-up capture-binding
representation is added since currently map_iterated on omp.target
only represents the dynamic map list and does not consider the
target-region arguments required by IsolatedFromAbove.
Require explicit yield in iterator op
Remove the implicit terminator trait from omp.iterator so iterator
modifiers must explicitly yield the value used to form the iterated list.
Add and update verfier and test accordingly.
Simplify map iterator clause assembly
- Split MLIR map syntax into separate map_entries(...) and map_iterated(...),
removing the custom MapEntryList parser/printer.
- Moved omp.target map_iterated out of TargetOpRegion
- it now prints before the target region instead of as map_iterated_entries(...) after the region.
- Renamed LLVMIR TODO helper to clause-style checkMap.
- Added DeclareMapperInfoOp builder from DeclareMapperInfoOperands
and updated Flang call sites so they do not need to spell out newly
added operands..
[mlir][OpenMP] Add iterator support to motion clauses
Extend omp.target_data, omp.target_enter_data, omp.target_exit_data,
and omp.target_update to support `!omp.iterated<Ty>`.
This is part of feature work for #188061
Assisted with copilot
[Flang][OpenMP] Support iterator modifiers in map and motion clauses
Support iterated array elements and array sections in map and motion clauses for
target data, target enter data, target exit data, and target update constructs.
Preserve mapper resolution for iterated entries, including explicit mappers,
user-defined default mappers, declare mapper entries, and implicit default
mappers.
This PR stacked on top of #197047 and #197752.
This patch is part of the feature work for #188061.
Assisted with copilot.
[libclc] Move sources collection into libclc_add_builtin_library, merge opencl library creation into libclc_add_library (#197654)
Merging opencl library creation into libclc_add_library undos part of
change in 14bf8e7.
This simplifies creating different libraries by invoking
libclc_add_library multiple times, without the need of splitting
intermediate library creation and its finalization.
add_subdirectory(clc) and add_subdirectory(opencl) only updates sources
list of existing library target, so it is safe to move inside
libclc_add_builtin_library.
[AMDGPU] Add v2i32 V_BFI combines for andn2 and orn2 (#196325)
Add vector v2i32 pattern matches that lower to two lane wise V_BFI_B32
operations.
TODO: Support v2i16, v4i16 pattern.
[lldb] Stop looking for libarclite symbol (#197848)
libarclite is a helper library used for Automatic Reference Counting
(ARC) support on older operating systems. It hasn't been necessary since
Mac OS X Mountain Lion, released in 2012.
[lldb] Fix data race in UnwindTable::Initialize (#197816)
UnwindTable::Initialize uses double-checked locking (DCL) against
m_scanned_all_unwind_sources, but the flag was a plain bool. The
fast-path read outside the mutex is unsynchronized with the write inside
the mutex, so concurrent first-time callers can observe partially
initialized state.
Make m_scanned_all_unwind_sources std::atomic<bool>. The default memory
ordering (seq_cst) is sufficient for the DCL pattern used here.
Found by ThreadSanitizer as part of #197792.
[lldb] Use llvm::sys::RWMutex instead of std::shared_mutex (NFC) (#197847)
On Darwin, pthread_rwlock is faster than std::shared_mutex, which is why
the implementation of llvm::sys::RWMutex used that on our platform.
Everywhere else, it uses std::shared_mutex under the hood.
Also see #70151
rdar://177113951
[Bazel] Port ca6e386cbf5b3e75a2a62e6c4d29b24109727a52 (#197841)
obj2yaml now depends on MC (although probably not for much), and remove
an unnecessary header creating a layering violation.