[Clang] Make exact dynamic_cast optimization AS aware (#213927)
PR https://github.com/llvm/llvm-project/pull/213253 exposed a problem in
AMDGPU where exact dynamic_cast optimization would generate compare
operands for the compare instruction that live in different address
spaces.
The culprit appears to have been the introduction of the `final` keyword
in the derived struct definition.
This patch uses CGF.GetVTablePtr and uses CGM.GlobalsInt8PtrTy in the
code for emitExactDynamicCast, following the pattern that is used in
EmitTypeid.
A test case that was reduced from the above PR is added as test.
AI-assisted
[AMDGPU] Canonicalize scalar bf16 more efficiently (#213789)
Canonicalize bf16 more efficiently. Use `v_pk_mul_vf16 <DST>, 1.0, ...`
rather than converting to/from f32 and using v_max.
---------
Signed-off-by: John Lu <John.Lu at amd.com>
[AArch64][CodeGen] Don't try to compute stack addresses in xzr (#213009)
Conditional branch tuning can replace an ADD + CBZ with an ADDS + Bcc.
This patch disables that transformation in the case where the ADD
instruction has a frame offset operand, because in that situation, it
can later be expanded into multiple instructions.
Fixes #212528, which had a case of this in which the destination
register of the ADDS was rewritten to XZR, because the value was
calculated _only_ to compare against zero. When the ADDS was expanded
into multiple instructions, the output instructions were not even
legal with XZR as the destination.
However we disable this transformation even when not rewriting the
destination register, because some of the instructions involved in
computing a frame offset have no flag-setting variant. (E.g. ADDVL, if
there are SVE variable-sized vectors on the stack.)
[IR] Remove deprecated BasicBlock::getFirstNonPHI (#213926)
All in-tree callers already migrated to getFirstNonPHIIt(), which
preserves debug-info placement. No remaining users of the deprecated
overloads exist in the codebase.
Co-authored-by: Claude <noreply at anthropic.com>
[libc][mathvec] Vectorise exp2f and exp10f (#211365)
Replaces exp2f and exp10f with fully vectorised implementations.
Includes refactoring of expf polynomial evalulation into expf_utils.h
[libc++][test] Add `void` cast to a discarded call to `remquo` (#213849)
For calls to `remquo`, the return values are generally expected to be
used, while it is rare to only use the value written via the pointer
parameter. Moreover, some implementors already planned to apply
`[[nodiscard]]` to `remquo`, see also https://llvm.org/PR171763. As a
result, it is perhaps better to add `void` cast to the discarded call to
`remquo` in the test file.
[SPIRV] Emit FPFastMathMode for Call (#211879)
`SPV_KHR_float_controls2` makes `FPFastMathMode` valid for all core
instructions, so this patch enables translation of fast math flags for
`OpFunctionCall`.
[runtimes] Drop reviewers-libcxx from reviews touching runtimes/ (#213736)
Since runtimes/ has been picked up by other subprojects, it doesn't make
sense anymore for reviewers-libcxx to watch all changes to it.
[libc++] Diagnose unused variables of container types (#203084)
This adds `[[gnu::warn_unused]]` to all container types currently
implemented. In the future new containers should be added to the list,
as well as other value types in the library.
Clang has `-Wunused`, which is a suite of warnings about unused
variables. However, that doesn't warn for a lot of class types,
especially non-trivial ones. That is done to avoid false-positives for
RAII-style types like `lock_guard`. `[[gnu::warn_unused]]` exists to
tell Clang that a given class is a value type.
[SLP]Support copyable fadds in fmuladd, modeled as fmuladd(1.0, a, b)
A copyable single-use fadd a, b is modeled as fmuladd(1.0, a, b), which
equals fadd a, b (the multiply by 1.0 is exact and preserves signed
zeros), so the add dies instead of being computed and gathered. The
addend/multiplicand assignment per lane matches the majority operand
kinds of the non-copyable lanes. Same all-or-nothing and tie-break
rules as for absorbed fmuls.
Reviewers: hiraditya, bababuck, RKSimon
Pull Request: https://github.com/llvm/llvm-project/pull/213786
[LLVM][CodeGen][SVE] Add isel patterns for abs-diff partial reductions. (#212800)
For SVE2 we can use top/bottom [S/U]ABAL[T/B] instruction. SVE2p3 can
use just [S/U]ABAL.
workflows/upload-release-artifact: Make this action self-contained
The action now checks out its own files so calling worklfows don't need
to do this. This helps prevent mistakes where the calling workflow
does not checkout the right files causing this action to fail.
[ASan] Handle allocas in non-default address spaces (#213764)
Do addrspace cast for allocas that live in address space different from
the datalayout's alloca address space, otherwise ASan will crash during
use replacement
[SLP]Fix scheduling of absorbed copyable fmuls, modeled as fmuladd(a, b, -0.0)
A copyable fmul absorbed into fmuladd(a, b, -0.0) does not appear in
the operand columns of its own node, so the operand scan never
released the schedule data of the copyable instruction itself and
scheduling ended with unscheduled bundles. Release it explicitly when
the copyable element shows up in no operand column.
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/213937
[LLDB] Serve unknown type symbols through `qSymbol` for non-MachO targets (#200134)
I am working with a binary where some symbols are generated from linker
scripts. They end up identified as `eSymbolInvalid` when loaded in LLDB.
OpenOCD can try to fetch them.
Some might even be hard-coded data, not going through an address in the
binary (explaining the presence of the check and raw value
return).
Testing it showed that **GDB returns them despite them not being proper
addresses**.
These can also be generated by C++ static constexpr, such values could
be accessed by a qSymbol query.
358cf1ea302eb introduced a divergence between GDB and LLDB where LLDB
does not serve symbols of unknown type through GDB protocol command
`qSymbol`. Per commit description, this is an expected behavior on
MachO-based platforms, but it is not on ELF-based platforms, where LLDB
should follow GDB. The changes introduced by said commit are now gated
behind an architecture check.
[offload] allow h2h olMemcpy with a queue (#212757)
olMemcpy currently disallows host-to-host copies with a queue, even
though that is a desirable use case (e.g. to copy a buffer as a
dependency for another operation)
This PR adds support for asynchronous host-to-host copies by adding
`GenericDeviceTy::dataMemcpy` and the corresponding required
`dataMemcpyImpl` plugin operation. Unlike `dataSubmit`, `dataRetrieve`,
and `dataExchange`, this operation does not assign a device direction to
either pointer:
- CUDA: Uses `cuMemcpyAsync`, which by itself determines the pointer
types and preserves stream ordering. Dynamic CUDA symbol declarations
and `_v2` lookup support are included.
- Level Zero: Uses the existing queue `memoryCopy` operation (backed by
`zeCommandListAppendMemoryCopy`), which appends a memory-copy command to
the command list.
- AMDGPU: No "enqueue a host-to-host copy" operation exists directly in
that API, so we enqueue a `std::memcpy` callback through
[10 lines not shown]