[flang][acc] Prefer the reduction mapping when remapping region symbols (#233938)
When a variable appears on several data clauses of one compute
construct, `AccDataMap::remapDataOperandSymbols` bound the region's
symbol to the first data operation result, on the assumption that every
result for a symbol addresses the same memory.
For a reduction the results are not interchangeable. The reduction
clause carries bounds for the section while the data clause maps the
whole variable, so for
```fortran
!$acc parallel loop copy(rarr) reduction(+:rarr(3:10))
```
The variable has two mappings and only the reduction one describes the
accumulator. Binding the region to the whole-array `copy` meant accesses
inside it, including the `acc.reduction` rooted on that declare, were
expressed against the variable's mapping rather than the accumulator's.
[11 lines not shown]
[KnownFPClass] Fix fsub input denormal handling (#225605)
Fixes https://github.com/llvm/llvm-project/issues/225587
Refactors the output/input denormal handling for `KnownFPClass::fadd`
and `KnownFPClass::fsub`.
`fadd`/`fadd_self`/`fsub` handle the flushing of output/input denormals,
and will pass the flushed inputs to `fadd_impl` (which uses IEEE
subnormal handling).
`KnownFPClass::fma` remains unchanged (note that the `DenormalMode`
parameter was unused by `fadd_impl`).
[flang][cuda] Mark cuf.device_is_active as a read-only query (#233987)
`cuf.device_is_active` declared no memory effects, so an unused query
could never be removed even though it only reads the CUDA context state.
Give it `MemoryEffects<[MemRead]>` so canonicalization erases it when
dead, for example once the `if (cuf.device_is_active) { ... }` cleanup
it guards has been emptied.
The runtime probe it lowers to must stay free of observable effects; a
comment on `deviceContextTornDown` records that.
[BPF] Lower unwinding to unwind_goto and unwind_exit (#233649)
Replace the .bpf_cleanup table with two new instructions, so that
neither a loader nor the kernel has to dispatch landing pads.
unwind_goto pad BPF_JMP | BPF_JCOND, src_reg = 1
unwind_exit BPF_JMP | BPF_EXIT, src_reg = 1
'call f; unwind_goto pad' goes to the pad when f left with unwind_exit
and falls through when it left with exit. No register says which one it
was: how one instruction tells the other is up to the JIT. In everything
else unwind_exit is exit.
ret exit
invoke f() unwind pad call f; unwind_goto pad
resume r0 = 0; unwind_exit
call _Unwind_RaiseException r0 = 0; unwind_exit
invoke _Unwind_RaiseException goto pad
[56 lines not shown]
[mlir][LLVMIR] Translate dso_local on llvm.mlir.alias
MLIR's LLVM IR translation now sets dso_local on the aliases it creates
from llvm.mlir.alias, the same way it already does for globals, functions
and ifuncs. The importer already reads the flag, so it now survives a
round trip.
Assisted-by: Cursor / claude-opus-5.5
[RISCV] Correctly restore libcall CSRs with SCS (#233338)
Fixes #233318
Before this change, we were restoring some callee-saved registers twice
when using save/restore libcalls with shadow call stack (SCS), and the
second restore was happening after the stack was deallocated using the
wrong register and offset calculation, which was causing lots of access
problems.
The problems were:
- We were using the entire list of Callee Saves rather than just the
subset that would have been restored by the libcall. This caused
duplicate restores because of how the CSI subsetting works.
- We were not using the correct offset calculation in
eliminateFrameIndex, which was causing us to calculate the wrong
address for the saves/restores.
Assisted-by: AI
Co-authored-by: Mitch Briles <mitchbriles at gmail.com>
[HLSL] Allow a groupshared struct to be passed as an implicit parameter (#229939)
If the implicit object parameter is in the groupshared address space and
the function is const then perform an LValue to RValue cast.
If the implicit object parameter is in the groupshared address space
then create an HSLOutArgExpr which handles the writeback of the object
from the temporary.
Adds an AST test and a Codegen test.
Closes #228563
fix: [CIR] Check only the converted pointer's address space
Limit opaque pointer conversion to its own address space and diagnose unsupported pointee types where their layout is required. Emit type-specific errors for failed pointer conversions.
Validate pointee memory conversion before deriving copy sizes, alignments, or pointer-difference strides from CIR layout. Keep deeper pointee types opaque when their layouts are not needed.
Assisted-by: Codex / GPT-6
[CIR] Reject language address spaces in DirectToLLVM pointer conversion
Reject unlowered language address spaces in pointer types when bypassing TargetLowering. Guard pointer-producing lowerings, including generated patterns, so failed conversions report legalization failures instead of silently selecting address space zero or constructing invalid LLVM operations.
Assisted-by: Codex / GPT-6
[CIR] Propagate initializer type adjustment failures
Reject initializers whose active members have no LLVM representation, including when an enclosing union's storage type is convertible. Propagate recursive adjustment failures before querying data layout or constructing LLVM operations.
Assisted-by: Codex / GPT-6
[CIR] Propagate type conversion failures in DirectToLLVM (#224237)
Propagate failed type and constant conversions through DirectToLLVM so
unsupported types produce legalization failures instead of invalid LLVM
operations or a void function result.
Assisted-by: Codex / GPT-6
[AMDGPU][True16] Use the right 16-bit operand classes in med3 and sub (#233632)
Int16Med3Pat hardcoded VSrc_b16 instead of using the outputSrcType
parameter it already takes, so the true16 instantiations named the
non-true16 operand class for V_MED3_I16_t16_e64 and V_MED3_U16_t16_e64.
The true16 V_SUB_NC_U16_t16_e64 pattern named VSrc_b16 for the same
reason, where VSrcT_b16 is the true16 operand class.
No test changed
Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>
[lldb] Fix shared cache segment mapping leak (#232370)
`map_shared_cache_binary_segments` never released the dispatch_data
returned by dispatch_data_create_map. SharedCacheInfo also returned
copies of SharedCacheImageInfo, so the extractor cached by
GetExtractor() was dropped and every lookup mapped the image again.
Keep the mappings alive in a DataBuffer that releases them on
destruction, and share a lazily created extractor between copies so each
image is mapped once.
rdar://189874911
Assisted-by: Claude
[AMDGPU][True16] Select V_CNDMASK_B16_t16 for i1 to i16 extensions (#233646)
In real true16 mode an i16 result lives in a VGPR_16, but the zext,
anyext and sext of i1 to i16 patterns selected V_CNDMASK_B32_e64, which
defines a 32-bit register. Add true16 variants selecting
V_CNDMASK_B16_t16_e64 and guard the existing patterns with
NotUseRealTrue16Insts.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>
[lldb][Mach-O] Accept zlib-compressed LC_NOTE payloads (#231745)
LC_NOTE payloads such as "process metadata" can be large and compress
well. A compressed payload uses the layout of a GNU .zdebug section: the
magic "ZLIB", the uncompressed size as a big-endian uint64_t, then an
RFC 1950 zlib stream. Uncompressed payloads keep working. Only "process
metadata" reads its payload through this path for now.
Alternatives considered:
- zstd and xz compress better, but neither is available in every LLDB
build.
- libcompression codecs are Darwin-only.
- An ELF Elf64_Chdr has no magic, so detection would be inferred from
the data, which only holds for JSON.
- A separate note name for compressed payloads would make every reader
look for both names.
The size comes from the file, so it is checked against deflate's maximum
[2 lines not shown]
[mlir][Canonicalizer] Preserve analyses when there is no change (#232159)
Call `markAllAnalysesPreserved` when there is no change in `applyPatternsGreedily`.
Assisted-by: gpt 6 luna
[AMDGPU][True16] Use vgpr32_lo16 for fcopysign and sext_inreg results (#233517)
The true16 fcopysign and DivergentSextInreg patterns produce an i16 from
V_BFI_B32_e64 / V_BFE_I32_e64, which define a 32-bit register. Wrap the
result in the vgpr32_lo16 OutPatFrag so the extracted low half is
anchored to a VGPR_32 instead of relying on type inference, and give the
f64 fcopysign source EXTRACT_SUBREG an explicit i32 type.
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply at anthropic.com>
[InstCombine] Fix ctlz/cttz xor folding for non-power-of-two widths (#233746)
The ctlz/cttz xor fold for power-of-two inputs relies on
k ^ (BW - 1) == BW - 1 - k, which only holds when BW is a
power of two. Require a power-of-two scalar bit width for
both directions.
Fixes #233232.
Assisted-by: Codex.