The standard does not require `optional<T>(U&&)` to be potentially throwing; it simply does not specify noexcept for the primary `optional<T>` converting constructor. Standard library implementations are permitted [[res.on.exception.handling]/5](https://eel.is/c++draft/res.on.exception.handling#5) to strengthen exception specifications for non-virtual library functions, as long as the strengthened specification is correct.
GNU libstdc++ already does this:
https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/optional#L911-L913https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/std/optional#L962-L974
The existing libc++ code only added noexcept for the C++26 `optional<T&>` case, guarded by `is_lvalue_reference_v<_Tp>`. It is safe to remove that gate and use the general condition instead:
```
noexcept(is_nothrow_constructible_v<_Tp, _Up>)
```
For `optional<T&>`, this still becomes the intended reference-construction check. For ordinary `optional<T>`, it correctly reflects whether constructing `T` from `U` can throw. The constructor only forwards into the contained object construction and updates optional bookkeeping, so if `T` is nothrow-constructible from `U`, the optional construction is also nothrow.
[AMDGPU] Fix GISel lowering for amdgcn_s_quadmask, amdgcn_s_wqm (#202704)
This change also marks the intrinsics
`amdgcn_s_quadmask` and `amdgcn_s_wqm`
as AlwaysUniform.
loader.efi: Parse SPCR table entry in ACPI tables
If there's a SPCR, then use it to create and pass the right values to
the uart. We pass xo=0 in to calcuate the xo from the baud rate. We try
to be smart about what we set. We either set io or mm or pv/pd. Old
kernels will still work, despite pb/pd not being supported, because
we'll fall back to the SPCR parsing in the kernel.
We don't support Rev3 or Rev4 SPCR yet. It's too new to be in real
hardware yet.
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D47085
(cherry picked from commit 70253b538f68f2787d5913702337eb600799a3c3)
loader.efi: |= the boot flags how
how is assumed to be 0, so we directly assign to it. It might not always
be 0, so or-in these bits.
Sponsored by: Netflix
Reviewed by: bz, andrew
Differential Revision: https://reviews.freebsd.org/D47084
(cherry picked from commit 94164106c0a7e18b5ac7a1508fed179b6e6939f9)
[NewPM][AArch64] Port AArch64DAGToDAGISelLegacy to NewPM (#202739)
Adds `AArch64DAGToDAGISelPass`, the NewPM port for AArch64 instruction
selection. Inherits from `SelectionDAGISelPass` and reuses its
implementation, similar to X86 and AMDGPU ports and the Legacy pass
implementation.
Assisted by Gemini
[MachineScheduler] Check we don't add self dependency edge when adding barrier (#202743)
Followup to #200945.
When we hit the huge-region limit for both FPExceptions and memory
operations, we'd first set BarrierChain to the current SU in the
FPExceptions path, then again in the memory operations path, and we'd
add the SU itself as a dependency.
Check we're not adding a self dependency when creating a barrier.
Assisted-by: Gemini
18014 loader: rework detached hash module processing
Reviewed by: Gordon Ross <gordon.w.ross at gmail.com>
Approved by: Dan McDonald <danmcd at edgecast.io>
[libc] Migrate `Block` to `BlockRef` in baremetal allocator (#201001)
Under C++ object lifetime and strict aliasing rules, accessing typed
objects requires that an object of that type actually exists at the
memory location. Previously, the Block structure stored prev and next
offset values, where the prev field overlapped with the usable space of
the preceding block to save space. When the predecessor was allocated,
user payload was written directly to this overlapping space,
complicating object lifetime management. A key issue arose during
reallocation (like in-place shrinking), where the allocator needed to
manipulate block boundaries (e.g., splitting a block) while user payload
was still actively residing in that memory. This caused undefined
behavior due to accessing typed Block members that collided with the
user's active objects.
This patch eliminates the problem by always treating blocks as raw bytes
accessed through a byte-backed proxy (BlockRef). Instead of constructing
or casting to typed Block structures, metadata is read and written using
aligned byte-copy operations (inline_memcpy). This decouples block
[3 lines not shown]
[Github] Add github-automation container (#200704)
There are several jobs that use the pattern:
1. Checkout github-automation.py script.
2. Install dependencies for github-automation.py script.
3. Run the github-automation.py script.
We can consolidate a lot of this logic into the container and simplify
the workflows. This may also speed them up the workflow jobs slightly,
but most of them are already pretty fast, so it may not make a big
difference.
kern_prot.c: Belatedly add copyright
See the commit log for the why.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1c0e5c53ff1672a93fc42988020723bb6bc427c1)
style.9: Fix a typo (missing word)
Fixes: af2c7d9f6452 ("style.9: Encourage style changes when doing significant modifications")
MFC after: 1 day
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 1876f629b97608679f1bd71b9aa88a57b55c4574)
MAC/do: Clarify comments about flags attached per-ID or per-ID-type
No functional change.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 0c2d64ce3da9c042da133c8b6d7391abb177f2c9)
MAC/do: Tests: Quote the source directory
In a standard test suite installation, this is not necessary, but be
bullet-proof to custom ones, however improbable.
Reviewed by: bapt
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38
(cherry picked from commit 33daea3f862d7fe996602756805a92a600356f94)
acpi: On /dev/power suspend, trigger userspace notifications
On a suspend request via ioctl(), /dev/acpi (and compatible /dev/apm)
both call acpi_ReqSleepState() instead of directly calling
acpi_EnterSleepState(). The former does more checks, returns success if
the machine is already suspending, and notifies user space (via devd(8))
about the impending suspend. In other words, it seems to have been
designed for user consumption more than the latter function.
So, use acpi_ReqSleepState() in place of acpi_EnterSleepState() in
acpi_pm_func(), which is ultimately called by power_pm_suspend(), itself
called by power_ioctl(). Other callers of power_pm_suspend() (such as
the console drivers) are also user-facing facilities, so should also
benefit from this change.
Reviewed by: mhorne, imp
Tested by: mhorne
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
[3 lines not shown]
[flang] Add RegionBranchOpInterface to fir.do_loop (#202418)
`fir.do_loop` lacked RegionBranchOpInterface, causing dataflow analyses
and others to treat host loops as opaque and conservatively block
optimizations.
Implement getSuccessorRegions, getEntrySuccessorOperands, and
getSuccessorInputs on fir.do_loop, and override
getMutableSuccessorOperands on fir.result to customize for accommodating
the occasionally present finalValue in `fir.result`.
As a side effect, alias analysis now resolves pass-through iter-carried
references to MustAlias instead of MayAlias.
[clang][OpenMP] Add OMP 6.0 prefer_type({fr,attr}) parsing for interop (#198868)
This PR adds parsing support for the OpenMP 6.0 brace-grouped
prefer_type modifier on the init clause of #pragma omp interop, while
preserving the OpenMP 5.1 flat form. Each preference-specification can
now carry an optional
fr(<foreign-runtime-id>) and zero or more attr(<string-literal>...)
selectors, eg:
#pragma omp interop init(prefer_type({fr("sycl"), attr("ompx_propX")}, \
{fr("level_zero")}, \
{attr("ompx_propY")}), targetsync: obj)
[MC][COFF][AArch64] Add helper symbols for large SECREL addends (#199602)
## Summary
Create helper label symbols for ARM64 COFF SECREL HI12/LO12 relocations
when the byte offset cannot fit in the 12-bit instruction addend.
This is the MC-side follow-up to #200060: with LLD now handling small
SECREL_HIGH12A byte addends correctly, this patch only handles the
remaining large-addend case that needs a helper symbol.
Fixes #199581.
AI assistance: Claude (Anthropic), Codex (OpenAI).
## Tests
`llvm/test/MC/AArch64/coff-secrel-hi12.s`, run for both
`aarch64-windows` and `arm64ec-windows`, covers:
[11 lines not shown]