[test][bazel][libc] Allow LLVM-libc tests to be run in full-build mode
This PR makes the required changes to run LLVM-libc full build tests in Bazel. After this PR, most tests pass:
```
bazel test @llvm-project//libc/test/... --config=ci --@llvm-project//libc:build_mode=full --keep_going
Executed 680 out of 853 tests: 681 tests pass and 172 fail to build.
```
Follow on PRs will fix specific tests that are failing (lots of missing deps etc).
This PR mostly involves propagating the correct dependencies and compiler/linker options from [`add_libc_hermetic`](https://github.com/llvm/llvm-project/blob/4098f568c46e06b6df470111868b4c165dd80f4d/libc/cmake/modules/LLVMLibCTestRules.cmake#L750). Slightly more involved changes:
- `BazelFilePath.cpp` also had to be fixed so that it doesn't depend on the non-namespaced `getenv` function. This PR models after https://github.com/llvm/llvm-project/commit/ee407f7e7069cccfdc1815de07e17cebf83d19f9 in order to conditionally use LLVM-libc's getenv under full-build mode.
- All tests have a dependency against `crt1.o` when run under full-build. This PR updates `merge_relocatable_object` so it also exposes a `CcInfo` with the merged object file and its transitive deps. In order to do so, this PR also makes the logic a little more careful about PIC vs non-PIC deps.
[HLSLSemanticSignatures] Implement the indexed packing of elements (#218061)
Implements the indexed packing algorithm.
Resolves: #205877
Assisted by: Claude Opus 5 and GPT-5.6 Sol
WebAssembly: Drive Emscripten EH from the exception model, drop the cl::opt
Remove the deprecated -enable-emscripten-cxx-exceptions flag. This should now
be driven by the generic exception-model mechanisms. There was also some special
case handling of the -mllvm flag in the clang driver which also needed removal.
Also reverts the test change in b6912258891caefffbf15edb1bceff3724b75af5 now that
the backend doesn't need to be built to test the flag behavior.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
RuntimeLibcalls: Read exception model from the module flag
Source the exception model in the RuntimeLibcallsInfo(Module) constructor
from the "exception-model" module flag via Module::getExceptionModel(),
instead of forwarding it from TargetOptions. An absent flag resolves to
Default and then to the triple default; an explicit "none" disables
exceptions.
Since the model now comes from the module, drop the ExceptionModel that
RuntimeLibraryAnalysis carried and forwarded, and its argument at every
construction site.
To keep the -exception-model= command-line option working for llc and opt
synthesize the "exception-model" module flag from the option as is done for
"float-abi".
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[RISCV] Don't construct a subtarget for function declarations in RISCVPromoteConstant. (#224115)
Intrinsic declarations in particular don't have a target-features
attribute so the subtarget constructor may print warning like:
hard-float 'd' ABI can't be used for a target that doesn't support the D
instruction set extension
This can occur in LTO builds in -mcpu is not passed to the clang driver
on the LTO step. The target-machine won't have any CPU features.
[CIR] Add cir.ptr_mask
`cir.ptr_mask` ANDs a pointer with an integer mask and gives back a
pointer, lowering to llvm.intr.ptrmask. Paired with `cir.ptr_stride` it
rounds a pointer up to an alignment the way classic's
emitRoundPointerUpToAlignment does, without the round trip through an
integer that would lose provenance.
llvm.ptrmask needs the mask at exactly the target's pointer index width,
so the lowering extends or truncates it first. GEP takes an index of
any width, so `cir.ptr_stride` never needed this.
Assisted-by: Cursor / claude-opus-5
[CodeGen] Size live ranges in real instructions
Slot indexes keep counting instructions that earlier passes erased,
because erasing one only clears the pointer in its index list entry.
The leftovers are not spread evenly, so they inflate some live ranges
more than others and reorder greedy's priority queue, spilling heavily
on register-starved functions.
Add SlotIndexes::getRealInstrSpan(), counting only entries that still
have an instruction, and use it for the size getPriority ranks by.
Off by default behind -greedy-size-in-real-instrs.
igbv: Recover disabled Hyper-V transmit queues
The Windows PF can disable a VF transmit queue while continuing to
report carrier up. Link polling alone then leaves the VF operationally
up even though it cannot transmit. The reproduced VLAN failure shows
this state with PF driver 14.1.5.0 and an MDD indication in the host trace.
Check queue zero from the admin path only while the Hyper-V VF is
running with sanitized queues and a completed host handshake. Report
operational link down and invalidate the statistics baseline when the
queue is disabled. Request recovery through the normal iflib stop/init
path only when a fresh, accessible STATUS read reports carrier up.
Rate limit requests if the host continues to hold the queue disabled,
and leave recovery pending while carrier is down.
Document the recovery behavior and clarify why the Hyper-V reset retains
the VF-local software reset before its host reset/MAC exchange.
Sponsored by: BBOX.io
[RISCV] Use template PredicateMethod for ImmAsmOperand when suffix is empty. NFC (#224098)
This allows us to remove forwarding wrappers from RISCVAsmParser.cpp.
Assisted-by: Claude
lldb: Require x86_64 for x86_64-specific NativePDB tests
These tests contained x86_64 datalayout and triples, but only
required system-windows. On an aarch64 windows host, %build will
be an incompatible datalayout, so require exactly x86_64 windows
hosts. Alternatively the test could be changed to not have the
datalayout, but I'm not sure if that's correct here.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[CIR] Accept a union whose members do not cover its declared size (#223594)
`union { unsigned Words[3]; void *Ptr; }` is 16 bytes because the
pointer's alignment rounds it up, and no member covers that size. The
pass refused to classify unions like that at all, so anything holding
one failed to compile. Tail padding doesn't change how an eightbyte
classifies, so this drops the precondition and classifies the union from
its own size.
[CI] Make updates to .ci actually test everything (#224125)
We ran into an issue where test failures in cross-project-tests were not
surfaced when bumping the image to Ubuntu 26.04 due to the script not
correctly calculating dependencies for changes to .ci and the premerge
workflow. This patch fixes that by ensuring the projects executed for
.ci/workflow changes are derived from everything else which means we do
not need to manually maintain the list and risk leaving it out of date.
[CAS] Read a CAS file's reserved size from st_blocks, not st_blksize (#224104)
FileSizeInfo reports how much disk a file already has, which
MappedFileRegionArena records so it knows how far ahead it has reserved.
However the file size was accidentally computed from st_blksize which is
the preferred I/O size, not the number of allocated blocks for the file.
The value is read when a database is created or reopened, so a reopened
database believed almost none of its disk was reserved and reserved it
again from near zero, a megabyte per allocation. Fix the problem by
using the correct size.
[WebAssembly] Use Single as the default Triple thread model (#223917)
Clang defaults WebAssembly to a single-threaded model unless atomics and
bulk-memory are enabled, whereas Triple::getDefaultThreadModel()
previously defaulted to POSIX for all targets. Because Clang only emits
the "thread-model" module flag when the active thread model differs from
the triple's default, single-threaded Wasm objects recorded
"thread-model"="single" while multithreaded objects omitted the flag.
When linking mixed objects in LTO, the merged module inherited "single",
causing passes like LICM and AtomicExpand to treat multithreaded
programs as single-threaded.
Change Triple::getDefaultThreadModel() to return ThreadModel::Single for
WebAssembly so that multithreaded objects explicitly record
"thread-model"= "posix" and single-threaded objects omit the flag.
Additionally, update WebAssemblyCoalesceFeaturesAndStripAtomics to set
the module thread model to POSIX when threading features are enabled and
no explicit module flag is present, ensuring backend passes like
AtomicExpandPass preserve atomics in raw IR modules compiled via llc.
Assisted-By: Gemini
[scudo] Do not trim the secondary cache if releasing is disabled. (#223881)
When the ReleaseInterval is set to less than zero, then releasing has
been disabled. In this case, honor this and do not trim the cache using
the MaxCacheResidentyBytes value.
Add a test to verify this behavior.