[clang] Properly adjust lambda decl context in predefined expressions (#246670)
Resolves #221564
The problem was introduced in #211811. It mistakenly assumes that when
the `DeclContext` of a lambda call operator is encountered, a
corresponding `LambdaScopeInfo` is present on the `Sema.FunctionScopes`
stack.
This assumption holds only during the definition of a lambda, and not if
the call operator is explicitly referenced after the lambda is defined:
```cpp
auto l = []() { return __func__; }; //this is fine
using L = decltype(l);
constexpr auto L::operator()() const { return __func__; } //no LambdaScopeInfo here
```
To fix this, the `DeclContext` in `getPredefinedExprDecl` is adjusted
only if it matches with the call operator of a `LambdaScopeInfo`
currently on the stack.
[ConstraintElim] Check for overflow when adding left-hand side coefficients (#246388)
`getRowForLessEqual` checked the right-hand side coefficients for
overflow but added the left-hand side ones with a plain `+=`, so a
variable that appears several times on the left could wrap and the
compare got folded wrongly. This uses `AddOverflow` and gives up on
overflow, like the right-hand side. On the issue's IR, `opt
-passes=constraint-elimination` folded the compare to `true` before and
leaves it alone now.
Fixes #245363
Assisted-by: Grok Bot (AI coding agent)
[OpenMP] Use device scope for atomic constructs on the device
OpenMP 6.0, 17.8.5 specifies that "The memscope clause determines the
binding thread set for an atomic region. If the memscope clause is not
present, the behavior is as if the memscope clause appeared on the
construct with the device scope-specifier."
Thread the sync scopes through codegen amd also add a release note
because this is changing existing behavior.
Existing behavior was overly cautios for OpenMP 5.2, too, though. The
atomic construct never specified the option of having system-level
scope. This only came with the memscope clause and it's "all"
scope-specifier.
Claude assisted with this patch.
[OpenMP][clang] Apply atomic options to atomic compare (#240421)
Thread denormal mode, fine-grained memory and remote memory options
through for atomic compare directivs.
Claude assisted with this patch.
devel/llvm-apple: upgrade to 6.4.3 and disable i386
I got a warning from portscout that it doesn’t build i386. We don’t
need i386 support, so we can drop it.
Differential Revision: https://reviews.freebsd.org/D62420
[CodeGen] Added '*' to internal linkage types (#220864)
RTTI typename for internal-linkage types lacked '*', which broke
type_info::operator== and dynamic_cast with libstdc++
Fixes #34255
Fixes #79367
Fixes #59790
AI usage: Claude (reviewed test files)
---------
Co-authored-by: Jones, Matthew (DI SW SIM FRWK PLAT SIMFW HPC) <jones.matthew at siemens.com>
Co-authored-by: Nikolas Klauser <nikolasklauser at berlin.de>
Co-authored-by: Tom <tajames at zoho.com>
[AMDGPU] Defer VOPD lookup in `checkVOPDRegConstraints` (NFC) (#248899)
The table lookup is relatively expensive so allow cheaper checks to run
first. The change improves compile-time by 1-2% on the motivating
compute shader.
Assisted-by: Claude Opus 5.5
[CIR] Fix crashes in the complex constant folders
The folders of `cir.complex.real`, `cir.complex.imag` and
`cir.complex.create` asserted on constants that the `cir.const` verifier
accepts.
`cir.complex.real` and `cir.complex.imag` cast a constant operand to
`#cir.const_complex`. A complex constant can also be `#cir.zero`,
`#cir.undef` or `#cir.poison`. CIRGen emits `#cir.zero` for a
value-initialized complex, so clang crashed on `__real__ CI()`. A part
of `#cir.zero` now folds to the zero of the element type. A part of
`#cir.undef` or `#cir.poison` folds to undef or poison, as the cast
folder does for its operand.
`cir.complex.create` built a `#cir.const_complex` from any two constant
parts. The attribute holds int or float literals only, so its verifier
failed on a part that is undef, poison or a global view. The folder now
leaves such a create alone.
Assisted-by: Claude Code (Fable 5.2).
[lldb][PDB] Remove the DIA symbol file plugin (#247254)
I think it's time now. This PR removes `SymbolFilePDB` and associated
files. To my knowledge, there have been no major issues in the native
plugin that break the debugging experience.
This completes the RFC:
https://discourse.llvm.org/t/rfc-removing-the-dia-pdb-plugin-from-lldb/87827.
We initially set out to remove the plugin in 23, but didn't due to 22
still requiring a specific version of Python ([this
comment](https://discourse.llvm.org/t/rfc-removing-the-dia-pdb-plugin-from-lldb/87827/28)).
Quick refresher on why we're preferring the native plugin over DIA:
- DIA is only available on Windows, making remote debugging not possible
and for testing lldb itself, we can't run DIA tests that don't run the
target on Linux.
- DIA is a black-box. We don't know its implementation, so there is a
gap when debugging issues with it. Whereas the native plugin is fully
implemented in LLVM itself. This also means we LLVM/Clang and lldb
[6 lines not shown]
graphics/shaderc: Unbreak after unflavorization of glslang
glslc and libshaderc_shared.so.1 try to link in libglslang.so and
libSPIRV.so, which are now installed along with their static parts. So
we need to add glslang to LIB_DEPENDS instead of BUILD_DEPENDS.
PR: 301481
Reported by: Bruno Damour <bruno at ruomad.net>, dim
Tested by: Bruno Damour <bruno at ruomad.net>, dim
Co-authored-by: Dimitry Andric <dim at FreeBSD.org>
[CodeGen][Rematerializer] Always rollback in the original region
This addresses a subtle issue in the rollbacker which would arise when
rematerizalizing between two adjacent rematerialization regions (i.e.,
the first region's end is the second region's start). When
rematerializing the last instruction of the first region at the
beginning of the second region and rolling back later, the re-created
register would end up in the second region instead of the first because
its re-insertion position was set incorrectly.
This is fixed by ensuring that a deleted register's re-insertion
position is always before all its rematerializations in the same block.
[CodeGen][Rematerializer] Fix region boundary tracking logic (#245644)
This addresses a few edge-case/rare issues with keeping the bounds of
rematerialization regions valid and up-to-date as rematerializations
happen.
1. An upper region boundary deleted through dead-def elimination needs
to be pushed to the next valid instruction.
2. Updating any region boundary in any case may require updating
boundaries of other "touching" regions to keep them valid too. Issues
could typically happen when a rematerialization region's end would be
the beginning of the next one. Receding the beginning of the latter
region also requires receding the ending of the former region to keep
them non-overlapping.
Added unit-tests would crash without changes.
[CIR] Fix crashes in the complex constant folders
The folders of `cir.complex.real`, `cir.complex.imag` and
`cir.complex.create` asserted on constants that the `cir.const` verifier
accepts.
`cir.complex.real` and `cir.complex.imag` cast a constant operand to
`#cir.const_complex`. A complex constant can also be `#cir.zero`,
`#cir.undef` or `#cir.poison`. CIRGen emits `#cir.zero` for a
value-initialized complex, so clang crashed on `__real__ CI()`. A part
of `#cir.zero` now folds to the zero of the element type. A part of
`#cir.undef` or `#cir.poison` folds to undef or poison, as the cast
folder does for its operand.
`cir.complex.create` built a `#cir.const_complex` from any two constant
parts. The attribute holds int or float literals only, so its verifier
failed on a part that is undef, poison or a global view. The folder now
leaves such a create alone.
[9 lines not shown]
[InstSimplify] Drop annotations in select of min/max fold (#248870)
For the case where the inner min/max is returned, we need to drop
poison-generating annotations.
Fixes https://github.com/llvm/llvm-project/issues/246560.
[NFC][analyzer] Assert canonical step id in conjureSymbol (#247656)
The conjuration of symbols repsects the invariant that the CFG element,
stack frame and visit count data members of the `SymbolConjured` object
always contain the values that identify the _current_ analysis step.
The canoncal source of information about the current analysis step is
the `ExprEngine` singleton, which records the current CFG element and
stack frame, and can query visit counts from the `BlockCounter` of the
current `WorkList` of the `CoreEngine`. This information is now passed
to the constructor of `SymbolConjured` as parameters in long chains of
function calls, which is needlessly verbose and prone to
inconsistencies.
This commit asserts that symbols are always conjured with the
canonically correct values; and prepares the ground for follow-up
commits that can eliminate the complicated argument passing.
Recent commits ad462133ba34c2b52d5cccf52f848fb83a5626bb and
[7 lines not shown]