[ValueTracking] Treat RISC-V vsetvlimax as a power of two (#218831)
VLMAX = VLEN * LMUL / SEW is always a non-zero power of two for any valid
vtype, so llvm.riscv.vsetvlimax is a power of two regardless of SEW/LMUL or
whether a vscale_range is present. Report this in isKnownToBeAPowerOfTwo
so that consumers such as ctpop and the x & (x - 1) idiom can fold.
Assisted-by: TRAE CLI (Opus 4.8)
[ExpandMemCmp] Apply NumLoadsPerBlock to ordering compares (#215186)
Make NumLoadsPerBlock control both equality and ordering memcmp
expansions. For ordering comparisons, pack consecutive legal loads
in memory order into a value no wider than the target preferred
load width, then compare the packed values. This preserves
lexicographic semantics while reducing conditional branches.
BPF uses groups of eight byte-load pairs, so an align-1 32-byte
comparison forms four i64 compare blocks instead of 32 byte compare
blocks.
Other targets retain their existing default ordering behavior unless
grouping is explicitly requested.
Assisted-by: TRAE CLI (GPT-5)
[Github] Bump formatting/tools container to 23.1.0 (#218815)
Now that 23.1.0 has been released, we should update the container to
ensure we're using the latest released version of the tooling.
[Github] Hash pin ci-format container (#218816)
This follows our own CI best practices and ensures zizmor/CodeQL will
not complain about this when people inevitably touch it in the future.
[RISCV][Verifier] Check operands and result type of RISC-V vsetvli/vsetvlimax (#218594)
The result of `llvm.riscv.vsetvli/vsetvlimax` models VLMAX (or a VL bounded
by it) and is only defined for XLen, so the result type must be i32 or i64.
Narrower types cannot represent the architectural VLMAX range of [1, 65536]
that value analyses rely on.
Also check that the VSEW and VLMUL immediate operands encode a valid
SEW/LMUL pair (VSEW <= 3, VLMUL != reserved), so that consumers can
assume a well-formed vtype.
Assisted-by: TRAE CLI (Opus 4.8)
[C++][Modules] Don't insert `#include` before GMF when `-include` used (#212533)
Clang currently emits command-line implicit inputs such as `-imacros`,
`-include-pch`/`-include-pth`, and `-include` as part of the predefines
buffer. This causes them to be processed before the main source file.
For a C++20 module unit with a global module fragment:
```cpp
module;
export module M;
```
a force-included header containing declarations was effectively
processed as:
```cpp
#include "Header.h"
module;
[23 lines not shown]
[X86] Limit the result of XOR8rr_NOREX unused (#218640)
In case it may be zero/sign-extended into an REX/REX2 register.
Fixes: #218583
Assisted-by: Claude Opus 4.8
[MCParser,test] Improve macro argument charset test (#218828)
'@', '#', and '?' are assembly identifier characters, but they terminate
a macro argument name.
[AMDGPU] Correct DS FIFO buffer size semantics
There was some ambiguity in how buffersize 0 and 1 are handled. The
correct semantics are:
- `BufferSize == 0`: unlimited, no FIFO stall
- `BufferSize == 1`: unbuffered, only one instruction in flight
- `BufferSize > 1`: buffered FIFO
Handle DS FIFO accounting edge cases
Saturate hardware-unit pressure decrements and treat buffer sizes zero
and one as disabling buffering to avoid underflow and inconsistent stall
costs.
[AMDGPU] Use DS latency for FIFO scheduling
Use instruction latency for DS hardware-unit cycle accounting so the FIFO
model can identify a full buffer. Add focused MIR coverage for the resulting
stall cost and scheduling decision, and regenerate the integration checks.
Change-Id: I2f4df2e97d145af4935872dbd43108e1b55077ab
[SSAF][SourceTransform] Add '--ssaf-link-unit-id=' for specifying link unit identifiers
The source-transformation pass takes WPA results as input, where
entities are named under link-unit and compilation-unit namespaces.
To associate ASTNodes with entities, the source-transformation pass
needs to know both link-unit and compilation-unit IDs. Such information
is provided by the caller.
rdar://185818153
[RISCV][GlobalISel] Legalize and select G_PREFETCH (#215466)
GlobalISel aborted on `llvm.prefetch` ("unable to legalize
`G_PREFETCH`") while SDAG lowers it to `prefetch.r/w/i`. Add a legalizer
rule marking `G_PREFETCH` legal for p0 addresses, and a custom selector
since the SDAG patterns use the `AddrRegImmLsb00000` complex pattern
that the GISel pattern importer does not auto-translate. The selector
picks `prefetch.r/w/i` from the rw/cache-type immediates and folds a
`simm12_lsb00000` offset when present, matching SDAG.
[RISCV][GlobalISel] Legalize readcyclecounter/readsteadycounter (#217535)
Add a legalizer rule for G_READCYCLECOUNTER/G_READSTEADYCOUNTER. On RV64
they are legal and select via the existing tablegen Pats
(rdcycle/rdtime). On RV32 lower them to the ReadCounterWide target
pseudo, which FinalizeISel expands into the re-read-the-high-half loop
(emitReadCounterWidePseudo) — the same expansion SelectionDAG uses.
[alpha.webkit.UncheckedLambdaCapturesChecker] Allow protectedThis of RefPtr (#218723)
Fix a bug that lambda capture checkers were checking for the exact match
for "protectedThis" as opposed to any protective smart pointer.
[TableGen] Simplify PtrAddrSpace handling in TypeSetByHwMode. NFC (#218564)
The PtrAddrSpace field was previously unused and I think it always has
been. The AddrSpace field used to be vector, but was made a single value
in 83507644ed1c59d76ca0b1ffc3e837fcb3677e41.
Replace AddrSpace with PtrAddrSpace for clarity.
Remove unnecessary conversions to ValueTypeByHwMode to get the pointer
address space. The conversion copies the PtrAddrSpace directly from the
TypeSetByHwMode without modification.
[TableGen] Fix non-deterministic output from emitGetRegClassFromMatchKindFunc. (#218560)
We were iterating a std::map that uses a pointer for the key which isn't
deterministic.
To fix, dereference the pointer and use operator< from the class.
[BPF] Record an argument's first DBG_VALUE as its entry location (#217991)
Accurate BTF types for DW_CC_nocall functions were added in [1] and work
at -O2. At -O1 the entry block keeps debug locations that -O2 optimizes
away, and two of those patterns defeat the argument-register scan.
Accurate signatures are worth having at -O1 too: transformations move
between optimization levels over time, and some users build at -O1.
collectNocallEntryArgRegs() scans the entry block for DBG_VALUEs to find
which physical register each source argument arrived in. An argument may
have several DBG_VALUEs there, and the map was last-write-wins, so a
later location silently replaced the entry one. The registers then no
longer match the optimized IR signature,
canUseNocallOptimizedSignature() bails, and BTFDebug emits the
unfiltered source prototype -- a FUNC_PROTO that does not describe the
real ABI.
The first pattern is a spilled argument. From
progs/test_l4lb_noinline_dynptr.c in the kernel BPF selftests, with the
[45 lines not shown]