[unittests] Skip target tests when the default triple is not built (#231723)
PassBuilder and TargetMachine C API tests fail when LLVM_TARGETS_TO_BUILD
does not include the default target triple. Skip them instead, and
null-initialize the PassBuilder fixture so TearDown does not dispose
uninitialized handles after a skipped SetUp.
[Offload][Omp] Ensure correct teardown order
Use the new Offload API to ensure a proper libomptarget teardown
in case the process exits before reaching its `deinit` method.
Depending on different circumstances whether the shutdown happens
through `deinit` or through the liboffload `callback` everything
must be properly protected and allowed to be called safely multiple
times.
Assisted by Claude.
[DAG] Preserve scalar flags when folding vector constants
When a scalar operation has the same opcode and operands as a
(potentially unrelated) vector operation, the scalar operation's
flags get dropped. This patch preserves these lost flags.
[LV] Support tail-folded epilogue loops (#208764)
Add support for tail-folding the vector epilogue loop.
The main and epilogue loops can require different vectorization
decisions, so introduce a separate cost model for the tail-folded
epilogue and allow VPlan construction and costing to operate with the
appropriate CM.
This patch enables emitting a tail-folded vector epilogue loop alongside
a non-tail-folded vector main loop.
For now, this feature requires both the main VF and epilogue VF to be
explicitly forced.
[Offload][Omp] Finish removing Plugin Interface from libomptarget (#239525)
This PR is mostly NFC and removes all remaining usages of the Plugin
Interface from libomptarget:
* Headers from the Plugin Interface are removed
* Remaining Plugin::Error usages were substituted by createError
* RecordReplay files were moved out of the plugins common directory
* Removed GenericPlugin from PluginManager and DeviceTy
* Changed usages of RTLDeviceID to use the OpenMP DeviceID. This is the
only change in behavior, but the previous value was probably not correct
if there were more than one plugin.
* Removed helpers to get GenericPlugin and RTLDeviceID. We still have 3
helpers remaining to transition.
Assisted by Claude.
[X86][APX] Test the relocation of an NF add
test_regclass_not_updated_by_regalloc_2 only produced an NDD/NF add
with a GOT operand because the allocator happened to give the add a
destination different from its source. With SlotIndexes compaction it
picks the same register, so the add is compressed to the legacy form
and the CODE_6 TODO lost its test.
Add a function whose add keeps its source live, so it stays NDD and
becomes NF under any allocation.
[X86] Enable SlotIndexes compaction by default
Compacting SlotIndexes before greedy allocation drops the entries of
erased instructions, so live range sizes and instruction distances
reflect the code being allocated rather than how much was erased
before it. AMDGPU has done this since #235806; do the same for X86.
Codegen changes only through allocation: no new crashes, verifier
errors or allocation failures in the lit suites, including
EXPENSIVE_CHECKS, and a stage-2 build of LLVM, clang and lld with
-verify-machineinstrs passes its own tests. On llvm-test-suite at -O3,
spills drop 0.3% and .text 0.06%, with compile time unchanged.
Most test updates are regenerated checks. misched-matmul now inserts
20 spills instead of 24. live-debug-vars-stale-slotindexes.mir gets
one more use of %27 so that accumulate_fit still reaches the stale
index path it was written for.
[LAA] Fix missing RT checks for unknown deps via non-header phis. (#230292)
Keep track of MemAccesses so we can map dependence source/sink directly
to them, instead of going through the pointers of the source and dest
instructions.
This allows correctly removing dependences.
Previously, pointers to non-header phis were not handled correctly: the
MemAccess in the map would refer to the translated pointer, which is
different to the pointer phi.
[LLDB] Clarify packet search state comments (#239415)
Document the buffer size recorded with the packet search cursor and
clarify that compression causes the search to restart. Address the
comment nits from the review of #238530.
[Clang] Fix new initializer list mangling (#232629)
Clang was adding the initializer-list marker twice when mangling an
expression such as `new std::initializer_list<int>{1}`.
Unwraped the compiler created init list expression and mangled its
elements only once.
Fixes #232531
Increase the limit for ctor initializers (#239011)
The below bug reports that we 'assert'/silently fail when given too many
initializers. Also, that the limit of 2^^16 was too small in some
generated code.
This patch promotes the 'constructor initializer' limit from a bitfield
to a member of the
CXXConstructorDecl, providing 32 bits for storage.
Additionally, it moves the DeductionCandidateKind into the decl type
itself, which adds
an additional couple of bits to the available list for FunctionDecl and
its derivatives (since it
was easy, and was harder to remove from this patch after a large
refactor).
Fixes: #219366
[2 lines not shown]
[clang][bytecode] Always check the source pointer in `Memcpy()` (#239563)
Loading from an uninitialized pointer will otherwise cause us problems
later.
Make empty record fields be initialized by default, so we don't diagnose
those. Also add the initialization state to `Pointer::operator<<`.
This fixes `SemaCXX/ext-int-vector.cpp`.
[mlir][vector] Consistently name Vector op results (#238070)
This continues the cleanup tracked in #131602.
Use result consistently in Vector op definitions, replacing names such
as dest and res. For DeinterleaveOp, rename res1 and res2 to resultEven
and resultOdd, respectively, to reflect their contents.
[AMDGPU] Exercise replay warning across inline asm blocks
Use the recognized EXEC-zero B8 workaround in the later block so the
fixture distinguishes per-block recognition from a combined sequence.
[clang-repl] Accept the 32-bit NVPTX triple in the CUDA emit-llvm test (#239329)
The CUDA device triple is nvptx-nvidia-cuda on 32-bit host. emit-llvm.cu
currently fails on its check for nvptx64-nvidia-cuda. Accept both
triples, as done in clang/test/Driver/cl-options.cu.
[Offload] Add shutdown callbacks to liboffload
When Platforms are initialized liboffload sets an atexit handler that
ensures that is deinitialized before deinitialazing platforms.
Because this happens lazily, a library using offload that wants to
run some of its shutdown needs to properly setup its atexit handler
after the liboffload one (because they're called in reverse order).
This requires to know precisely the internal implementation of liboffload.
Instead of requiring that, this PR adds an API that allows the users
of liboffload to register their own deinit code and be assured that it will
be called before liboffload shutdowns independently of when platforms
are initialized.
Assisted by Claude.