[X86] Handle more INLINEASM_BR shapes in X86FlagsCopyLowering
A copy before an INLINEASM_BR that leaves EFLAGS alone reaches the asm's
indirect targets, but the pass stopped at a later redefinition of EFLAGS
in the block and never rewrote the reads there. It could also hoist the
test position to the end of a block with an asm, which the indirect path
skips, and splitting a block between two conditional branches moved the
asm's indirect edges to the new block.
Follow the copy into the indirect targets of an asm that it reaches,
don't hoist the test into a block with an INLINEASM_BR, and keep the
asm's indirect edges in the first half of a split block. A block that
both the copy and an indirect path from an asm before it reach needs a
PHI, which the pass can't insert, so report it as it already does for a
use that the copy doesn't dominate.
Assisted-by: Claude Opus 5.5
[X86] Fix EFLAGS copy lowering across INLINEASM_BR indirect edges
An INLINEASM_BR isn't a terminator, so it can branch to an indirect
target from the middle of its block, before the instructions after it
run. The EFLAGS that live into an indirect target are the ones at the
asm, not the ones at the end of the block, but X86FlagsCopyLowering
assumed the latter in two places.
When the pass lowers an EFLAGS copy, it rewrites the copy's uses in its
block and then in every successor that EFLAGS live into. For a copy
after an INLINEASM_BR, that includes the asm's indirect targets, which
the copy never reaches, so the pass removed their live-in and rewrote
their flag reads to use SETCCs computed after the asm, which only the
fallthrough path runs. The pass could also hoist the test position for
a copy in an indirect target into its predecessor, before the
terminator that follows the asm, where the indirect path never goes.
Don't follow a copy from its block into the indirect targets of an
INLINEASM_BR before it, and don't hoist the test position out of an
[11 lines not shown]
Regenerate callbr tests for label-must-be-emitted
Main now prints label-must-be-emitted on INLINEASM_BR indirect targets
(#234850).
Assisted-by: Claude Opus 5.5
Move the asm error handling to its own PR
This PR now fixes only valid asm whose outputs crash the indirect targets.
Lowering a callbr whose asm has an error, which crashes after reporting
it, moves to its own PR stacked on this one.
Assisted-by: Claude Opus 5.5
Remove the stale FollowCopyChain comment and unrelated comment changes
The comment that explained FollowCopyChain's walk was left above
visitCallBrLandingPad() when the walk was removed. Also put the BTI comment
in visitCallBr() back as it was, and fix a double space.
Assisted-by: Claude Opus 5.5
Test more outputs that the indirect targets convert
Add the RISC-V shape of #143795, where an i32 output is sign-extended on
each path, a float in a specific physical register on x86, a double in a
pair of registers on i686, and a flag output on AArch64, whose NZCV is now
live into the indirect target. Also check that a callbr with direct and
indirect register outputs now only reports the error.
Assisted-by: Claude Opus 5.5
Replay each output's read in the indirect targets
The indirect targets re-parsed the constraints, recomputed each output's
registers and types, and paired them with the recorded registers in order,
so they were right only if both computations agreed. Record each output's
operand info and registers when lowering the callbr instead, and read them
in the indirect targets with the same code as visitInlineAsm().
This also marks a flag output's register (NZCV on AArch64, CC on SystemZ)
live into the indirect targets, as a register output's already was. And the
indirect targets no longer create virtual registers they don't use, which
renumbers some in the AArch64 test.
Assisted-by: Claude Opus 5.5
[SelectionDAG] Read callbr outputs from the INLINEASM_BR's registers
An indirect target of a callbr found the registers holding the asm's
outputs by walking back from the callbr's exported value through COPYs to
the INLINEASM_BR, and asserted that the chain held nothing else ("start of
copy chain MUST be COPY"). An output whose type differs from its register's,
such as a float in a general-purpose register, is converted, e.g. with
MOVDI2SSrr on x86, so the assertion fired. And the target didn't convert the
output to its result type, as visitInlineAsm() does.
After an error in the asm, nothing defines the exported value, so the walk
crashed, and the callbr block kept edges to the indirect targets with no
INLINEASM_BR to branch there, which later passes reject.
Record the registers that the INLINEASM_BR defines its outputs in when
lowering the callbr, and read the outputs from them in the indirect target,
converting each to its result type as visitInlineAsm() does. After an error,
give the indirect targets undefined outputs and no edges from the callbr.
Fixes #98379, #112914, #143795, #170100, #172657, and #173609.
Move a callbr output's operand info and registers into its record
Nothing reads them after the output is recorded, so they don't need to be
copied.
Assisted-by: Claude Opus 5.5
Regenerate callbr tests for inline asm operand counts
Main now prints the operand count of an inline asm operand with more than
one register, such as "regdef:GR32_NOREX2 ops:2" (#235184).
Assisted-by: Claude Opus 5.5
Refer to the recorded callbr outputs through SmallVectorImpl
The code that records them doesn't depend on the inline size.
Assisted-by: Claude Opus 5.5
[SelectionDAG] Report an error for a callbr's indirect register output
An indirect output with a register constraint, e.g. "=*r", is stored to its
pointer after the asm. But a callbr's asm can branch to an indirect target
before then, so the store was silently skipped on the indirect paths. Clang
emits such an output for a _Complex lvalue with a register constraint:
_Complex float c;
asm goto("" : "=r"(c) : : : l);
Report an error instead. A callbr without indirect targets has no such
path, so it's still allowed.
Assisted-by: Claude Opus 5.5
[MachineCSE] Don't reuse an instruction after an INLINEASM_BR elsewhere (#235939)
An INLINEASM_BR can branch to its indirect targets before the instructions
after it in its block run, but MachineCSE let those instructions replace
ones in any block that their block dominates, including the indirect
targets. E.g., when both paths out of a callbr sign-extend its output, the
indirect target reused the extension on the path to the default target and
read a register that its own path never wrote.
Reuse an instruction after an INLINEASM_BR only in its own block. MachineSink
already refuses to sink into an indirect target for the same reason.
Assisted-by: Claude Opus 5.5
[lldb][test] Build and check test inferiors on OpenBSD (#249318)
The API tests could not build any inferior on OpenBSD.
finalize_build_dictionary() has no uname for the openbsd platform, so
every self.build() failed with KeyError: 'openbsd'.
Map openbsd to OpenBSD, and treat OpenBSD like the other BSDs in
Makefile.rules: do not link with -ldl, as OpenBSD has no libdl and
dlopen() is in libc; add the rpath for LLVM_LIBS_DIR; and use lld when
cross compiling from Darwin.
Assisted-by: Claude Opus 5.5
toeplitz: Bound the key by its length
toeplitz_hash() takes the length of the key but read RSS_KEYSIZE bytes
of it whatever that length was: past the end of a shorter key, and not
all of a longer one. Bound it by the length it is given. The callers,
the RSS hash and the multipath hash in in_fib.c and in6_fib.c, all pass
40-byte keys, RSS_KEYSIZE, so nothing changes for them.
toeplitz.c no longer needs <net/rss_config.h>.
Sponsored by: Rubicon Communications, LLC ("Netgate")
[X86][FastISel] Cache import-call-optimization (NFC) (#248155)
`X86FastISel::fastLowerCall()` currently calls
`Module::getModuleFlag("import-call-optimization")` on every 64-bit
call, linearly scanning the `llvm.module.flags` metadata list each time.
Since `X86FastISel` is instantiated per function and module flags do not
change during instruction selection, lazily cache the lookup in a
`std::optional<bool>` on the first 64-bit call (0 lookups for leaf
functions, 1 lookup for call-heavy functions).
Tested locally with `llc -O0 -time-passes` on LLVM bitcode from
`rustc-perf` crates (`ripgrep`, `syn` at `-O0 -g1`): reduces `X86
DAG->DAG Instruction Selection` time by ~2.8% with bit-identical object
output.
Assisted-by: Gemini 4 Neon via Antigravity
[lldb-dap] Move running the server to lldbDAP library. (#248937)
Move running the server out of `lldb-dap.cpp`, so it can be unit tested.
The server now registers only one deadline, and only shutdown if there
are no more clients. instead of creating a new callback for each client
that disconnects.
Merge tag 'firewire-fixes-7.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394
Pull firewire fixes from Takashi Sakamoto:
- Retry page batch allocation on failure
A single call to alloc_pages_bulk() can fall under a specific
configuration with CONFIG_SMP=n. Retry the page batch allocation
in a loop to mitigate such failure
- Fix some error paths
* tag 'firewire-fixes-7.4-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394:
firewire: core: fix use-after-free in build_tree() error path
firewire: core: defer old_rom assignment until kmemdup() succeeds
firewire: ohci: retry page batch allocation in ar_context_init()
firewire: core: retry page batch allocation in fw_iso_buffer_alloc()
py-cloud-init: Fix NTP support on NetBSD.
Patch the default cloud.cfg so that cloud-init knows where its
templates are and add a NetBSD ntp.conf template.
Also taught the NetBSD distro where libexec is. The error message on
the console saying that write-ssh-key-fingerprints can't be found is
now replaced by the ssh key fingerprints. It's not clear that this is
an improvement.