[BPF] Fix printing of unsigned 32-bit enum values in CO-RE relocations (#249079)
llvm-objdump shows the value of an enumerator in an enumval relocation.
The value of a 32-bit enumerator, BTFEnum::Val, is int32_t and was
always sign-extended, so a value of an unsigned enum in [0x80000000,
0xffffffff] was printed as a huge 64-bit value:
```
enum U { M = 0x80000000 };
... __builtin_preserve_enum_value(*(enum U *)M, 1) ...
CO-RE <enumval_value> [4] enum U::M = 18446744071562067968
```
Extend the value according to the signedness of its enum, i.e.,
sign-extend it if ENUM_SIGNED_FLAG is set, and zero-extend it otherwise:
```
CO-RE <enumval_value> [4] enum U::M = 2147483648
```
[CIR] Add inbounds and nuw flags to cir.ptr_stride (#249016)
[CIR] Add inbounds and nuw flags to cir.ptr_stride
CIR lowered pointer arithmetic and strides to a `getelementptr` with no
no-wrap flags, where classic codegen marks most of them `inbounds`, and
also `nuw` for an unsigned index that is added.
`cir.ptr_stride` now has the same optional inbounds and `nuw` flags as
`cir.get_element`, and LowerToLLVM maps them to the GEP's no-wrap flags.
NOTE: Most changes are missing inbounds in our tests, and were added by
claude
all of those make sense to me.
[InstCombine] Skip vector loads in foldCmpLoadFromIndexedGlobal (#248330)
This patch fixes https://github.com/llvm/llvm-project/issues/248279.
This fold tracks one boolean per index and produces a scalar i1. When
the constant offset equals the size of the global, there are no elements
to scan, so the fold tries to replace a vector comparison with scalar
false. So just bail out early for vector loads. By the way, this crash
was exposed by https://github.com/llvm/llvm-project/pull/222574.
Assisted-by: OpenAI Codex
[Support][Haiku] Use the app image path in getMainExecutable() (#246810)
On Haiku getMainExecutable() only searched for argv[0]. Callers such
as LibTooling pass a placeholder ("clang_tool"), so the lookup failed
and tools like clang-tidy could not find the Clang resource directory.
Get the path of the app image from get_next_image_info() instead.
https://github.com/haikuports/haikuports/issues/15124
[AMDGPU] Add an intrinsic and builtin to access the dispatch index
This PR adds an intrinsic (and corresponding builtin and MLIR
operation) for accessing the dispatch index on gfx12+, since it can be
needed in some low-level contexts.
AI disclosure: None, I did this by hand
[AMDGPU] Refactor wave ID intrinsic handling and expose a Clang builtin (#247799)
This PR refactors how the architecture-provided wave ID on gfx12 is
exposed, including by generalizing its lowering in preparation for
adding a dispatch.index intrinsic.
This PR also annotates the wave-id intrinsic with `TargetFeatures`,
meaning that it no longer is a selection failure to use it on a target
without the architected SGPRs feature, but a failure earlier in the
pipeline.
In addition, this PR exposes this id as __builtin_amdgcn_wave_id() in
Clang, matching MLIR, and adds documentation that clarifies the
properties of the ID.
AI disclosure: None, I did this by hand
[CI] Check Linux premerge build dependencies with Ninja
Run missingdeps at the end of monolithic-linux.sh, after project checks
and both runtime reconfigurations, so compiler dependencies have been
recorded. Include the selected check targets alongside all.
Use start-group to give the check a named log section, and capture its
output in ninja_missingdeps.log for artifact collection. Keep the check
in the shared Linux build script rather than a GitHub-only workflow
step.
Validated shell syntax, workflow YAML, and a whole-script harness with
real Ninja dependency checks. The check runs after all build phases,
records diagnostics, fails for a missing generator dependency, and
passes when that dependency is declared.
Assisted-by: Codex
[LLVM][CMake] Order generated analysis headers for pass plugins
The example and unit-test pass plugins include TargetLibraryInfo.inc
through LLVM analysis headers. They rely on the host process for LLVM
symbols, so their compile steps need an explicit analysis_gen
prerequisite.
Add analysis_gen alongside intrinsics_gen and express the unit plugins'
prerequisites on their library declarations. With the machine pass
manager include pruning in the preceding commit, these plugins no longer
include GenVT.inc and do not need vt_gen.
Validated a fresh build of all six plugin objects with precompiled
headers disabled and GenVT.inc absent. Their recorded dependencies still
include TargetLibraryInfo.inc, and ninja -t missingdeps is clean.
Assisted-by: Codex
[LLVM] Prune machine IR includes from pass manager interfaces (#249025)
Move MFPropsModifier into its own header and include it at its use
sites,
So MachinePassManager.h no longer needs to include MachineFunction.h.
This removes many dependencies on vt_gen which was needed for a
transitive tablegen generated header from codegen.
Assisted-by: Codex
[mlir][MemRefToLLVM] Don't assert on non-integer memory spaces of unranked memrefs (#247338)
The lowerings of memref.dealloc and
memref.extract_aligned_pointer_as_index build the element pointer type
of an unranked memref with getMemorySpaceAsInt(). That accessor asserts
on any memory space that is not a plain integer, for example
#spirv.storage_class<StorageBuffer>, and --finalize-memref-to-llvm
aborts. Ranked memrefs don't get this far because their type conversion
already fails on such a memory space, but an unranked memref always
converted to {index, ptr} and nobody looked at its memory space.
Make convertUnrankedMemRefType fail when the memory space has no integer
address space, with the same error as for ranked memrefs, so the
patterns don't run on such operands at all. structFuncArgTypeConverter
returned the descriptor fields of an unranked memref without converting
the type, so it needs the same check, otherwise the function signature
still converts and packing the argument crashes on the null type. This
also fixes that crash for an unranked memref whose element type does not
convert.
[17 lines not shown]
linuxkpi: sleep at least the requested time
msleep(), usleep_range() and msleep_interruptible() passed C_HARDCLOCK
to pause_sbt(), which measures the timeout from the last hardclock
tick, so they could return up to a tick early. Linux guarantees the
minimum.
Approved by: adrian
Differential Revision: https://reviews.freebsd.org/D62181
uplcom: write the baud rate directly on PL2303HXN
uplcom encodes a divisor for any rate that is not in its table. The
PL2303HXN (G series) does not take divisors, so output stalled at such
rates. Linux writes the rate directly for these chips.
Differential Revision: https://reviews.freebsd.org/D62460
[Clang][Object][SYCL][CUDA] Add --[no-]offload-embed-virtual-arch (#242407)
Add `--[no-]offload-embed-virtual-arch` for SYCL and CUDA.
A SYCL device image compiled ahead of time for Intel GPUs keeps the
SPIR-V by default, so it can still run on other GPUs of the same IGCA
target. `--no-offload-embed-virtual-arch` drops it. `-Xarch_<IGCA
target>`, e.g. `-Xarch_igca_40r --no-offload-embed-virtual-arch`,
applies it to one IGCA target only. If `--offload-arch` also names the
IGCA target itself, e.g. `--offload-arch=xe-mtl-u,igca_30r`, the SPIR-V
for that target is kept. If nothing is compiled ahead of time for an
Intel GPU, clang warns that the option is unused.
The driver records `embed-virtual-arch=0` on the device image.
clang-linker-wrapper passes `--no-embed-virtual-arch` to
clang-sycl-linker when every non-generic device image asks for it, and
otherwise keeps the virtual architecture code and warns.
clang-sycl-linker then passes `-exclude_ir` to ocloc.
[2 lines not shown]
Add support for composite ML-DSA 87 / ECDSA p384 signatures
based on draft-ietf-sshm-composite-sigs-01 as "ssh-mldsa87-p384"
with the corresponding "ssh-mldsa87-p384-cert" certificate type
Not yet enabled by default.
ok markus
[CI] Check Linux premerge build dependencies with Ninja
Run missingdeps at the end of monolithic-linux.sh, after project checks
and both runtime reconfigurations, so compiler dependencies have been
recorded. Include the selected check targets alongside all.
Use start-group to give the check a named log section, and capture its
output in ninja_missingdeps.log for artifact collection. Keep the check
in the shared Linux build script rather than a GitHub-only workflow
step.
Validated shell syntax, workflow YAML, and a whole-script harness with
real Ninja dependency checks. The check runs after all build phases,
records diagnostics, fails for a missing generator dependency, and
passes when that dependency is declared.
Assisted-by: Codex
[LLVM][CMake] Order generated analysis headers for pass plugins
The example and unit-test pass plugins include TargetLibraryInfo.inc
through LLVM analysis headers. They rely on the host process for LLVM
symbols, so their compile steps need an explicit analysis_gen
prerequisite.
Add analysis_gen alongside intrinsics_gen and express the unit plugins'
prerequisites on their library declarations. With the machine pass
manager include pruning in the preceding commit, these plugins no longer
include GenVT.inc and do not need vt_gen.
Validated a fresh build of all six plugin objects with precompiled
headers disabled and GenVT.inc absent. Their recorded dependencies still
include TargetLibraryInfo.inc, and ninja -t missingdeps is clean.
Assisted-by: Codex
[acc][flang] Add acc::CallLikeOpInterface for whether a call captures an address (#247798)
`acc::CallLikeOpInterface::isAddressNotCaptured(tracked, address)` is
true when this call receives address and cannot use the storage of
tracked after it returns. The default is false, so the address may be
kept.
This replaces `OpenACCSupport::isAddressNotCapturedByCalls`. That method
stays for now and will be removed in a later MR, when the callers switch
to this interface.
`fir.call` implements it when address is an argument, the callee is a
Fortran source procedure (bind(c), a procedure symbol, or a callee whose
fir.internal_name is a procedure), and tracked is a Fortran user
variable that is not TARGET or POINTER, not host-associated, not
captured by an internal procedure, and not asynchronous or volatile. An
indirect call does not qualify.
`fir.dispatch` implements it for its object and its arguments. A
dispatch is a type-bound procedure, so it has no callee check. The
variable check is the same.
[Flang][CMake] Fix header dependencies and binding header copies (#249115)
Add missing dependencies, caught by #248842
ISO_Fortran_binding.h was copied at cmake configued, with logic to add a
.phony target to represent the header, and re-trigger cmake
configuration when the header changed.
Unfortunately this phony target makes it look like materializing the
header happens as part of the build, which is then flagged by `ninja -t
missingdeps` as missing an explicit dependency from the users of the
header.
We can perform the copy at build time instead, removing the requirement
to configure cmake on changes to the header, and making the build graph
more "correct" by making the materialization of the header part of the
"flang-headers".
Assisted-by: Codex