[RISCV] Preserve call-preserved reg mask for LPAD-aligned calls (#210868)
RISCVISelDAGToDAG's lowering of RISCVISD::LPAD_CALL / LPAD_CALL_INDIRECT
to PseudoCALLLpadAlign / PseudoCALLIndirectLpadAlign (introduced in
#177515) only copied the callee, lpad label, chain, and glue operands,
dropping the argument-register and register-mask operands in between.
Without the register-mask operand, the register allocator treats these
calls as clobbering nothing but ra, so values live across the call are
not spilled/reloaded even though the callee is free to clobber
caller-saved registers. This caused a miscompile where a pointer held
live across a call to getcontext() (a returns_twice function) was
corrupted after the call returned, leading to a SIGSEGV in
llvm-test-suite's siod test.
Fix the operand copy to include the argument-register and register-mask
operands, matching the pseudo-instruction operands of a regular
PseudoCALL/PseudoCALLIndirect.
Signed-off-by: Jerry Zhang Jian <jerry.zhangjian at sifive.com>
[DebugInfo] Fix Fortran 2018 default array lower bound (#210885)
The [DWARF language registry](https://dwarfstd.org/languages.html)
defines the default array lower bound for `DW_LANG_Fortran18` as one,
but LLVM records it as zero. Update the language table to match the
registry.
[dsymutil] collect pseudoprobe sections from debug map into __LLVM segment (#206817)
Introduce a new `PseudoProbeLinker` in `dsymutil` that collects
`__probes/__probe_descs` sections from the debug map objects and merges
the sections and places the probes metadata under
`Contents/Resources/Profiling/{pseudo_probes[-<arch>],pseudo_probe_descs[-<arch>]}`
respectively.
[DebugInfo] Update assigned DWARF language codes (#210884)
Update LLVM's DWARF language tables to match the current
[`DW_LANG_*`](https://dwarfstd.org/languages.html) and
[`DW_LNAME_*`](https://dwarfstd.org/languages-v6.html) registries.
Add the missing `DW_LANG_*` and `DW_LNAME_*` constants, update the
corresponding language-version mappings, and expose the new `DW_LANG_*`
codes through the LLVM C API.
[OpenACC] Accept funcs with `acc.specialized_routine` in `acc::isValidSymbolUse` (#211111)
`ACCRoutineLowering` generates device side specialized version of
routines that have the `acc.specialized_routine` attribute. Those are
expected to be offloaded and therefore are valid symbol uses.
Assisted-by: Claude Code
Pull up following revision(s) (requested by riastradh in ticket #393):
libexec/ld.elf_so/search.c: revision 1.30
libexec/ld.elf_so/xmalloc.c: revision 1.28
libexec/ld.elf_so/tls.c: revision 1.30
libexec/ld.elf_so/tls.c: revision 1.31
libexec/ld.elf_so/search.c: revision 1.29
ld.elf_so: Fix assertion: obj may be NULL _or_ OBJ_ERR (-1) here
NULL means the object wasn't found and we should keep searching;
OBJ_ERR means the object was found but loading it failed and we
should stop. Only if the object is _neither_ NULL _nor_ OBJ_ERR is
it expected to be an object with positive refcount.
Followup for
PR lib/59751: dlclose is not MT-safe depending on the libraries
unloaded
[43 lines not shown]
[SBVec] Add top-down vectorization to the unified Sandbox Vectorizer
Extend the Sandbox Vectorizer's `bottom-up-vec` pass so a single
implementation can vectorize in either direction, and add the top-down
strategy that walks def-use chains forward from a seed.
Direction selection
--------------------
The pass direction is chosen from the Region's auxiliary pass argument:
"bottom-up" (or empty, the default) and "top-down" map onto a
SchedDirection, and any other value is rejected with a fatal usage error.
The vectorizer always runs in the same direction as the scheduler.
Top-down traversal
------------------
Bottom-up starts from a seed slice (e.g. stores to consecutive addresses)
and recurses into operands. Top-down instead starts from a seed of
consecutive loads and recurses into *users*:
[32 lines not shown]
[SBVec] Refactor BottomUpVec pass for clarity and maintainability
- Corrected comments to clarify the direction of def-use and use-def chains.
- Changed the initialization of the SchedDirection variable to improve clarity.
- Updated documentation in vectorizeRec() to better describe the purpose of UserBndl.
- Removed outdated TODO comment regarding top-down vectorization scheduling.
[LoopInfo] Factor use-scan of isBlockInLCSSAForm [NFC] (#211087)
[Factored out of llvm/llvm-project#151062 by review request; AI
Disclosure: Done by Claude]
Split the per-use logic of isBlockInLCSSAForm into a separate helper
that answers whether a single use of a value defined in a loop is
contained within the loop for LCSSA purposes.
[RISCV] Avoid forming Zilsd pairs with x0 for non-x0 register classes (#211019)
The pre-RA Zilsd optimizer allowed a pair when both stored values came
from the same virtual register if that virtual register was defined by a
copy from X0. This is only valid when the virtual register class can
actually contain X0.
Check the virtual register class before treating the value as `x0_pair`.
This prevents forming an invalid paired store for register classes such
as `GPRNoX0`.
Without this change we were hitting the following assertion in
`RISCVLoadStoreOptimizer`:
```
assert(
FirstReg != SecondReg &&
"First register and second register is impossible to be same register");
```
[orc-rt] Run controller-call continuations from Session (#211166)
A controller call's on-complete handler may run managed code, so it must
be dispatched by the Session under a ManagedCodeTaskGroup token, not
invoked directly by the ControllerAccess (which previously held it as a
plain callable and called it itself -- untokened and undispatched).
Wrap it in an opaque ControllerAccess::OnControllerCallReturn that
implementations can hold but not call. They complete it via exactly one
of three Session-provided paths:
- handleControllerCallResult -- the controller returned a result;
dispatches the handler under a fresh token. Asserts the managed-code
group is still open (i.e. before notifyDisconnected).
- failPendingControllerCall -- an already-enqueued call is failed
because the connection dropped before a result arrived (the disconnect
drain); dispatches the handler under a token with a disconnect error.
[10 lines not shown]
[NVPTX] Fix illegal .ftz modifier for setp and neg PTX instructions for bf16 (#211128)
This patch disables emitting .ftz modifier for bf16 and bf16x2 type setp
and neg instructions, the PTX ISA does not specify this modifier for the
same. FNEG_H already correctly handles fneg for bf16, so remove the
redundant bf16 FNEG16 pattern.
Fix DSA isolation for metadirective loop variants
Keep data-sharing state local to each metadirective replacement during name
resolution. This prevents an explicit clause or default rule in one dynamic
candidate from affecting another candidate or the associated loop body.
Preserve explicit lastprivate when marking a selected loop induction variable.
Also enable nested data-environment and loop replacements now handled by the
Part 3 lowering path, replacing their TODO tests with lowering coverage.
Assisted with codex.
[RISCV] Support uimm5 operands for Xqcicm cmovs in RISCVExpandPseudoInsts (#210955)
`expandCCOpToCMov` was only accepting signed 5-bit immediates before
forming `Xqcicm` conditional-move pseudos. Valid `uimm5` operands for
unsigned compare forms such as `QC_MVGEUI` and `QC_MVLTUI` were not
being handled leading to a crash.
Track whether the selected conditional-move opcode expects a signed or
unsigned immediate, and validate the RHS against the matching range.
[clang] Switch to Default PIE on FreeBSD (#206139)
We have started to compile the binary in our base as PIE by defualt. It
makes sense to compile the binary to PIE by default in toolchain as
Linux now. Also, extended testcases to support default PIE and no-pie
parameter in freebsd.c and hip-fpie-option.hip.
[BOLT] Implement platform independent distribution and shuffle algorithm (#206554)
std::uniform_int_distribution and std::shuffle are
implementation-defined, so binary built with libc++ and libstdc++ can
produce different fragment layouts when using SplitStrategy. In this
case, the FreeBSD build emits only one fragment instead of three.
The output geenrate by --bolt-seed should be deterministic for the same
binary regardless of the standard library implementation. Implement a
portable shuffle and uniform distribution to guarantee identical results
for a given seed.
After this change, we generate 1 fragment, which decrease the strength
of the testcase. As a result, we change the seed to different value to
allow it generate different number of fragments.
Also, replace in-place file modifcation with a write-and-replace
approach for better portability in sed.