[llvm-readobj][ELF] Print Names for call graph relocations
In a relocatable object file, an entry identified by a relocation had no
Names. Compute the address that the relocation resolves to with
RelocationResolver, look up the functions at that address in the section
of the relocation's symbol, and print them as Names before the
Relocation object.
As with Names for an Address, the names follow --demangle. Nothing is
printed for an undefined symbol, or when no function is at the address.
A relocation type that RelocationResolver doesn't support, or a symbol
whose section can't be found, gets a warning.
Assisted-by: Gemini
[llvm-readobj][ELF] Fall back to Address when no single relocation applies
In a relocatable object file, --call-graph-info identifies a function by
the relocation that applies to its address field. If a field had no
relocation, nothing in the output identified the function. If the
relocation section had an invalid sh_link, the dump stopped. If a field
had more than one relocation, the first one was used silently.
In all of these cases, print the value stored in the field as Address,
as for linked files. Warn once if a call graph section has no relocation
section, and warn about each field with no relocation or more than one.
If the relocations can't be read, only that is reported.
Assisted-by: Gemini
[llvm-readobj][ELF] Print implicit addends of call graph relocations
A SHT_REL relocation, or a SHT_CREL relocation without explicit addends,
keeps its addend in the field that it applies to. Print the
sign-extended field value as the Addend of such a relocation instead of
dropping it. The ARM test now uses SHT_REL and covers the same cases as
the SHT_RELA tests: named symbols, a negative addend, and a section
symbol with an addend.
Assisted-by: Gemini
[llvm-readobj][NFC] Move the 1-byte call graph info fields last
Group FormatVersionNumber and IsIndirectTarget at the end of
FunctionCallGraphInfo, after the 8-byte-aligned members.
Assisted-by: Gemini
[llvm-readobj][NFC] Match call graph relocations to address fields in one pass
Read the relocations for a call graph section once, sort them by offset,
and attach each one to the address field it applies to while walking the
fields in order. Each field now stores the existing `Relocation<ELFT>`,
so the printing code no longer searches the relocation list for every
field. The call graph structs become templates so that they can hold it.
Assisted-by: Gemini
[llvm-readobj][ELF] Print a Relocation object instead of Name in --call-graph-info
In a relocatable file, the address fields of a call graph section hold
placeholders, and the relocation that applies to each field identifies
the function. Name showed only the relocation's symbol name, made up
from the section name for an unnamed section symbol, and dropped the
addend. So entries that refer to a function through a section symbol
couldn't be told apart.
Print a Relocation object instead, with the symbol index, the symbol
name exactly as recorded in st_name, and the addend if it is non-zero.
With --demangle, the demangled symbol name is printed as DemangledName.
If the symbol can't be read, the existing warning is reported and only
the symbol index is printed.
Assisted-by: Gemini
[llvm-readobj] Test call graph callees below and above four
Add a function with fewer callees, as the old SmallSet already kept
section order for up to four, and say why main has five distinct
callees. Move main's repeated callee to the end, so that a repeat is
also skipped after the set of seen callees outgrows its inline size.
Assisted-by: Gemini
[llvm-readobj][ELF] Print call graph callees in section order
Keep both the offset and the value of each address field in the call
graph section, and let the printing code pick the one it needs. Later
patches use the offset to look up relocations.
Callees were stored in a SmallSet, which sorts its elements once it
holds more than four, so the output order depended on the number of
callees. They are now kept in section order, and repeated addresses in
linked files are skipped when printing.
Assisted-by: Gemini
[llvm-readobj][ELF] Don't clear bit 0 of call graph field offsets on ARM
In a relocatable object file, --call-graph-info finds the relocation for
an address field by the field's offset. On ARM, the Thumb bit was
cleared from that offset as if it were an address, so a field at an odd
offset, such as a direct callee, was reported as having no relocation.
Only clear the Thumb bit from addresses.
Assisted-by: Gemini
[llvm-readobj][ELF] Drop redundant counts from --call-graph-info output (#230647)
NumDirectCallees and NumIndirectTargetTypeIDs only repeat the lengths of
the DirectCallees and IndirectTypeIDs lists that follow them.
Assisted-by: Gemini
py-zensical: update to 0.0.70nb1.
In addition to the changes from below, this includes a post-release
bugfix, which is why it jumps to nb1 immediately.
0.0.70:
Zensical now supports the exclude_docs, draft_docs, and not_in_nav
settings from mkdocs.yml for excluding files, previewing drafts,
and keeping pages out of automatic navigation.
Additionally, the user interface is updated to v0.0.37, improving
search accessibility and reliability, adding draft markers and
discovery links for llms.txt and Markdown, and introducing 17 new
icons, including :simple-zensical:.
[ProfCheck] Add option to inject profcheck into pipelines
This allows setting an option in clang and verifying that all profile
information is preserved. This allows for more thorough testing of
profile preservation on real code rather than just in the LLVM tests.
Reviewers: aeubanks, mtrofin
Pull Request: https://github.com/llvm/llvm-project/pull/232052
[Passes] Add helpers for start/end passes
This refactors out instructionCounters into more generic start/end pass
blocks. This refactoring makes it easier to add ProfCheck passes at
these points without needing to manually add them at all the relevant
points in the various pipelines.
Reviewers: aeubanks, mtrofin
Pull Request: https://github.com/llvm/llvm-project/pull/232032
[libc][regex] Switch ExprPool to 32-bit ExprId and 16B Expr (#230687)
Refactored the regex AST and ExprPool in libc/src/__support/regex/ to
reduce per-pool memory overhead:
* Replaced pointer-based AST references with 1-based 32-bit ExprId
indices (with singleton IDs EMPTY_SET_ID = 1 and EMPTY_STR_ID = 2).
* Compacted Expr to 16 bytes with a cached 32-bit hash and precomputed
nullability flag.
* Replaced the fixed 16,384-slot hash table and 256-node linked blocks
with a growable hash table starting at 64 slots (256 bytes) and 32-node
blocks (512 bytes), allocated lazily on first intern so a
default-constructed pool uses 0 heap bytes and initial allocation is 832
bytes.
* Migrated block and hash-table storage to cpp::array and cpp::span with
a BucketProber iterator range and centralized slot_at indexing.
Assisted-by: Automated tooling, human reviewed.
[asan] Mark nothrow operator new and delete noexcept (NFC) (#231994)
Add `NOEXCEPT` to nothrow forms of `operator new` and `operator delete`
definitions to make them standards compliant and compatible with
declarations provided by the, soon to be included in this context,
`<new>` header.
[AMDGPU][SIMemoryLegalizer] Lower single-wave workgroup scope to wavefront in absence of LDSDMA (#224065)
This patch lowers workgroup-scoped instructions to wavefront if the
kernel's maximum workgroup size is at most one wavefront, so long as the
kernel does not contain any LDS DMA operations, as these operations are
performed asynchronously relative to other LDS instructions. This is
just a partial reland of #187673 (which was originally reverted due to
this issue; see #207473) with an additional check for LDS DMA
instructions.
[AMDGPU][Attributor] Add attribute to track for LDSDMA invocations (#229133)
This patch adds the `amdgpu-no-lds-dma` attribute, which indicates that
the decorated function does not execute any LDSDMA operations.
This attribute is used in #224065 to enable demoting suitable workgroup
sync scopes to wavefront only when there are no LDSDMA operations
present.