[clang] Diagnose VLA types from an enclosing function in local classes and blocks (#229697)
A variably modified type whose array bound is evaluated in an enclosing
function cannot be used in a member function of a local class or in a
block: the size is only computed in the enclosing function, so CodeGen
crashed when emitting such a declaration.
Record the context in which each VLA bound is evaluated, and diagnose
uses of such a type (variable, parameter and typedef declarations,
casts, sizeof) across a local class or block boundary:
```
error: variably modified type 'X' (aka 'int[foo()]') cannot be used in a local class because its size is evaluated in an enclosing function
note: size expression is evaluated here
```
Such a declaration is now rejected even in a member function that is
never used, the same way a reference to a local variable of the
enclosing function already is.
[12 lines not shown]
[flang][OpenACC] Map OPTIONAL operands through their descriptor (#243141)
OPTIONAL data operands used to be mapped through their raw address,
which dropped the descriptor. Keep the descriptor unless the base is
neither an acc PointerLikeType nor a MappableType (e.g. a `fir.boxchar`
for `CHARACTER(*)`).
When remapping an OPTIONAL symbol in a compute region, replace the TODO
with a fir.box_addr guarded by `fir.is_present`, so an absent argument's
null descriptor is never read.
[Clang][Parse] Do not treat '::' as a decl-specifier outside C++
isCXXDeclarationSpecifier's '::' case annotates the token and then recurses to
handle whatever it got, which only makes progress when the token can actually be
annotated as a scope specifier. Outside C++ it cannot be, so in C the recursion
never advanced and the stack overflowed:
void f() { if (::0); }
Since 226b0b59bfca ([Clang][C2y] Add support for if declarations (N3356
paper)) C parses conditions through ParseCondition, so C conditions now reach
this code. Parser::isDeclarationSpecifier already guards the same case; this
adds the matching guard to its C++ twin. Objective-C is unaffected: it keeps
diagnosing '::' through TryAnnotateTypeOrScopeToken.
Fixes #243727.
[Attributor] Preserve debug locations when replacing indirect calls (#244004)
When an indirect call and its known callee have incompatible return
types, Attributor creates a replacement call without copying the
original debug location.
Copy the debug location in both the single-callee and multiple-callee
paths.
Assisted by gpt-6.1.
Only accept a report file name in audit.download_report
audit.export creates each report directly in the user's report
directory, so report_name must be a single file name.
[libc] Fix fileno() to return EBADF for non-Linux File streams (#227760)
## Summary
`fileno()` currently assumes every `FILE*` is backed by a `LinuxFile`
and unconditionally casts to read its file descriptor. For streams
created by `fopencookie()` or `fmemopen()` (backed by
`CookieFile`/`MemoryFile`, neither of which has a file descriptor
member), this reads unrelated memory and returns a bogus "descriptor"
instead of following POSIX, which requires `fileno()` to fail with
`EBADF` when "the stream is not associated with a file."
## Fix
`File` has no RTTI/type tag by design (some `LinuxFile` instances, e.g.
`stdin`/`stdout`/`stderr`, are `constexpr` globals). Instead of adding
one, this adds `is_linux_file()`, which positively identifies a
`LinuxFile` by checking that all four of its registered I/O callbacks
(`read`/`write`/`seek`/`close`) are the known `linux_file_*` functions —
every `LinuxFile` always registers exactly these, and no other `File`
subclass does. `get_fileno()` now checks this first and returns `-1`
[17 lines not shown]
Refuse every ZFS attribute change on S3 bucket datasets
filesystem.set_zfs_attributes refused only a change of immutable on
the dataset of an S3 bucket. It now refuses the path whatever
attributes the request names, through the write guard
filesystem.mkdir and filesystem.put already use, and the
immutable-only check is removed.
nounlink and appendonly refuse the S3 service's deletes and renames,
root included, and appendonly its xattr writes too. The DOS
attributes refuse none of its steps, but the setter writes the whole
flag mask back, so a change of one of them rewrites immutable as it
was read.
The refusal now names the path instead of the attribute. The test
case adds nounlink, appendonly and hidden to immutable.
[DAGISel] Add OPC_SwitchChildInteger to dispatch on an integer child (#237647)
When every option of a Scope starts with a CheckChildInteger of the same
child, convert it to a switch like SwitchOpcode/SwitchType. This is
common for INTRINSIC_WO_CHAIN, where each pattern starts by checking the
intrinsic ID in child 0.
This still requires a linear scan to find the matching intrinsic ID, but
may reduce some repeated overhead.
Assisted-by: Claude
Co-authored-by: Matt Arsenault <arsenm2 at gmail.com>
TableGen: Compute DAGISel pattern sort keys before sorting (#244009)
The pattern sort recomputed each pattern's complexity, cost and size on
every comparison. Compute them once per pattern instead.
RISCVGenDAGISel.inc tablegen run:
Gigainstructions Gigacycles CPU seconds
Before 61.5 31.4 9.8
After 57.1 (-7.1%) 27.8 (-11.4%) 8.7 (-10.9%)
AMDGPUGenDAGISel.inc tablegen run:
Gigainstructions Gigacycles CPU seconds
Before 94.6 46.1 14.3
After 91.4 (-3.4%) 44.6 (-3.3%) 13.9 (-3.1%)
All 376 tablegen runs in an LLVM build with all targets:
[4 lines not shown]
[DebugInfo][AT] Retire dead LiveIn/LiveOut state and avoid redundant RPO queuing (#234310)
AssignmentTrackingLowering and MemLocFragmentFill previously
pre-reserved and retained LiveIn/LiveOut maps for every block across the
entire pass, and re-queued forward RPO successors onto Pending even when
already scheduled on Worklist, scaling as O(Blocks * Vars).
Add BlockLivenessTracker and worklist helpers to:
- Skip storing LiveIn for acyclic blocks (unreachable from backedges),
moving a single predecessor's LiveOut when it has no other readers.
- Track remaining successor reads to erase dead predecessor LiveOut
entries eagerly, and clear LiveIn/LiveOut after traversal.
- Avoid queuing forward RPO successors (SuccRPO > RPO) already scheduled
on Worklist.
On a pathological case from glslang/SPIRV (9,049 blocks, 7,540
variables, 0 backedges; `llc -O2`):
- Peak RSS: 17.37 GB -> 354.5 MB (~49x reduction)
- Total `llc` wall time: 15.84s -> 4.97s (-68.6%)
[3 lines not shown]
[libc] Fix syscall under ASAN (#244038)
Followup to #243647 which broke the ASAN bot. Just mark the va_args
reads as ignored by the sanitizer.
Assisted-by: Automated tooling, human reviewed.
[clang] Shrink inline capacities of `Module` unresolved directives (#243156)
`Module` stores the module map directives that haven't been resolved yet
(`UnresolvedHeaders`, `UnresolvedExports`, `UnresolvedDirectUses`,
`UnresolvedConflicts`) and the headers that couldn't be found
(`MissingHeaders`) inline, with room for one or two elements each. These
lists are empty in modules deserialized from PCMs, and in modules parsed
from a module map usually only the unresolved exports (typically a
single `export *`) are non-empty. The dependency scanner creates a lot
of modules, so the inline storage adds up.
This patch drops the inline capacity of these lists:
- `UnresolvedHeaders`, `MissingHeaders`, `UnresolvedDirectUses`:
`SmallVector<T, 1/2>` -> `SmallVector<T, 0>`
- `UnresolvedExports`: `SmallVector<T, 2>` -> `SmallVector<T, 1>`, so
the common single `export *` still doesn't allocate
- `UnresolvedConflicts`: `std::vector<T>` (24 bytes) -> `SmallVector<T,
0>` (16 bytes)
[30 lines not shown]
CodeGen: Document best practices on target hooks (#243984)
Document that this is not a place to put controls for specific
transformations. This is a plea to agents to stop producing
fix-this-one-case or target virtual methods.
Update RPKI Trust Anchor Tiebreaker reference
As luck would have it, on the very day this spec got published as RFC,
one of the RIRs helped demonstrate the usefulness of the concept in the
production environment.
https://www.rfc-editor.org/rfc/rfc10097.html with Theo Buehler & Ties de Kock
Rpki-client instances globally did not suffer from the below RPKI
certification service outage.
"""
RPKI repositories unavailable - Incident Report for RIPE NCC
Future Dated Trust Anchor Certificate temporarily in the RPKI Repository
The RPKI Trust Anchor (TA) Certificate is signed using an offline
machine that's disconnected from the Internet. As the clock may drift
on this machine while it's turned off, the normal procedure is to
[15 lines not shown]
[Offload][NFC] Move plugin namespaces to llvm::offload and update include guards
Replace libomptarget namespaces and header guards with liboffload equivalents.
Mostly mechanical work by Claude.
Revert "[CodeGen][NFC] Factor MachineBlockPlacement::alignBlocks into reusable helper (#241995)" (#243994)
This reverts commit 6447d4dda5706f5d7946f86c1225fd964abfb39e (#241995)
at a reviewer's request while concerns about the change are addressed.
Update RPKI Trust Anchor Tiebreaker reference
As luck would have it, on the very day this spec got published as RFC,
one of the RIRs helped demonstrate the usefulness of the concept in the
production environment. Rpki-client instances did not suffer from the
below certification service outage.
with tb@
"""
RPKI repositories unavailable - Incident Report for RIPE NCC
Future Dated Trust Anchor Certificate temporarily in the RPKI Repository
The RPKI Trust Anchor (TA) Certificate is signed using an offline
machine that's disconnected from the Internet. As the clock may drift
on this machine while it's turned off, the normal procedure is to
recalibrate it manually before signing a new certificate. During the
re-signing on 18 November 2026, the clock on the TA machine was set
[13 lines not shown]