[CI] Do not explicitly build ClangIR (#234384)
This is enabled by default in check-clang after
dfd756d1b830ff810644d19ed1eb7ff5f08a8585, so need to do any more
explicit handling.
[SandboxVec][LoadStoreVec] Use more accurate alignment (#231695)
Up until now LoadStoreVec used to create vector loads/stores with
align(1) regardless of the alignment of the original instructions that
got vectorized. On the other hand BundleVec used the alignment of the
first element.
This patch introduces a new VecUtils::getVecAlignment() function that
unifies both. For now we use the alignment of the first element, but
this should be improved in the future with more precise alignment
reasoning.
[CMake] Add a launcher for TableGen commands (#234410)
Add `LLVM_TABLEGEN_LAUNCHER`, an empty-by-default, semicolon-separated
command prefix analogous to `CMAKE_<LANG>_COMPILER_LAUNCHER`. It applies
to commands created by `tablegen()`, including MLIR source sharding, and
lets users select a launcher independently of their compiler
configuration. I'm using this with
[`recelient`](https://github.com/bazelbuild/reclient) to distribute
tablegen actions.
Such launchers tend to regress build wall-time since most tablegen runs
are fast and staging the remote execution environment for tablegen takes
more time than it takes to run tablegen, but this can be handy for
offloading LLVM builds from "small" machines to large remote executors,
or allowing one to do multiple local builds in parallel, like with
unrelated agents, without consuming local resources.
@manasij7479 has some prototypes that teach lit to distribute test
shards with `reclient` as well, but that comes later.
[mlir][NFC] Fix mlir prettyprinter debuginfo test for MSVC (#234409)
MSVC doesn't allow reinterpret cast of an integer to its own type. The
mlir gdb prettyprinter test was doing this via a template. This caused a
failure on some Windows buildbots.
This change fixes that by doing what the template function did but
without the cast.
[X86] Use the Win64 i128 libcall lowering for UEFI (#233114)
UEFI on x86-64 follows the Win64 ABI: clang passes `__int128` arguments
by pointer and returns the value in XMM0, and the compiler-rt builtins
built for the target expect exactly that. The backend however only
applied the Win64 lowering of the i128 division, remainder and floating
point conversion libcalls (`LowerWin64_i128OP`,
`LowerWin64_INT128_TO_FP`, `LowerWin64_FP_TO_INT128`) to Windows
triples, so for `x86_64-unknown-uefi` the halves of the operands were
passed in registers instead:
```
$ clang --target=x86_64-unknown-uefi -O2 -S i128.c # unsigned __int128 d(a, b) { return a / b; }
...
movq (%rcx), %rax # low half of a in rcx
movq 8(%rcx), %r10 # high half of a in rdx
movq (%rdx), %r8 # b in r8:r9
movq 8(%rdx), %r9
callq __udivti3
[16 lines not shown]
[BoundsSafety][NFC] Add late-parsed type attribute lists to declarators
This is groundwork for late-parsing type attributes in every type
position where an ordinary type attribute can appear. Ordinary type
attributes are kept on the DeclSpec, on each DeclaratorChunk and on the
Declarator. Give late-parsed type attributes the same three homes, with
nothing producing or consuming them yet.
No functional change: no caller passes a list yet, so the lists stay
empty. The next commit populates them.
Assisted-by: Opus 5.5
Attributor: Add only new attributes when manifesting
manifestAttrs collected the attributes to add in an AttrBuilder, then
copied the position's attribute set into another AttrBuilder to merge
them in. Collect them in an array and merge them into the set in one
pass. This requires the attributes passed to manifestAttrs to be sorted
like an attribute set, which all callers already do. The only one
passing more than one attribute is AMDGPUAttributor, whose implicit
argument attributes are sorted.
Instructions spent in amdgpu-attributor:
rocPRIM test_device_scan, gfx942: 770.2M -> 710.8M (-7.7%)
Blender Cycles HIP kernel, gfx1100: 380.0M -> 379.5M (-0.1%)
rocPRIM 16 tests, full LTO, closed world: 3019.8M -> 2855.9M (-5.4%)
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
IR: Add attributes from an array to an attribute set
Add AttributeSet::addAttributes and AttributeList::addAttributesAtIndex
overloads taking an array of attributes sorted like an attribute set,
with distinct kinds. They merge the attributes into the set in one pass,
without first copying the set into an AttrBuilder and adding each
attribute to it.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
PPC: Fold 64-bit zero-extending word load feeding extsw subregister
A gprc LWZ/LWZX feeding EXTSW_32_64 is rewritten into a sign-extending
LWA/LWAX load. Extend the same fold to the 64-bit zero-extending word
loads LWZ8/LWZX8 when the EXTSW_32_64 reads their sub_32 subregister,
producing a single LWA/LWAX instead of a redundant lwz+extsw pair.
Co-authored-by: Claude (Claude Opus 4.8, claude-opus-4-8) <noreply at anthropic.com>
PPC: Add MIR examples for missed extsw+word-load fold on subregister input
A gprc LWZ/LWZX feeding EXTSW_32_64 folds into a sign-extending LWA/LWAX
load. The equivalent 64-bit zero-extending word loads (LWZ8/LWZX8) whose
sub_32 feeds EXTSW_32_64 are not folded, leaving a redundant lwz+extsw
(or lwzx+extsw) pair. Add MIR examples documenting the missed fold.
Co-authored-by: Claude (Claude Opus 4.8, claude-opus-4-8) <noreply at anthropic.com>
[NVPTX][test] Gate custom-abi-preserve-reg.ll ptxas-verify on ptxas-sm_80 && ptxas-isa-9.0 (#234391)
custom-abi-preserve-reg.ll (added in #227499) compiles with
-mattr=+ptx90, which requires a CUDA 13.0+ ptxas supporting PTX ISA 9.0.
Gate %ptxas-verify on ptxas-sm_80 && ptxas-isa-9.0 instead of bare ptxas
so the test does not fail when run with an older ptxas.
[clang][test] Use the FreeBSD sysroot tree in freebsd.cpp (#234366)
The libc++ sysroot include path tests in freebsd.cpp were using
basic_openbsd_libcxx_tree as the sysroot. Use basic_freebsd_libcxx_tree
instead. Both trees have the same layout, so this does not change what
is being tested.
[clang][CodeGen] Rename isSingleElementStruct to isSingleElementRecord and factor out PPC FP/vector check (NFC) (#234054)
Two NFC refactors split out of #223481 at review request.
- Rename isSingleElementStruct to isSingleElementRecord. It decomposes
unions
as well as structures, both at the top level and in nested fields and
bases;
the new name and comment say so, so that a later isSingleElementStruct
can
refuse unions.
- Factor the single-element floating-point/128-bit vector aggregate test
that
PPC64_SVR4_ABIInfo::computeInfo and getParamTypeAlignment each performed
into getSingleElementFPOrVectorType.
Assisted-by: Claude Code
[libc][cmake] Respect the configured optimization level for the Linux thread and TLS objects
The -O3 override on the Linux thread object dates from the old approach of
reading the thread arguments off the new thread's stack, which #225384
removed; the TLS objects copied the same pattern in #225418. Neither needs
it anymore, so drop the overrides and use the optimization level configured
by CMake.
Assisted-by: Claude
[libc][cmake] Respect the configured optimization level for tests
Follow up to #126322 and #233964 for the test side: the math and stdfix
tests, hash_test and the MPFR/MPC wrappers still force -O3. Drop the
overrides so they use the optimization level configured by CMake like the
rest of the library.
Assisted-by: Claude
[libc++] Update macOS CI jobs to C++26 (#230136)
Currently released Xcode does not support C++29, but it supports C++26
so we should test C++26 features on it.
[CodeGen] Drop dead SlotIndexes before allocation
SlotIndexes keeps the index list entry of an erased instruction and only
clears its instruction pointer. Live range sizes are measured in slot
indexes and greedy ranks ranges by size, so the leftovers inflate some
ranges more than others and reorder allocation, spilling heavily on
register-starved functions.
Add SlotIndexes::compactIndexes() to erase them. Erased entries are
unlinked, so holding an index to one is now a bug; linkedEntry() asserts
on it. The one analysis that did was LiveIntervals, so add
removeUnreferencedIntervals() to retire the intervals responsible.
Off by default behind -greedy-compact-slot-indexes, since it changes
allocation across much of the test suite.