[clang-format] Fix OverEmptyLines aligning trailing comments across block boundaries (#208324)
Fix `AlignTrailingComments` with `OverEmptyLines` aligning trailing
comments across block boundaries (e.g., between two functions or
structs). The alignment sequence now breaks at block-type braces
(`BK_Block`).
This is an `OverEmptyLines` bug exposed by
bae9ddca423145baf0c35e31898b723aa273f85c (#206393).
Fixes https://github.com/llvm/llvm-project/issues/208266
(https://github.com/llvm/llvm-project/issues/208266).
Commit created with the help of kiro-cli.
Co-authored-by: Vladislav Aranov <vladislav.aranov at ericsson.com>
Triple: Add query for the default long double format (#211239)
The long double format changes the library call info, which needs
to be computed independently of codegen. Implement this based on the
clang target code.
---------
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
AMDGPU: Add dedicated features for wavesize support (#212581)
Previously we had features for which wavesize is active,
and unstructured checks for which targets support which
wavesize.
One assembler test changes because it was artificially
forcing wave64 on gfx1250 for test simplification, and
the supportsWave32 helper function was buggy.
Co-authored-by: Claude (Claude-Opus-4.8)
[lit] Switch tests to using path function (#212381)
All the other test suites use the PATHS option to configure_lit_site_cfg
and the path() function in lit.site.cfg to make the site configs
relocatable. Apply the same pattern to lit's own suite as well.
IR: Accept x86_fp80 and float as a long-double-type value (#210818)
Prepare to emit long-double-type for all targets. x86 obviously needs
x87, and AVR uses float.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[LLVM][docs] Small updates to Writing an Backend
- Methods `eliminateCallFramePseudoInstr`, `emitPrologue`, `emitEpilogue` have to be implemented in subclass of `TargetFrameLowering`
- Method `hasFP` was renamed to `hasFPImpl`, and also belongs into subclass of `TargetFrameLowering`
- Give path to the `TargetInfo` class
- Fix parameters of `RegisterTarget`
- Fix path to `TargetRegistry.h`
Assisted by IBM Bob
[AMDGPU] Fix llvm.amdgcn.ballot with return width != wavefront size (#211493)
Before wave mask was emitted directly in the requested return type,
which failed to select for i32 ballots on wave64 (and vice versa)
Compute the mask at the wavefront width and then zext or trunc it to the
result type
AMDGPU: Add dedicated features for wavesize support
Previously we had features for which wavesize is active,
and unstructured checks for which targets support which
wavesize.
One assembler test changes because it was artificially
forcing wave64 on gfx1250 for test simplification, and
the supportsWave32 helper function was buggy.
Co-authored-by: Claude (Claude-Opus-4.8)
Triple: Add query for the default long double format
The long double format changes the library call info, which needs
to be computed independently of codegen. Implement this based on the
clang target code.
clang: Emit "long-double-type" module flag generically
Move emission of the "long-double-type" module flag out of PowerPC
and into generic code, so it describes the long double format for all
targets.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
IR: Accept x86_fp80 and float as a long-double-type value
Prepare to emit long-double-type for all targets.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[OpenMP] Propagate PRESENT to pointee entries in mapper codegen
Extend map-type-modifier propagation in emitUserDefinedMapper to the PRESENT
modifier, but only for entries that have an attach ptr (the pointee data, whose
storage differs from the struct's own). A present modifier on the outer clause
must require that pointee to be present on the device.
This is gated on a new PropagatePresentToPointee argument, which Clang sets from
CGM.getLangOpts().OpenMP >= 60. Before 6.0 the present modifier is treated as
not applying to the pointee: the spec committee confirmed the divergence
between the present motion modifier (to/from) and the present map-type modifier
(map) was unintentional, to be fixed as an OpenMP 6.0 erratum. Only propagation
is gated; present written directly in a mapper's own clause applies at all
versions.
A TODO notes PRESENT should also propagate to the struct's own members, which
is blocked while pointer members use PTR_AND_OBJ.
Update the present-check tests to their final 6.0-gated behavior.
[2 lines not shown]
[OpenMP][Clang] Enable ATTACH-style maps for mappers.
Track per-entry attach-ptr info (HasAttachPtr) through mapper codegen so that
emitUserDefinedMapper does not add a new outer MEMBER_OF to pointee/combined
entries (which occupy different storage than the struct) or to ATTACH entries.
Clang and the MLIR translator populate the per-entry array in parallel with the
other MapInfosTy arrays.
Address review:
- Rename MapSkipMemberOfArrayTy to MapHasAttachPtrArrayTy to match the
HasAttachPtr field it backs.
- Restructure the emitUserDefinedMapper comment into a bulleted (*)/(**)/(***)
list keyed to the example entries.
- Reword the Clang comments: HasAttachPtr marks pointee entries that have a
base attach-ptr; a combined entry has a base attach-ptr if its constituents
do; cross-reference emitUserDefinedMapper for the MEMBER_OF rationale.
- Update the moved present-check tests to their now-correct behavior (the
attach-style maps make the inbounds present checks pass and remove the
"explicit extension" errors).
[2 lines not shown]
[OpenMP] Propagate ALWAYS/DELETE/CLOSE map-type modifiers to mapper entries
When a map clause uses a user-defined mapper, the map-type-modifying bits
(ALWAYS, DELETE, CLOSE) on the outer clause must apply to each map the mapper
inserts (OpenMP 6.0:281:34). Propagate them in emitUserDefinedMapper by OR-ing
the imported modifier bits into each pushed component, except ATTACH entries
(ATTACH|ALWAYS is reserved for attach(always) and the other bits are
meaningless for ATTACH).
PRESENT is intentionally not propagated here yet (a TODO notes it is handled in
a follow-on, since it requires distinguishing pointee entries from the struct's
own storage).
Update the offload always-propagation tests to their now-correct behavior:
ALWAYS forces a member transfer that the ref count would otherwise suppress, so
mapper_map_always_from.c reads s.y back as 111, and the enter-data variants
(C and Fortran) see 111 in the device copy (all were 0 before this change).
Since emitUserDefinedMapper is shared between clang and flang, the Fortran test
covers the flang path as well.
[2 lines not shown]
[MIR2Vec] Handle machine functions with no basic blocks (#212294)
depth_first() asserts on an empty MachineFunction, since getEntryNode()
dereferences the block list sentinel via front(). Return the zero vector
instead, as IR2Vec does for declarations.
[HLSL] Implement HLSL InterlockedXor (#209254)
Follows existing HLSL InterlockedOp implementations to provide
InterlockedXor in HLSL, with DirectX and SPIRV support.
https://github.com/llvm/llvm-project/issues/99127
[NFC][OpenMP] Add mapper-specific tests exercising pointee section mapping. (#204269)
* Add a few tests for when a mapper does something like `map(s.p[0:10])`
where `p` is a pointer.
* Add a few tests that require propagation of bits like `present/always`
into a mapper.
* Fix a few tests that were expecting `p` to be mapped when the mapper
only said `map(s.p[0:10])`.
The output of a few tests is different from what we expect. They have
been annotated with FIXMEs, and the expected output for when the
follow-up changes in this stack to propagate the map-type-modifier bits
and using attach-style mapping for mappers get merged.
---------
Co-authored-by: Claude Opus 4.8 <noreply at anthropic.com>
Revert "[Driver][SYCL] Add compile-time device library linking for SPIR-V targets" (#212550)
Reverts llvm/llvm-project#196656
The CI does not yet build compiler-rt with SPIR-V support, so
libclang_rt.builtins.bc is absent on that bot. This change made the
missing file a hard error, breaking all libsycl functional tests that
compile with -fsycl.
Re-landing after CI is updated to build compiler-rt for SPIR-V.
PowerPC: Rename "float-abi" module flag to "long-double-type" (#210817)
PPC was emitting a "float-abi" module flag for indicating the type of
long double. The "float ABI" naming is already widely taken by soft vs.
hard float controls (e.g., the clang flag is called -mfloat-abi), so this
shouldn't have taken it. This should also not be PPC specific; x86 has
the same problem. Rename the flag to the more specific
long-double-type, and add appropriate verification and documentation
(which was also missing). Also changes the value names to match the IR
type names.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[clang][ClangScanDeps] Relax logging-two-threads for duplicate module validation (#210587)
`ClangScanDeps/logging-two-threads.c` is flaky. It asserts each module's
timestamp is written exactly once, but under
`-fmodules-validate-once-per-build-session` two workers scanning
different TUs can both notice the shared module is unvalidated this
session and each validate and record it before the other's write lands,
so its timestamp is written once or twice depending on the interleaving.
The double write is harmless: the timestamp field is atomic and both
workers store the same session time. Only the exact-count assertion was
wrong.
Relax the test to the real invariant: the shared module A is written
once or twice and the single-TU module B exactly once. Module compile
and pcm write stay exactly once (the in-memory cache builds each module
once) and the per-module event ordering is still checked by the sequence
blocks.
[4 lines not shown]
[CodeGen] Stop requiring analyses that no pass reads (#212430)
Remove analysis requirements whose pass never calls getAnalysis for
them, and MachineSchedContext::MDT, which no scheduler reads. Also remove
addPreserved calls subsumed by setPreservesCFG (MachineDominatorTree and
MachineLoopInfo are CFG-only analyses) and a now-unpaired INITIALIZE_PASS_DEPENDENCY.
The PowerPC, Hexagon and R600 pipelines each drop a MachineDominatorTree
construction.
Aided by Claude Opus 5