[LTO][CodeMetrics] Count indirect calls as inline candidates when `PrepareForLTO` is set (#192154)
Indirect calls may be resolved during the post-link LLVM pipeline. Thus, count them as potential inline candidates during the pre-link LTO phase.
[lldb][bytecode] Improve testing of bytecode section loading (#212568)
Add tests for loading embedded bytecode formatters from binaries.
Assisted-by: claude
[AMDGPU] Support partial and empty WWM pools for SGPR spills
SGPR lane spilling currently treats the WWM VGPR pool as all-or-nothing. This
can fail compilation when the requested pool cannot be formed, even though
scratch spilling or a smaller spillable pool could make progress.
This PR lets ordinary SGPR spills fall back to scratch when the pool is empty
and lets WWM register allocation use a nonempty partial pool. It keeps the
full-pool requirement for strict WWM/WQM and explicit spill-carrier
preallocation.
The no-pool fallback is recorded in SIMachineFunctionInfo so frame lowering can
provide enough emergency scavenging slots. The state is also serialized to
preserve the behavior across MIR round trips.
[mlir] Add missing materialization function diag for dialect convertion (#207689)
This Patch adds more precise diagnostics for when a pass is missing a
target/source materialization function, making it easier to locate the
issue in the pass.
[docs][clang-format] Migrate generated clang-format docs to markdown
The challenge here is that the documentation is generated from Doxygen
comments in headers, `Format.h` and `IncludeStyle.h`.
First, the generator was updated to generate markdown constructs, and
then the Doxygen comments were also modified to use markdown constructs.
Mostly this means using single backticks instead of double backticks,
which is the Doxygen-native way of expressing code font blocks anyway,
so that's good.
To validate, I built the Sphinx docs and the doxygen, and I confirmed
that the generator script is idempotent, meaning it doesn't change the
markdown output. When I add a new option to clang-format, it shows up in
the help text block, so it works.
Before/after validation links:
| Source file | Before HTML | After HTML |
| --- | --- | --- |
[4 lines not shown]
[SLP] Add additional test for deferred rematerialization (#213400)
More tests for #211680.
Also cleaned up some commented out code that slipped through with the
old test.
New test stresses the scheduling updates.
[docs] Rewrite selected Clang docs to Markdown (#210843)
Tracking issue: #201242
See the [migration guide] for more information.
[migration guide]:
https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines
This is a stacked PR based on #210842 , which will be a standalone
commit that
renames *.rst -> *.md before this PR lands for history preservation
purposes.
This was prepared with rst2myst plus LLM-assisted cleanup. I paged
through all the generated HTML looking for migration artifacts, and all
of the differences I could find appear to be formatting error
corrections.
[ELF] Quote the value in "unknown -z" diagnostics (#213572)
To make stray whitespace more visible (see #212523)
```
$ echo end > tmp.f90 && flang -fuse-ld=lld -Wl,"-z execstack" tmp.f90
ld.lld: warning: unknown -z value: execstack
```
Drop the colon (colon is typically used without quotes in lld/ELF
diagnostics).
Change ErrAlways to Err so that --noinhibit-exec downgrades the errors
to warnings. Read --noinhibit-exec before readConfigs, as Err depends on
it.
[llvm-profdata] Reject merging single-byte-coverage with count profiles (#213177)
llvm-profdata merge previously silently merged single-byte-coverage
profiles with count profiles. We should reject this, because
SingleByteCoverage will always be set to true in the merged profile, and
mess up the PGO pipeline.
mergeProfileKind now errors with cannot merge single-byte-coverage
profiles with count (non-coverage) profiles when exactly one side has
InstrProfKind::SingleByteCoverage set.
Note: Used AI to generate the code
---------
Co-authored-by: Sharon Xu <sharonxu at fb.com>
[docs] Clean up migrated Clang InternalsManual markup
Replace migrated blockquote markup in InternalsManual.md with MyST definition lists where the surrounding text is semantically a term-and-definition list.
[docs] Rename selected Clang docs to Markdown (#210842)
Tracking issue: #201242
See the [migration guide] for more information.
[migration guide]:
https://llvm.org/docs/SphinxQuickstartTemplate.html#markdown-migration-guidelines
This is the initial straight rename commit. It will probably break the
docs build, but it has to be a separate PR for blame preservation
purposes.
[AMDGPU][AMDGPULibCallSimplify] Use target type's float-semantics in `ConstantFP::get`
Compiler was crashing with:
```
Constants.cpp:1124: static llvm::ConstantFP* llvm::ConstantFP::get(llvm::Type*, const llvm::APFloat&):
Assertion `Ty->getScalarType() == Type::getFloatingPointTy(Cont ext, V.getSemantics()) &&
"ConstantFP type doesn't match the type implied by its value!"' failed.
```
Since the code was quite similar to `getConstantFloatVector`, I've ended
up modifying its implementation to also handle scalars and renamed it.
[flang][OpenMP] Version-dependent parsing of map-type-modifier (#213473)
Up until 5.2, ALWAYS, CLOSE, and PRESENT were keywords of the
map-type-modifier. Starting from 6.0 they all became their own
single-keyword modifiers. This allowed specifying them together,
unlike in the past where map-type-modifier was unique.
To avoid using a single representation of the modifiers, and be
able to validate them through non-conditional properties, the
AST was rewritten back to the older form in canonicalization
when the spec version was set to 5.2 or earlier.
Now that the parser is version-aware, it can generate the desired
AST from the start.
Additionally, extract the OMPX_HOLD modifier out of the map-type-
modifier into its own AST node regardless of version.
[flang] Pass LangOptions to parser via UserState (#213472)
This will help deal with syntax changes across different versions of
OpenMP. There are certain cases where being able to generate different
AST for the same source code depending on the version of the OpenMP
spec makes semantic analysis easier.
---------
Co-authored-by: Michael Kruse <llvm-project at meinersbur.de>
[GlobalISel] Add immediates to `LegalizerQuery` (#211101)
Expands `LegalityQuery` to include instruction immediates in the query.
This allows instructions with immediates to be handled more fully with
legalization rules/predicates (e.g. `G_SEXT_INREG` based on its sext
width) rather than having to resort to custom legalizer logic.
Split from #198979
[lld-macho] Include ICF safe thunks in balanced partitioning (#212096)
Mach-O balanced partitioning currently discovers candidate sections by
walking the input-file section graph. In `--icf=safe_thunks` mode,
address-significant functions can instead be emitted as linker-created
thunk sections after that graph has been built. A temporal-profile name
then resolves to the dead folded input while the callable section
present in the final binary is never eligible for BP ordering.
Factor candidate collection into a helper, then inspect the final
`inputSections` set for sections containing a `Defined` symbol marked
`ICFFoldKind::Thunk`. This makes emitted ICF safe thunks visible while
keeping unrelated synthetic metadata outside BP.
The new arm64 regression folds a profiled address-significant function
into a 4-byte safe thunk and verifies both the BP startup count and
final symbol order. Without the change, BP orders zero startup sections
for that profile; with the change it orders the emitted thunk first.
[AMDGPU] Do not reset AsyncScore when recording an async mark (#213144)
AsyncScore is a snapshot of the counter scores used by async operations,
which recordAsyncMark stores into AsyncMarks. Like the other scores
tracked by the brackets, these snapshots need to be monotonically
increasing: determineAsyncWait indexes into AsyncMarks and uses the
selected entry directly to compute the wait, so each mark has to
describe the state of every async operation issued before it, not just
those issued since the previous mark.
[Sema] Add support for Swift raw identifiers in the `swift_name` attribute and APINotes. (#199531)
This is the upstream version of
https://github.com/swiftlang/llvm-project/pull/12995 from the swiftlang
fork.
**Motivation:** Swift 6.2 added support for [raw
identifiers](https://github.com/swiftlang/swift-evolution/blob/main/proposals/0451-escaped-identifiers.md),
which are backtick-delimited identifiers that can contain non-identifier
characters like `` let `hello world` = `foo/bar:baz` ``. This change
ensures that those identifiers can be used when setting Swift names for
C decls in APINotes and the `swift_name` attribute.
[lldb][DIL] Validate bitfield extraction ranges (#213055)
The DIL bitfield extraction operator `base[high:low]` creates a
synthetic bitfield child without validating the requested range. Three
malformed ranges reach the data layer and either return nonsense or
crash. Reproduced with a 32-bit `int value` and DIL enabled:
```
(lldb) settings set target.experimental.use-DIL true
(lldb) frame variable 'value[-1:0]'
(int:2) value[-1:0] = 2
```
A negative index is accepted and produces a meaningless child.
`first_index`/`last_index` are signed `int64_t`, but
`GetSyntheticBitFieldChild` takes `uint32_t`, so `-1` silently wraps to
a huge unsigned offset.
```
[36 lines not shown]
[flang] - Call _FortranAAssignSimple instead of _FortranAAssign for intrinsic-type array assignments.
This patch adds support for calling _FortranAAssignSimple, a faster-path for array assignments.
`_FortranAAssignSimple` is called when ALL the following conditions are true:
1. Intrinsic element type (not derived type)
2. Matching ranks (no scalar-to-array broadcasting)
3. Non-volatile
4. Not polymorphic
5. Not explicit-length character
6. Not temporary LHS
Otherwise, uses `_FortranAAssign` (or specialized variants like `_FortranAAssignPolymorphic`, `_FortranAAssignExplicitLengthCharacter`).
This is a (perhaps final) part of the fix for https://github.com/llvm/llvm-project/issues/203915