RuntimeLibcalls: Allow fp128 sincosl on x86_64-linux-android (#242486)
On x86_64-linux-android, long double is fp128 rather than x87 fp80 as
on GNU targets, so sincosl provides SINCOS_F128 rather than SINCOS_F80.
Remove the x86 LibraryExclusion and x87-only guard for sincosl to fix
`error: no libcall available for fsincos`.
Link:
https://android.googlesource.com/platform/bionic/+/refs/heads/main/libm/upstream-freebsd/lib/msun/src/s_sincosl.c#47
Assisted-by: Gemini
[flang][openacc] Look through converts when detecting common block storage uses (#243580)
A common block is not implicitly mapped as a whole when it is used in a
compute region only as the `storage` operand of the `fir.declare` of its
members. That check only matched a bare `fir.address_of` of the global.
Look through `fir.convert` before matching `fir.address_of`.
[AMDGPU] Do not form min3/max3 from legacy min/max (#242538)
minMaxOpcToMin3Max3Opc has no mapping for FMIN_LEGACY and FMAX_LEGACY,
so a select-form min or max chain hit unreachable on gfx6 and gfx7.
[Offload][Buildbot] Remove SDMA option from clang/flang buildbot config (#243605)
Removing the option to enable SDMA by default for the tests in the
buildbot.
[LoopUtils] Only expand RT check bounds for affine outer recurrences. (#243571)
When expanding the bounds to cover the outer loop, the outer step is
only checked to be non-negative once. This is not sufficient if the step
varies across outer iterations, i.e. the recurrences are not affine.
Reapply "X86: Use the DataLayout size in the atomic expansion hooks (#243118)"
This reverts commit 970a9c95cf21e946f2de12d7e781e17d2d7b0f5b.
The original version removed the MemType local from
shouldExpandAtomicRMWInIR, which conflicted with the vector atomicrmw
expansion added in #230788. Use the DataLayout size in the vector case
too.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
IR: Make AttributeList::hasAttributeAtIndex and hasAttrSomewhere inline
Check the attributes available at any index through AttributeListImplBase.
CTMark instructions:u: O3 -0.22%, ThinLTO -0.29%.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
IR: Don't store the attribute set array pointer in AttributeListImplBase
Compute the address of the trailing attribute sets from the base instead
of loading a stored pointer, saving a dependent load on every
AttributeList query. Move AvailableSomewhereAttrs into the base so the
attribute sets directly follow it.
CTMark instructions:u, geomean:
clang-23 built: O3 -0.00%, ThinLTO -0.02%
ThinLTO trunk clang built: O3 -0.01%
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
IR: Make AttributeList::getAttributes inline
Store the attribute sets and their count in AttributeListImplBase.
CTMark instructions:u: O3 -0.16%, ThinLTO -0.14%.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[lldb] Let ProcessWasm order the call frame addresses of Wasm frames (#243535)
UnwindWasm now counts frames up from the outermost one, in the invalid
Wasm
address space, which has no memory, and ProcessWasm::CompareCFAs orders
them, so
a synthetic address can neither decrease below zero nor fall inside
linear
memory.
Stack:
- #243487
- #243488
- #243535
[clang-format] Fix unformatted nested designated initializers (#240605)
The value of a designated initializer, such as `.a = {` or `.a = T{`,
was treated as a nested block inlined into its parent, like a JavaScript
closure passed as a function argument. A break after its `{` then set
NoLineBreak on every enclosing scope. The enclosing braced list still
needed breaks before its remaining elements and its closing brace, so no
state was left and the line was kept as written.
LLVM style got around this by breaking after the `=`, which is why it
puts the `{` on its own line below `.a =`. With
BreakBeforeBinaryOperators: All (used by WebKit), a break after `=` is
not allowed, so nothing was formatted.
Don't treat the value of a designated initializer as an inlined block.
Each designated initializer already goes on its own line.
Fixes #201736
Fixes #237142
[clang:codegen][Propeller] Supplement missing block weights using an AFDO profile (#236242)
When generating basic block sections with Propeller CFG profiles, blocks
that are cold in a non-representative load test can be split into cold
sections even though they are warm in production. Add
`-sample-profile-supplement` and
`-sample-profile-supplement-remapping-file` to supplement the Propeller
profile with a representative sample profile, ideally collected in
production.
`BasicBlockMatchingAndInference` reads the sample profile for each
module and looks up block weights itself rather than calling
SampleProfileLoader. Only line-based, non-context-sensitive sample
profiles are currently supported, and a profile must be flow-sensitive
exactly when `-enable-fs-discriminator` is set; unsupported or
mismatched profiles are ignored with a warning.
For each function, only blocks with zero Propeller samples are
supplemented so blocks covered by Propeller keep their Propeller
[22 lines not shown]
[dsymutil] Fix the DWARF 5 relocation maps of the classic linker (#239037)
The dSYM of a mergeable library holds a relocation map, which lets
dsymutil carry the debug info of the library into the binaries that
merge it. That map came out empty, so the debug info of a merged library
was dropped:
- The parallel DWARF linker, did not save the relocations (as opposed to
the classic) for DWARF 4, and DWARF 5.
- The classic DWARF linker looked up the .debug_addr relocations of
DWARF 5 with .debug_info offsets, and dropped those it had saved,
without using them.
Both linkers now save the relocations of .debug_info and .debug_addr,
once per unit.
The parallel linker, which unloads each input before it places the
units, saves them relative to the units, and reports where
the units landed through DWARFFile::UnitOffsetsFunc. dsymutil warns when
the relocations of an object file were all lost.
[8 lines not shown]
[RISCV] Disable R constraint for f64 in inline asm when Zdinx is not enabled. (#243588)
Matches the r constraint.
Fixes #243541
Assisted-by: Claude (for the tests)
[CIR][NFC] Remove a pair of RelativeVTable checks that are not needed (#243511)
The following 2 checks are not currently reachable. The Itanium CXXABI
fix is now going to be handled during lowering, and the CIRGenClass
issue is hidden by other diagnostics.
This cleans the two up.
[Clang][OpenMP] Serialize lockstep warp lanes across omp_set_lock regions
Where the threads of a wavefront/warp run in lockstep (as for many typical
GPUs), multiple lanes reaching an omp_set_lock call may deadlock (or trap,
on AMDGPU) if they contend for a lock. This is actually permitted by
the spec (OpenMP 6.0, 1.2 Execution Model: "A program that relies on
concurrent execution of such diverging code paths for the purposes of
synchronization may deadlock.").
However, in some common cases we can do better. This patch allows
set/unset pairs to work as long as their lock expressions are the
same, they are in the same compound statement, and no intervening code
has control-flow that enters or leaves the sequence or various other
constructs. I.e.:
omp_set_lock(L); ... omp_unset_lock(L);
is emitted through the lane serialization that OpenMPIRBuilder provides
for critical regions, so that each lane takes and releases the lock
[13 lines not shown]
[OpenMP][AMDGPU] Implement the device lock routines
This patch adds implementations of omp_init_lock, omp_set_lock,
omp_unset_lock and omp_destroy_lock for AMDGPU.
A spin lock has a problem on targets that group execution threads into
wavefronts or warps: the lanes of a wavefront share one instruction
stream. When several active lanes spin for the same lock, the one that
takes it is predicated off until all the others have left the loop, so
it never reaches the omp_unset_lock that would let those others proceed.
OpenMP 6.0 permits this (threads in one progress unit that synchronize
while divergent may deadlock), but a hung kernel is hard to diagnose, so
omp_set_lock checks whether another active lane of its wavefront wants
the same lock, says so, and traps. The check cannot see lanes of one
wavefront that reach omp_set_lock for the same lock on divergent paths,
one after the other; those still hang.
The message goes to stderr through the GPU libc when it is available,
by way of a new ompx::reportError: this allows errors to be emitted more
[5 lines not shown]
[KnownFPClass] Rule out zero and subnormal in more cases for fadd/fsub (#242911)
Part of https://github.com/llvm/llvm-project/issues/242935
Refines deductions around zero/subnormal for `fadd`/`fsub`:
- zero: `x + y` is only zero if `x` and `y` are both zeros or if `x ==
-y` (cancellation).
- subnormal: Only `psub + (zero | sub)` and `pnorm + (nsub | nnorm)` may
produce `psub`.
- normal: only `pnorm + finite` and `psub + psub` may produce `pnorm`.
Follow-up to https://github.com/llvm/llvm-project/pull/239064
[IR][Clang] Guard full-width shift in FixedPointBuilder (#239969)
Casting unsigned _Fract to an integer shifts by its full width, since
scale == width.
Fixes https://github.com/llvm/llvm-project/issues/221207
[lldb] Don't run stop hooks at the initial stop by default (#242939)
When LLDB first gains control of a process, it runs every stop hook that
wasn't added with `--at-initial-stop false`: when an attach completes,
when a core file has loaded, and at a launch's entry stop. That entry
stop comes before the dynamic loader has loaded the process's libraries,
and unless the launch asked to stop at entry, LLDB resumes the process
right after it, so nobody sees it stop. On Darwin, where the launch goes
through an attach, `Process::CompleteAttach` runs the stop hooks there
too. A stop hook that reads the process usually runs too early there.
This patch makes `--at-initial-stop` default to `false`, for both
`target stop-hook add` and `target hook add`, so stop hooks first run at
a stop the user sees. A stop hook that has to run when LLDB gains
control of the process, for example to set things up when an attach
completes or when a core file has loaded, asks for it with
`--at-initial-stop true`.
A follow-up, #243394, runs the stop hooks that a module's script adds at
[2 lines not shown]
[lldb] Keep foreign synthetic children alive in ValueObjectSynthetic (#241553)
ValueObjectSynthetic::GetChildAtIndex caches each child as a raw pointer
in m_children_byindex and only keeps a shared pointer to children marked
as synthetic-children-generated. A child that the provider created in
its own ClusterManager, and that is not marked, is kept alive only by
the shared pointer handed back to the caller. Once the caller drops it,
the child's manager destroys it, and the next lookup of that index calls
GetSP() on freed memory.
Python providers do this when they return a new root value, for example
from SBTarget::CreateValueFromData or an expression result, and keep no
reference to it. The crash shows up as a SIGSEGV in
ClusterManager::GetSharedPointer under SBValue::GetChildAtIndex.
Also keep a shared pointer to any child whose manager differs from ours.
Children in our own manager live as long as we do, so they still need no
extra reference.
assisted with: claude
[OpenMP] Make device omp_test_lock try to set the lock
This patch fixes the semantics of omp_test_lock for NVPTX and SPIR-V, and
uses the same implementation for AMDGPU too. The function is intended
to take the lock without blocking, and return whether it succeeded,
whereas the previous implementations just tested whether the lock was
already taken or not.
Other AMDGPU lock routines are added by subsequent patches, so the
newly-added test is XFAILed for that target until those land.
Assisted-By: Claude