[clang] Speed up diagnostic state file lookup
Store File records behind stable pointers in a DenseMap instead of a
std::map. Keep dumps and serialized mappings ordered by FileID,
and create deserialized entries lazily.
CTMark (-march=rva23u64 -O3), three interleaved pairs: 0.361% lower
median total compile time and 0.467% lower workload geomean.
Assisted-by: TRAE CLI (GPT-6)
Reviewers: zmodem, Sirraide, vgvassilev, tbaederr, kazutakahirata
Reviewed By: zmodem
Pull Request: https://github.com/llvm/llvm-project/pull/241234
[Attributor] Don't derive interface attributes from non-exact definitions (#243310)
The arguments and the return value of a function that might be replaced
by another definition, e.g. a `linkonce_odr` function, are never
updated. But some AAs still took known information from its body in
`initialize`, which was kept and propagated to the callers: the uses of
the arguments (`followUsesInMBEC`), assumptions (`getAttrsFromAssumes`),
and the returned values (`AANonNull::isImpliedByIR`). Add
`Attributor::canUseBodyFor` and skip the body for the interface of such
functions, as FunctionAttrs does.
Depends on #243247.
Assisted-by: Claude Opus 5.5
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[Attributor][NFC] Precommit tests for attributes derived from non-exact definitions (#243247)
Adding tests showing that the Attributor derives `align` for the
arguments and `nonnull` for the return value of `linkonce_odr` functions
from their bodies (uses and assumptions), and propagates them to the
callers, although another definition might be used instead.
This came up in the review of #241934.
Assisted-by: Claude Opus 5.5
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[CodeGen] Declare command line options of the machine scheduler in TableGen (#244327)
Renames, with the old spellings kept as aliases:
```
-enable-aa-sched-mi -> -sched-mi-aa
-enable-store-sequencing -> -store-sequencing
-use-tbaa-in-sched-mi -> -sched-mi-tbaa
```
Renames without an alias, as the old spellings are generic or unused:
```
-check-early-avail -> -vliw-misched-check-early-avail
-fast-cluster-threshold -> -misched-fast-cluster-threshold
-force-fast-cluster -> -misched-force-fast-cluster
-ignore-bb-reg-pressure -> -vliw-misched-ignore-bb-reg-pressure
-misched-verbose-level -> -vliw-misched-verbose-level
-use-newer-candidate -> -vliw-misched-use-newer-candidate
[19 lines not shown]
[Attributor] Clean up the shared reachability walks
Without AAIsDead, the walks used liveness version 0, which is also the
version of a valid AAIsDead without assumed live edges, under which all
edges are dead. Use the version of an invalid AAIsDead instead, under
which all edges are live as well.
Also add each explored block with a live successor once instead of once
per live edge, use contains() for the exclusion blocks, and update the
comments that still described the walk that stopped at the target.
Co-Authored-By: Claude Opus 5.5 <noreply at anthropic.com>
Fix buffer overflow in printf %s and %c formats for UTF-8 chars.
Awk allocates its buffer based on the length in characters instead
of bytes, which can lead to a buffer overflow when formatting UTF-8
characters in a UTF-8 locale.
From Martin Chang
Fix buffer overflow in string() when storing escaped unicode.
Only two bytes were allocated but escaped unicode can require up to 5
(four plus a NUL).
From Martin Chang
NAS-145317 / 27.1.0 / Refuse immutable flag changes on S3 bucket datasets (by anodos325) (#20270)
filesystem.set_zfs_attributes now refuses a request that sets or clears
immutable on the dataset of an S3 bucket, on one path or recursively.
The S3 service sets and clears that flag on the object versions it
retains. Other attributes can still be changed there.
A path above a bucket is not refused. Recursion stops at dataset
boundaries, so a change there never reaches the bucket.
The check covers every BUCKET layout bucket, as the write guards do.
Middleware's own flag changes on pool and encrypted dataset mount points
call the attrs utility directly and are not affected.
The new case in test_s3_bucket.py covers a set and a recursive clear on
the bucket, a change of another attribute, and a recursive change from
the parent dataset.
Original PR: https://github.com/truenas/middleware/pull/20257
Co-authored-by: Andrew Walker <andrew.walker at truenas.com>
NAS-145321 / 27.1.0 / Resolve container etc paths within the rootfs when setting the hostname
Read an existing etc/hosts relative to the container's rootfs, resolving
symlinks as the container itself would, and only if it is a regular file
of a reasonable size. atomic_write already refuses a symlink in the path
of the files it writes.
(cherry picked from commit f5093d9b4c8fe94c5bb88cfe40bc4f7747eaa685)
[Support] Fix SpecialCaseListTest.DotSlashWarning in a terminal (#244459)
raw_fd_ostream caches has_colors() on first use. When the suite runs
with stderr on a terminal, DotSlash emits the deprecation warning
uncaptured, so errs() caches colors as enabled. DotSlashWarning then
captures stderr but still gets escape codes between "warning: " and
the message, and its HasSubstr check fails. The test passes when run
alone because the first check happens while stderr is captured.
Disable WithColor's color auto-detection for the duration of the test.
NAS-145321 / 28.0.0-BETA.1 / Resolve container etc paths within the rootfs when setting the hostname (#20264)
Read an existing etc/hosts relative to the container's rootfs, resolving
symlinks as the container itself would, and only if it is a regular file
of a reasonable size. atomic_write already refuses a symlink in the path
of the files it writes.
RuntimeLibcalls: Add attributes to __clear_cache and __riscv_flush_icache
Neither unwinds or captures its arguments. Leave the memory effects
unknown so calls aren't removed or reordered with the stores to the
flushed range.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[SelectionDAG] Remove ADDE from isCommutativeBinOp (#244399)
ADDE takes a third carry operand, so it is not a binop. Having it in
isCommutativeBinOp() made isBinOp() return true for it, which let
foldSelectOfBinops() rebuild it from two operands and drop the carry.
UADDO_CARRY is not in the list either, and visitADDE() already
canonicalizes constants to the RHS on its own.
Remove ADDE from the list and drop the operand count check that was
added to foldSelectOfBinops() to work around this.
Follow-up to https://github.com/llvm/llvm-project/pull/235585 after
review feedback.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes to libc libcalls
Annotate C library functions with the attributes InferFunctionAttrs
gives. This isn't fully captured in the DeclareRuntimeLibcalls testing
because not all of these functions are yet associated with a library.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add attributes to target memory helper libcalls
Annotate the various target specific memcpy-like functions with known
alignments.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
Fix codegen-opt-flags.ll AEABI mem checks
The AEABI memcpy, memmove and memset helpers no longer get
captures(none), so drop it from the checks.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply at anthropic.com>
powerpc: Split CPU flags into separate file and include in ELF header
This change fixes Bug 239621, where FreeBSD on powerpc deviates from
userspace expectations on other architectures (arm) and operating
systems (Linux)
Approved by: jhibbits (mentor)
MFC after: 1 week
NAS-145317 / 28.0.0-BETA.1 / Refuse immutable flag changes on S3 bucket datasets (#20257)
filesystem.set_zfs_attributes now refuses a request that sets or clears
immutable on the dataset of an S3 bucket, on one path or recursively.
The S3 service sets and clears that flag on the object versions it
retains. Other attributes can still be changed there.
A path above a bucket is not refused. Recursion stops at dataset
boundaries, so a change there never reaches the bucket.
The check covers every BUCKET layout bucket, as the write guards do.
Middleware's own flag changes on pool and encrypted dataset mount points
call the attrs utility directly and are not affected.
The new case in test_s3_bucket.py covers a set and a recursive clear on
the bucket, a change of another attribute, and a recursive change from
the parent dataset.
(cherry picked from commit f1749c05934d55b5cc06d8d0b33ea6280189418a)
docs: Add some best practices documentation for codegen tests
Document common review feedback.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[libc] Make find_first_character_impl return const void*
This means we only have to const_cast in one place instead of in all the
implementations and I find const_cast annoying.
Assisted-By: LLM
Reviewers: jhuber6, michaelrj-google
Pull Request: https://github.com/llvm/llvm-project/pull/244468
[libc] Add simd_bitmask type
Just a thin wrapper around internal::get_as_integer_type. This is nicer
than using an internal type outside of the library implementation in
inline_strlen.h. Putting this up given I plan on using it more for an
optimized memchr implementation.
Assisted-By: LLM
Reviewers: jhuber6, michaelrj-google
Pull Request: https://github.com/llvm/llvm-project/pull/244467