[SSAF] Let function parameters inherit linkage from their parent functions
SSAF treats parameters as entities and may not always associate them
back to their parent functions. Therefore, it needs to identify
parameters of functions with external linkage across different
TUs. Treating them as having no linkage (as in C++) causes the same
parameter in different TUs to be assigned different EntityIDs. As a
result, the behavior of the parameter across multiple TUs cannot be
correlated.
rdar://178844032
[DirectX][ObjectYAML] Add SRCI part support (#199446)
Add support for DXContainer SRCI in the ObjectYAML pipeline so it can be
represented in structured YAML and round-tripped through
yaml2obj/obj2yaml.
SRCI is emitted into shader PDB files. It stores shader source code that
is displayed in PIX, and shader compilation flags.
[flang][OpenMP][NFC] Share declare mapper helpers for iterator modifier lowering
Move mapper lookup and implicit default mapper creation into reusable
OpenMP lowering helpers so regular map lowering and iterator-generated
map entries can use the same resolution path.
This prepares Flang iterator modifier lowering for map and motion clauses
without changing the generated IR for existing non-iterator maps.
[DirectX] Rewrite DIGlobalVariableExpression to DXDIGlobalVariable (#199791)
DIGlobalVariable used to have an `expr` operand. Starting from
bceaaa964360 `expr` is now an operand of DIGlobalVariableExpression,
which references both the variable and the expression.
Before:
!0 = !DIGlobalVariable(expr: !1)
!1 = !DIExpression(DW_OP_plus, 4)
Now:
!2 = !DIGlobalVariableExpression(var: !3, expr: !4)
!3 = distinct !DIGlobalVariable(name: "a", scope: null, isLocal: false,
isDefinition: true, type: !6)
!4 = !DIExpression(DW_OP_plus, 4)
DXIL does not support DIGlobalVariableExpression, so we have to fold
`expr` back to DIGlobalVariable.
[2 lines not shown]
[lld-macho][LTO] Emit `__llvm_addrsig` for `--icf=safe_thunks` (#188486)
LTO was emitting `__llvm_addrsig` metadata when `--icf=safe` was
specified, but not for `--icf=safe_thunks`. After the recent PR
https://github.com/llvm/llvm-project/pull/188400 that makes safe ICF
conservative without `__llvm_addrsig` (marking all symbols as
address-significant when the section is absent), this omission caused
safe_thunks to silently degrade for all LTO-compiled objects: every
symbol became `keepUnique`, preventing body folding entirely.
Fix this by also enabling `EmitAddrsig` when `icfLevel` is
`safe_thunks`. This allows the LTO backend to emit precise
address-significance metadata, so that only truly address-significant
functions get thunk treatment while non-address-significant identical
functions can still be body-folded.
Add a regression test that verifies LTO + `--icf=safe_thunks` correctly
body-folds non-address-significant identical functions, which would fail
without this fix due to missing addrsig metadata.
Restore unnamed_addr on vtables in -fno-rtti builds (#201846)
This is a follow-up to #200108 which dropped unnamed_addr from vtables
since it can break dynamic_cast under some circumstances. However, that
caused significant binary size regressions due to preventing ICF of
vtables.
This patch restores unnamed_addr on vtables in -fno-rtti builds, since
those do not support dynamic_cast, recovering the binary size savings at
least for those using that configuration.
[flang][OpenMP] Implicit declarations of procedures in DECLARE_TARGET
This replaces commit 8f5df8891840b, since it was rejecting the following
case:
```
function baz(a)
!$omp declare target to(baz)
real, intent(in) :: a
baz = a
end
program main
real :: a
!$omp declare target(baz)
integer, save :: baz ! error: 'baz' is already declared
end
```
Instead of flagging an error, the 'baz' in the directive should be
resolved to the explicitly declared variable.
[24 lines not shown]
[SelectionDAG] Fix -Wunused-variable (#201932)
NumDstElts is only used in assertions so mark it [[maybe_unused]] to
prevent any issues with non-asserts builds and -Wunused-variable.
AMDGPU: fix assert when calling LiveRegUnits::stepBackward (#201887)
`stepBackward` assert added in
https://github.com/llvm/llvm-project/pull/193104.
Found while building `aqlprofile` as part of TheRock.
[clang] Disable crash-diagnostic-tar.c if backtraces are disabled (#201921)
PR #201643 adds a test that fails if backtraces are disabled, e.g. in
tests for a stripped build. This was failing the Fuchsia CI, so this
change disables this test in such cases. It is likely possible to make
this test finer-grained to allow it to succeed with backtraces disabled.
[CIR] Update CIR unary operations (#201727)
This creates a floating-point-specific FNegOp and updates the type
constraints on the existing unary operations to match the types that are
actually produced by the Clang AST.
This change also moves complex types out of the unary operations. A
ComplexConjOp is added to handle what was previously being incorrectly
referred to as "not", while inc, dec, and minus are just expanded to
their component representation during codegen. We may want to consider
adding operations like cir.complex.add later, but for now I'm just
removing this type from the unary ops. I'm doing this for two reasons:
(1) the old use was inconsistent with how we handle other arithmetic
operations on complex types, and (2) I will soon need to attach
FP-specific attributes to add and subtract of complex types (and so also
inc and dec).
Assisted-by: Cursor / claude-opus-4.8
[SelectionDAG] Fold extracts spanning concat operands
Factor the extract_subvector-of-CONCAT_VECTORS logic and handle
extracts that cover multiple whole concat operands by rebuilding a
smaller concat directly.
AI note: an LLM generated the code and the test, I've read them
Co-Authored-By: OpenAI Codex <codex at openai.com>
[flang][OpenMP] Fix failure in linear-clause01.f90 test (#201920)
Apparently the order of some OpenMP checks changed since the pre-commit
CI tested PR #189170.
Now the error `The list item 'i' must be a dummy argument` occurs
instead of
`'cc' is a common block name and must not appear in a LINEAR clause`.
[DAG] isGuaranteedNotToBeUndefOrPoison - add ISD::BITCAST demanded elements handling (#200933)
Bitcasts preserve undef/poison status, but vector bitcasts can change
which source lanes cover a demanded result lane. Map the demanded
element mask through fixed-length vector bitcasts before checking the
source where possible.
AI note: an LLM generated the code and the test, I've read them
Fixes #161512
Co-Authored-By: OpenAI Codex <codex at openai.com>
---------
Co-authored-by: OpenAI Codex <codex at openai.com>
[lldb] Drop client-side Python pre-load and remove PythonPathSetup (#200533)
PythonPathSetup was a Windows-only helper that pre-mapped python3xx.dll
into lldb.exe / lldb-dap.exe so liblldb.dll's direct imports from
python3xx.dll would resolve when the delay-load thunk for liblldb fired
on the first SB call. ScriptInterpreterRuntimeLoader's Windows backend
has subsumed that responsibility, so this commit deletes the helper and
rewrites the two clients on the new API.
The Windows pre-load itself stays in the clients: the central load in
SystemInitializerFull::Initialize() lives behind the liblldb.dll thunk
that the import binding fires against, so the loader still has to run
from the binary that statically links lldbHost (lldb.exe / lldb-dap.exe)
before the first SB call lands.
[doc] Address various sphinx warnings (nearly NFC)
It seems like using a non-`hidden` `toctree` for page navigation is a
bit of a trap, in that every doc must have a single unique path through
the global TOC tree to the root doc, and it is very easy to end up with
multiple.
This patch tries to address the warnings in llvm/docs/, namely:
$ sphinx-build -b html -jauto llvm/docs/ /tmp/sphinx-out
checking consistency...
llvm/docs/AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack/AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack.md: document is referenced in multiple toctrees: ['UserGuides', 'AMDGPUUsage'], selecting: UserGuides <- AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack/AMDGPUDwarfExtensionAllowLocationDescriptionOnTheDwarfExpressionStack
llvm/docs/AMDGPUDwarfExtensionsForHeterogeneousDebugging.rst: document is referenced in multiple toctrees: ['UserGuides', 'AMDGPUUsage'], selecting: UserGuides <- AMDGPUDwarfExtensionsForHeterogeneousDebugging
llvm/docs/CommandGuide/llvm-reduce.rst: document is referenced in multiple toctrees: ['CommandGuide/index', 'CommandGuide/index', 'Reference'], selecting: Reference <- CommandGuide/llvm-reduce
llvm/docs/GitHub.rst: document is referenced in multiple toctrees: ['GettingInvolved', 'UserGuides'], selecting: UserGuides <- GitHub
llvm/docs/GlobalISel/IRTranslator.rst: document is referenced in multiple toctrees: ['GlobalISel/index', 'GlobalISel/Pipeline'], selecting: GlobalISel/index <- GlobalISel/IRTranslator
llvm/docs/GlobalISel/InstructionSelect.rst: document is referenced in multiple toctrees: ['GlobalISel/index', 'GlobalISel/Pipeline'], selecting: GlobalISel/index <- GlobalISel/InstructionSelect
llvm/docs/GlobalISel/Legalizer.rst: document is referenced in multiple toctrees: ['GlobalISel/index', 'GlobalISel/Pipeline'], selecting: GlobalISel/index <- GlobalISel/Legalizer
llvm/docs/GlobalISel/MIRPatterns.rst: document is referenced in multiple toctrees: ['GlobalISel/index', 'UserGuides'], selecting: UserGuides <- GlobalISel/MIRPatterns
[29 lines not shown]
[lldb][windows] Fix Python library link for LLDB_ENABLE_PYTHON_LIMITED_API (#201407)
When `LLDB_ENABLE_PYTHON_LIMITED_API` is `ON`, `liblldb` should link
against `python3.dll` (stable ABI) rather than the `python310.dll`.
Previously, two issues prevented this on Windows:
1. The `ScriptInterpreter` plugin explicitly linked
`${Python3_LIBRARIES}` regardless of whether the limited API was
enabled.
2. Python's `pyconfig.h` emits a `#pragma` to select the import library
at link time, choosing `python3.lib` or `python310.lib` depending on
whether `Py_LIMITED_API` is defined. However,
`LLDB_ENABLE_PYTHON_LIMITED_API` was only surfaced through Config.h,
which is not included early enough in the compilation chain to affect
pyconfig.h in all translation units.
This patch fixes both issues.
This is needed for https://github.com/llvm/llvm-project/pull/200533.