[clang-sycl-linker] Decouple link step from SYCL; adopt -L / --bc-library options (#199777)
The bitcode link phase in `clang-sycl-linker` is not SYCL-specific — it
links input bitcode, then links library bitcode with `LinkOnlyNeeded`.
This PR makes the implementation reflect that and aligns the option
surface with `clang-nvlink-wrapper`.
- Rename `linkDeviceCode` / `getSYCLDeviceLibs` and strip SYCL/device
wording from verbose output, errors, and doc-comments. The
`runSYCLLink` doc-comment is expanded to describe the full
link → split → codegen → AOT → pack pipeline it actually drives.
- Replace `--device-libs=a.bc,b.bc` with repeatable `--bc-library`,
resolved against `-L` search paths. `-L` becomes the canonical form;
`--library-path` / `--library-path=` are kept as hidden aliases and
now accumulate (previously last-wins).
- Consolidate the four `Inputs/SYCL/*.ll` fixtures and
`link-device-code.test` into one `split-file`-based `link.ll`; refresh
affected check prefixes. New checks cover `-L` joined form,
multi-`-L` fall-through, and first-match-wins ordering.
[8 lines not shown]
[AArch64][llvm] Simplify and dedupe hint alias parsing code (NFC)
The code which handles instructions that are aliased in the `HINT`
encoding space is very similar and repetitive.
Move common code into templated functions, so that it's consistent and
simpler, whilst still remaining readable.
This also means any future instructions added in the `HINT` space will
be simpler to implement. Net removal of ~86 lines of code.
NFC, apart from a word change in the `tsb csync` error diagnostic
[AArch64][llvm] Some instructions should be `HINT` aliases (NFC)
Implement the following instructions as a `HINT` alias instead of a
dedicated instruction in separate classes:
* `stshh`
* `stcph`
* `shuh`
* `tsb`
Updated all their helper methods too, and updated the `stshh` pseudo
expansion for the intrinsic to emit `HINT #0x30 | policy`.
Code in AArch64AsmPrinter::emitInstruction identified an initial BTI using a
broad bitmask on the HINT immediate, which also matched shuh/stcph (50..52)
This could move the patchable entry label after a non-BTI instruction.
Replaced it with an exact BTI check using the BTI HINT range (32..63) and
AArch64BTIHint::lookupBTIByEncoding(Imm ^ 32).
A following change will remove duplicated code and simplify.
[2 lines not shown]
[AArch64][llvm] POE2: remove TPMAXn_ELn/TPMINn_ELn and create TPCRn_ELn registers
Some POE2 system registers have been removed/created:
* `TPMAXn_ELn`/`TPMINn_ELn` system registers are now removed
* these encodings are reused in new `TPCRn_ELn` system registers
Adjusted testcases as appropriate.
[lld][LoongArch] Handle DTPREL relocations in debug sections (#199327)
Teach the LoongArch lld backend to classify R_LARCH_TLS_DTPREL32 and
R_LARCH_TLS_DTPREL64 as R_DTPREL.
This allows linker processing of TLS debug info references emitted into
.debug_info via .dtprelword/.dtpreldword. Add 32-bit and 64-bit tests
that assemble objects with DTPREL relocations in debug sections.
[NFC][AMDGPU] Introduce AMDGPU::FlatVariant enum to replace uint64_t FLAT discriminant (#200396)
Replace the uint64_t parameter used as a FLAT address-space segment
discriminant in isLegalFLATOffset, splitFlatOffset,
allowNegativeFlatOffset with a typed enum class to prevent usage of raw
TSFlags.
Co-authored-by: Claude Sonnet 4.6 <noreply at anthropic.com>
[NFC][AMDGPU] Replace uint64_t SDWA inst-type discriminant with typed enum (#200388)
cvtSDWA() previously took a uint64_t BasicInstType parameter and callers
passed raw TSFlag bit values (SIInstrFlags::VOP1/VOP2/VOPC) as a
discriminant. Introduce a private AMDGPUAsmParser::SDWAInstType enum
class to remove the raw-flag dependency.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply at anthropic.com>
[SYCL] Fix -nolibsycl and spurious spirv-link flags for SYCL offloading (#200252)
Two related driver fixes for SYCL offloading on Linux:
1. Honor -nolibsycl during linking: the SYCL runtime library
(libLLVMSYCL.so) was unconditionally added to the link line even when
-nolibsycl was passed. The flag was recognized but silently ignored at
the point where the library path is emitted.
2. Do not forward spirv-link flags to clang-sycl-linker: the driver was
passing --allow-partial-linkage and --create-library to
clang-sycl-linker for all SPIR-V offload targets, but these flags are
only meaningful to the out-of-tree spirv-link tool used by OpenMP. SYCL
uses clang-sycl-linker which does not accept them, causing a link
failure. The flags are now restricted to non-SYCL SPIR-V offload kinds.
---------
Co-authored-by: Claude Sonnet 4.6 <noreply at anthropic.com>
[Clang][Sema] Fix crash when calling EvaluateForOverflow for UnaryOpe… (#200317)
…rator that can not overflow
A while ago I added checking for overflow in unary operators during
constant evaluation:
https://reviews.llvm.org/D142867
This created some new bug opportunities. I am now checking if the
UnaryOperator can overflow before calling EvaluateForOverflow in
Sema::CheckForIntOverflow.
Fixes: https://github.com/llvm/llvm-project/issues/170072
[flang][FIRToMemRef] Non-box complex slices use shapeVec strides, not `fir.box_dims` (#200285)
FIRToMemRef now lowers `fir.array_coor` on projected complex %re / %im
when the base is a contiguous `!fir.ref` with `fir.shape` (e.g. a static
component array in a derived type), without calling `fir.box_dims` on
the ref and with strides that match the memref<…×2×T> view.
Previously, any projected slice is lowered through the descriptor path
and produced invalid `fir.box_dims` on a ref. Fixed to take descriptor
strides only when the coor base is actually a box. For ref + shape, it
keeps the synthesized row-major layout and scales array strides by two
scalar slots per complex, with a re/im dimension (extent 2, stride 1).