[GlobalISel] avoid G_TRUNC with floating-point G_MERGE_VALUES source (#206733)
With extended LLT, scalar LLT carry an integer/float kind information.
The `G_TRUNC(G_MERGE_VALUES)` fold in
`LegalizationArtifactCombiner::tryCombineTrunc` truncated, copied or
rebuilt a merge directly from the merge's source register.
**Problem**
When those sources are floating-point this produces artifacts with float
source operand - e.g. `i1 = G_TRUNC f32` or a rebuilt `iN =
G_MERGE_VALUES f32, ...` which are bit level integer operations and must
not take a float operand.
**Fix**
Reinterpret a floating-point merge source to an integer of the same size
via `G_BITCAST` before truncating, copying or rebuilding the merge. So
the emitted artifacts stay on integer operands. Non-float sources and
non-extended-LLT builds are unaffected.
[libc++] Clean up headers that relied on `<optional>`'s transitive includes (#213158)
Clear out the headers in <optional> that were left in to not break
other headers, and fix them also. Also fix tests.
[GlobalISel] emit G_BITCAST in widenScalarMergeValues when DstTy does not match WideTy (#203014)
**Problem:**
`LegalizerHelper::widenScalarMergeValues` does not handle the case where
the destination register type is a floating-point type but the widen
operation produces an integer type of the same size.
For example, given:
```
%0:_(i8) = G_CONSTANT i8 0
%1:_(i8) = G_CONSTANT i8 1
%2:_(f16) = G_MERGE_VALUES %0:_(i8), %1_:(i8)
```
With a `minScalarOrElt` rule widening the source type to I16,
`widenScalarMergeValues` enters the `WideSize >= DstSize` path and
assigns the result to a new virtual register. The condition used to
assign directly to DstReg uses type equality (WideTy == DstTy), which
fails when DstTy = f16. As a result, DstReg is left without a
definition.
[12 lines not shown]
[analyzer] Implement BugReporterVisitor for UseAfterLifetimeEnd to trace lifetime source binding (#207052)
Currently the `UseAfterLifetimeEnd` checker can emit warnings, but those
warnings cannot clearly describe to which annotated parameter the return
value is actually bound. When multiple parameters are annotated, it is
unclear which one the return value is bound to. Using
`BugReporterVisitor` to trace back the nodes and emit a note that
explains where the lifetime of the annotated parameter (the source)
ended can be helpful for users.
***NOTE***: This PR is built on #205951. It should only be merged after
#205951 is merged.
Consider the following case:
```cpp
#include <stddef.h>
class Arena {
[39 lines not shown]
[ConstFold] Fold fixed-vectors in constantFoldIntrinsic (#213625)
This exposes an underlying bug in wasm.dot-folding, which we fix. The
motivation for this patch is to enable folding of get.active.lane.mask
in VPlan in a follow-up.
rc.subr: Fix premature return from wait_for_pids
Use pwait's new -r option to wait until the target processes have not
only terminated, but also been reaped.
PR: 293183
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D58391
(cherry picked from commit 356d0b79cf6fc693ed1a5564232e240ce15ccb8a)
pwait: Don't use init as a target
The time_unit test case uses PID 1 as a target for pwait. This doesn't
work in a jail. Since all we need is a process that we know won't die
while the test is running, we may as well use ourselves.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D58418
(cherry picked from commit 5922e9d7e72bfa8a85b0f37bcfd1a8b5d866ec3b)
kqueue: Fix delivery of unwanted events
In both procdesc_kqops_event() and filt_proc(), the event variable can
have more than one bit set. This means that:
* We cannot compare it directly with NOTE_EXIT; we must binary-and them
instead.
* We cannot binary-or it with the report mask; we must binary-and it
with the request mask first.
MFC after: 1 week
Fixes: 2a5e58c59694 ("procdesc: add NOTE_PDSIGCHLD")
Fixes: b328975b9d7c ("procdesc: report NOTE_PDSIGCHLD for traced and stopped process")
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58395
(cherry picked from commit 4627fe9e5afc0dce4469f5964f5d4b0e49a24274)
pwait: Test the new -r option
Test that pwait without -r reports a process as soon as it terminates,
while pwait with -r does not report it until it has been reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D58385
(cherry picked from commit e115066370dcfec410d914362756d09c268a5b4e)
pwait: Add a SIGINFO handler
On SIGINFO, print a space-separated list or remaining processes to
standard error.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58386
(cherry picked from commit eddd8aa99ca84c85faea5761af800b5b089d6ba1)
pwait: Optionally wait until process is reaped
If the new -r option is specified, wait until the target process not
only terminates but is reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58314
(cherry picked from commit c8f5e6819d4d81906c4a1641b5c9f02d8730481c)
kqueue: Add NOTE_REAP
Add a NOTE_REAP event for EVFILTER_PROC which provides a notification
when the process is reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58313
(cherry picked from commit 2bacbbecb165dd761ea7ec2fc35630db61508cdf)
rc.subr: Fix premature return from wait_for_pids
Use pwait's new -r option to wait until the target processes have not
only terminated, but also been reaped.
PR: 293183
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D58391
(cherry picked from commit 356d0b79cf6fc693ed1a5564232e240ce15ccb8a)
kqueue: Add NOTE_REAP
Add a NOTE_REAP event for EVFILTER_PROC which provides a notification
when the process is reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58313
(cherry picked from commit 2bacbbecb165dd761ea7ec2fc35630db61508cdf)
pwait: Add a SIGINFO handler
On SIGINFO, print a space-separated list or remaining processes to
standard error.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58386
(cherry picked from commit eddd8aa99ca84c85faea5761af800b5b089d6ba1)
pwait: Test the new -r option
Test that pwait without -r reports a process as soon as it terminates,
while pwait with -r does not report it until it has been reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D58385
(cherry picked from commit e115066370dcfec410d914362756d09c268a5b4e)
pwait: Add a SIGINFO handler
On SIGINFO, print a space-separated list or remaining processes to
standard error.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58386
(cherry picked from commit eddd8aa99ca84c85faea5761af800b5b089d6ba1)
pwait: Test the new -r option
Test that pwait without -r reports a process as soon as it terminates,
while pwait with -r does not report it until it has been reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D58385
(cherry picked from commit e115066370dcfec410d914362756d09c268a5b4e)
pwait: Optionally wait until process is reaped
If the new -r option is specified, wait until the target process not
only terminates but is reaped.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D58314
(cherry picked from commit c8f5e6819d4d81906c4a1641b5c9f02d8730481c)
rc.subr: Fix premature return from wait_for_pids
Use pwait's new -r option to wait until the target processes have not
only terminated, but also been reaped.
PR: 293183
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D58391
(cherry picked from commit 356d0b79cf6fc693ed1a5564232e240ce15ccb8a)