[CIR] Accept packed records in x86_64 callconv lowering
isSupportedType turned down any record CIR marks packed, so a signature
carrying one failed the pass. The reject predates the bridge reading field
offsets. RecordType::getElementOffset and the record's size already account
for packing, so the reject has nothing left to guard.
Delete it, with one exception. mapCIRType drops a zero-sized member before
classification, so a trailing zero-length array in a packed record passed in
a register where classic uses byval. That gets a narrower reject naming it.
A polymorphic class stays NYI for want of a vptr mapping, and a padded record
reached through a named bit-field access unit stays NYI on the existing
unit-width gap.
Assisted-by: Cursor / claude-opus-5
[flang] Extend LICM cheap nested hoisting to scalar loads (#217616)
Admit fir.address_of and scalar loads in the "cheap" nested-region
hoisting mode, which previously admitted only fir.convert. Loads are
limited to trivial non-vector types and to descriptors of known rank,
since vector loads may be wide and an assumed-rank descriptor load
becomes a runtime-sized descriptor copy. This is a cost heuristic change; both
modes share `shouldMoveFromNestedRegion`, so the safety conditions are
Admit fir.address_of and loads of trivial and descriptor types in the
"cheap" nested-region hoisting mode, which previously admitted only
fir.convert. This is a cost heuristic change; both modes share
`shouldMoveFromNestedRegion`, so the safety conditions are unchanged.
Test added to `flang/test/Transforms/licm.fir` cover the newly added
cases (scalar, global scalar, descriptor) and the boundary: derived-type
and vector loads are not hoisted, a volatile scalar load stays
conditional, and a global scalar read inside an OpenMP worksharing
region moves out of the inner serial loop while remaining inside
[4 lines not shown]
[offload] Use pinned memory for KLE
Reduce kernel launch latency by using the fast path "pinned host memory
-> device memory" for submitting the kernel launch environment to the
device.
Claude assisted with this patch.
AMDGPU: Add SubArchSpelling override to the TargetParser TableGen
Add an optional SubArchSpelling field for targets where the subarch name isn't
trivially derivable from it's gfxNMK name.
Co-Authored-By: Claude <noreply at anthropic.com>
[DirectX][SPIR-V] Fix `copysign` backend lowering (#217421)
Fixes #216826.
Adds `copysign` DirectX backend lowering and fixes the SPIR-V backend
lowering. Both lower with the bit manipulation `copysign(magnitude,
sign) = bitcast((bitcast(magnitude) & ~signBit) | (bitcast(sign) &
signBit))`, except the OpenCL path, which still emits `OpExtInst ...
copysign`.
Assisted-by: Claude Opus 4.8
[LLDB] Update DIL assignment to respect ValueObject::CanSetValue (#217960)
This will prevent DIL from allowing users to try to assign new values in
cases where that could lead to incorrect behavior.
[MLGO][CMake] Scope TensorFlow-AOT include usage (#218033)
## Summary
`TENSORFLOW_AOT_PATH` currently adds TensorFlow's include directory with
directory-wide `include_directories()`. This exposes TensorFlow's
bundled third-party headers to unrelated LLVM targets.
One concrete failure occurs when remote clangd is enabled: TensorFlow's
bundled Protobuf headers can shadow the Protobuf installation selected
for clangd's generated remote-index sources.
Replace the directory-wide include with a usage requirement on
`tf_xla_runtime`. Make the runtime dependency private to MLGO-owning
libraries, so those owners retain the TensorFlow headers they need while
unrelated targets do not inherit them. The runtime remains a link-only
dependency for final static linkers.
Fixes #218032.
[24 lines not shown]
[clang-repl] Stop interpreter init on action failure (#217147)
`clang::Interpreter` previously ignored the result of its initial
`CompilerInstance::ExecuteAction()` call and always constructed the
`IncrementalParser`. When the initial action failed, the parser could be
created from an invalid compiler state.
In practice, this failure happens if the incremental PCH included has
expired, due to system headers changing. This happens quite regularly,
after system updates, and is affecting jank users.
To fix this, the `Interpreter` now returns an error immediately when the
initial action fails or records a diagnostic error. This allows jank to
add a diagnostic consumer to detect PCH-related errors and rebuild the
PCH as needed.
----
I used Github copilot to help me diagnose and fix the issue. I have
manually reviewed the code, manually executed the test, and have
verified that the fix works locally for jank. I understand the change
completely.
[CIR] Track the vtable pointer address-space gap with an assert
Andy pointed out on #218457 that "a vtable pointer is always the default
address space" is an implementation gap dressed up as an ABI fact:
cir::VPtrType has no address-space parameter, so a non-default address
space is unmodeled rather than impossible. Matches the assert already on
VPtrType's case in LowerToLLVM.cpp.
Assisted-by: Cursor / claude-opus-5
[MLIR][Linalg] Fix crash decomposing padded pack with non-unit un-tiled outer dim (#218141)
DecomposeOuterUnitDimsPackOpPattern only checked that the *tiled* outer
dims of a linalg.pack are all 1. When the op has a padding value,
getPackOpSourceOrPaddedSource additionally requires every outer dim
(including un-tiled ones) to be 1 and asserts otherwise. A pack with a
non-unit un-tiled outer dim therefore passed the guard but tripped the
assertion, crashing the compiler.
Bail out of the pattern via notifyMatchFailure when a padding value is
set and any outer dim is not 1, turning the crash into a graceful
no-match.
Fixes #218109.
MLIR: Fix CI: use OpTy::create, clang-format, exempt generated table
- MIRImport: replace deprecated builder.create<OpTy>() with OpTy::create(...)
(the -Werror -Wdeprecated-declarations build failed on the old form).
- Run clang-format over the hand-written translation and tblgen sources.
- Wrap the generated AArch64MIRLowering.inc in a clang-format off region so the
data table is exempt from formatting.
[AArch64] Don't add runtime SCEV checks from containsDecreasingPointers. (#216961)
containsDecreasingPointers is a heuristic query, called from
preferPredicateOverEpilogue to decide whether tail-folding needs
TailFoldingOpts::Reverse. It only guides tail-folding decision, but
permanently added predicates, which may not even be used later.
Request the predicates explicitly and discard them instead. They are not
needed for correctness; the vectorizer has to add all predicates needed
for correctness independent of TTI.
PR: https://github.com/llvm/llvm-project/pull/216961
[CIR] Drop the callconv opt-out from seven more CIR tests (#218275)
Following #216396, seven more tests carried
`-fno-clangir-call-conv-lowering` with a TODO waiting on parameters of
an empty or tag class. `coro-exceptions.cpp` also named a bare-variadic
declaration with no named parameter. #214742 lowers all seven now, so
the opt-out and its TODO go and the tests exercise the pass.
No CHECK line moves, so the IR these tests already pinned is what the
pass produces.
Assisted by: Cursor / claude-opus-5
[mlir][vector] Fix multi-reduction unrolling with a lower rank target shape (#216799)
Fixes #216640
`mlir-opt -test-vector-unrolling-patterns` crashes on a rank 3
`vector.multi_reduction`:
```
Assertion `offsets.size() == sizes.size() && offsets.size() == strides.size()' failed.
```
The unroll target shape is allowed to have fewer dimensions than the
vector being unrolled, in which case it applies to the trailing
dimensions. `computeShapeRatio` accepts that, and
`UnrollElementwisePattern` handles it by padding the shape with leading
unit dimensions.
`UnrollMultiReductionPattern` used the target shape as it is, both for
the size of the slice taken from the source and to index the dimensions
[24 lines not shown]
[CIR] Classify around padding and zero-width bit-fields on x86_64 (#217517)
The bridge turns down any struct whose CIR type has a pad member, which
is every over-aligned struct and every struct with a gap between two
members. The ABI library could have handled these all along, since it
reads each field's offset and treats a gap as holding nothing. However,
we were handing the library the padding as though it were a field, so it
saw data where there was none. Now the pass gives the library only the
members that hold data.
A zero-width bit-field has no member at all, so CIRGen emits one for it,
marked `bitfield` and typed as a zero-length array of the bit-field's
declared type, for the pass to read back.
Assisted-by: Cursor / claude-opus-5