[TableGen] Use StringTable for searchable tables (#206252)
LLVM has some large searchable tables containing string pointers. This
patch changes two things:
- String references in searchable tables are now always StringTable
offsets; and all code referencing these is updated accordingly. This
often avoids relocations in the data structures, permitting their
placement in .rodata instead of .data.rel.ro and avoids dynamic
relocations.
- The lookup indicies now reference the same string table instead of
storing string pointers, permitting deduplication and also avoids
dynamic relocations.
In an all-target assert build, this changes section sizes as follows:
- .data.rel.ro: -311920
- .rodata: +227712
[6 lines not shown]
AMDGPU: Replace tgsplit subtarget feature with attribute
This is a per-entrypoint property and has a corresponding
assembler directive, so it should not be baked into the
subtarget. I couldn't find much documentation on what this
actually does, so the description isn't great.
Fixes #204149
Co-authored-by: Claude Opus 4.6 <noreply at anthropic.com>
[AArch64][NFC] Use compact enum table for feature strings (#206084)
Although this is not exactly an enum, the same data structure can be
used to compactly store the feature strings without dynamic relactions.
As a side effect, this also slightly reduces the size of the table.
[llvm-readobj][NFC] Use compact enums (except for ELF) (#206075)
In principle straight-forward replacement, but clang-format is
deliberately non-helpful here..
ELFDumper is a separate patch due to the size of the changes.
[X86][NFC] Use compact enum to store ternlog comments (#206089)
Instead of storing a StringRef (StringLiteral is essentially a
StringRef) with 16 bytes and one dynamic relocation for each of the 256
entries (4kiB total) and, use the new compact enum tables to store each
entry with 4 bytes and without relocations.
[clang-tidy] Fix invalid avoid-c-style-cast fix-it after keywords (#206239)
When a C-style cast immediately follows an identifier-like token, the
replacement could merge with the previous token, e.g. turning
`return(int)d` into `returnstatic_cast<int>(d)`. This patch fixes the
problem by adding a leading space to the replacement when needed.
Closes https://github.com/llvm/llvm-project/issues/97012
[FileCheck] Call out var captures on unmatched patterns
This patch is motivated by an #llvm IRC chat in 2019 with Aaron
Ballman, where he pointed out an example similar to following:
```
$ cat input
[[clang::optnone]] void foo() {
$ cat check
CHECK: [[clang::optnone]] void foo() {
$ FileCheck check < input |& tail -7
Input was:
<<<<<<
1: [[clang::optnone]] void foo() {
check:1'0 { } search range (exclusive bounds)
check:1'1 error: no match found
check:1'2 ? possible intended match
[21 lines not shown]
[Allocator] Drop RedZoneSize (non-sanitizer) and BytesAllocated members (#205711)
`RedZoneSize` is only read inside `#if LLVM_ADDRESS_SANITIZER_BUILD`.
Additionally gate it under `LLVM_ENABLE_ABI_BREAKING_CHECKS` so that
release-non-assertions builds don't incur the overhead. To support
non-asan build with asan library users, the variable is only omitted in
`!LLVM_ENABLE_ABI_BREAKING_CHECKS` builds.
`BytesAllocated` is incremented on every Allocate (a hot-path memory
read-modify-write) only to back `getBytesAllocated()`. Drop the member.
There is a measurable stage2 instruction-count reduction.
https://llvm-compile-time-tracker.com/compare.php?from=25a6b5be6853b2c493ef392d41e43dd35ad4839a&to=8ebc975635ad717deb392d20b50f1a1f6bb16054&stat=instructions:u
Migrate the in-tree consumers:
- TableGen dumpAllocationStats drops the line; the clangd debug log
reports
getTotalMemory().
[8 lines not shown]
[mlir-c] Add IRMapping C API bindings (#206146)
Expose IRMapping through the MLIR C API with full create/destroy/map, lookup, contains/erase, and clone-with-mapping functionality.
Assisted by: Claude
[FileCheck] Improve colors in input dumps (#204936)
This patch makes two improvements to colors used in FileCheck input
dumps:
1. Without this patch, input line numbers and ellipses have a foreground
color of black, which is hard to see in a terminal with a dark color
theme. This patch changes that to bright black (a grayish color), which
looks good to me for all terminal themes I have tried while remaining
distinct from the input text.
2. Without this patch, the input text is accidentally set to bold when
neither `-v` or `-vv` is specified. Perhaps I never noticed because I
tend to always use `-vv`. This patch changes that to use the terminal's
default color.
Case 2 exposes a problem with LLVM's color implementation. Without this
patch, the call to `WithColor`'s constructor actually specifies bold as
`false`, but `WithColor` ignores that when the color is `SAVEDCOLOR`.
While it seems like that should be fixed, I am concerned about the
[6 lines not shown]
[mlir-c] Add IRMapping C API bindings
Expose IRMapping through the MLIR C API with full create/destroy/map,
lookup, contains/erase, and clone-with-mapping functionality.
[DirectX][ObjectYAML] Attempt to fix flaky PRIVPart.yaml (#206278)
This test was meant to round-trip YAML twice, to ensure correct
processing of non-4-byte-padded PRIV section.
However, second invocation of yaml2obj had wrong arguments (it was
reading from test file instead of stdin). Fix that.
Also, round-trips were split into several RUN lines, to make it clear on
which line an error occurs if the test is still flaky.
Reland "Make sanitizer special case list slash-agnostic" (#206250)
This changes the glob matcher for the sanitizer special case format so
that it treats `/` as matching both forward and back slashes.
When dealing with cross-compiles or build systems that don't normalize
slashes, it's possible to run into file paths with inconsistent
slashiness, e.g. `../..\v8/include\v8-internal.h` when [building
chromium](https://g-issues.chromium.org/issues/425364464).
We can match this using the current syntax using this ugly kludge:
`src:*{/,\\}v8{/,\\}*`. However, since the format is explicitly for
listing file paths, it makes sense to treat `/` as denoting a path
separator rather than a literal forward slash. This allows us to write
the much more natural form `src:*/v8/*` and have it work on any
platform.
This is technically a behavior change, but it seems very unlikely to
come up in practice. It will only make a difference if a user has a
[16 lines not shown]
[HashRecognize] Rename ByteOrderSwapped to IsBigEndian (NFC) (#206243)
In order to avoid talking about bit-endianness versus byte-endianness,
rename ByteOrderSwapped to IsBigEndian, which is algorithm-agnostic. In
fact, CRC is a bitwise-algorithm, and hence the bit order is reversed.
[VPlan] Skip VPInst where mask is only operand in chain in isUsed (NFC) (#206286)
Update isUsedByLoadStoreAddress o skip VPInstruction where the operand
in the use chain is only used as mask. Those do not contribute to the
load address, so should not force scalarization.
Fixes a regression with f2459f9e
(https://github.com/llvm/llvm-project/pull/196842).
[X86] Add target verifier
Add an X86 TargetVerify and register it by triple so the
TargetVerifierPass dispatches to it for X86 modules. It performs no
checks yet; the subtarget-dependent checks are added in a follow-up.
[Target] Add target-independent TargetVerifier dispatcher
Introduce a target-dependent IR verification framework that can be run
from target-independent locations.
TargetVerify is a base class each backend subclasses to check a function
for constructs that are invalid for a particular target. Backends
register a factory keyed by Triple::ArchType via registerTargetVerify(),
typically from their LLVMInitialize<Target>Target().
TargetVerifierPass (registered as "target-verifier") is the dispatcher:
it reads the module triple and, if a verifier is registered for that
architecture, runs the generic IR verifier followed by the target's
TargetVerify. It is a no-op for targets that have not registered a
verifier, so it is safe to schedule from generic, target-independent
pipelines (e.g. `opt -passes=target-verifier`).
[VPlan] Drop dead CostCtx/Range arg sfrom getScaledReductions (NFC) (#206285)
Neither parameter is referenced; the cost-checking they described moved
to createPartialReductions. Also remove the stale comment.