[mlir][ODS] Include headers declaring used type and attribute constraints
#236155 added `cppIncludes` to traits and interfaces so that generated
declarations include the headers of the traits they use.
Extend `cppIncludes` to type and attribute constraints. It lists the C++
headers declaring the C++ classes a constraint refers to. A single header is
not always enough: e.g. `TypeAttrOf<T>` needs `BuiltinAttributes.h` and the
header of `T`. Generated op
declarations now include the headers of the constraints of their operands,
results and attributes, and generated attribute and type declarations
include the headers of attribute and type parameters.
The builtin type and attribute constraints and the builtin dialect
attributes, types and locations set their headers, as do the base classes of
dialect attributes and types.
Co-authored-by: Claude <noreply at anthropic.com>
[Offload][NFC] Plugin Interface clean-up (#240434)
Remove dead code, unnecessary headers, and fix one comment that
references the wrong routine.
Static code analysis done by Claude.
[SPIRV] Declare command line options in TableGen (#239474)
Move the cl::opts into SPIRVOptions.td. SPIRVTargetMachine holds `const
SPIRVOptions &CLOpts`, and SPIRVSubtarget copies it.
SPIRVCtorDtorLowering and SPIRVRemoveUnusedResources have no
TargetMachine and read the LLVMContext. SPIRVFPContractMode moves to
SPIRVSubtarget.h.
-spirv-ext becomes a StringRef that SPIRVSubtarget parses, so a
malformed value is now a fatal usage error when the target machine is
created rather than an option parsing error, and the disabled extension
set moves from a static into SPIRVSubtarget.
Rename -avoid-spirv-capabilities to -spirv-avoid-capabilities,
-translator-compatibility-mode to -spirv-translator-compatibility-mode,
and -disable-spirv-remove-unused-resources to
-spirv-enable-remove-unused-resources, keeping the old spellings as
aliases.
[2 lines not shown]
[OpenACC] Fix iterator-type lookup when kind is incomplete (#240424)
OpenACC loop needs to have a random access iterator, and does some
heroics to look into the 'iterator_category' to check for this. It ALSO
checks whether the type referred to in the iterator_category inherits
from std::random_access_iterator.
However, it was failing to make sure it was a definition before checked
for base classes, leading to an assert.
This patch adds that check, which will make a iterator category
incomplete type not attempt to check the 'base' class.
Fixes: #239962
SafeStack: Take libcall declarations from RuntimeLibcallsInfo
Stop declaring __stack_chk_fail and __safestack_pointer_address
manually and construct them with the correct type automatically.
A function with the variable's name is now reported as not being a
global variable, rather than a renamed copy of the variable being
inserted. -safestack-use-pointer-address now requires
__safestack_pointer_address to be available for the target, instead of
unconditionally emitting a call to it. The tests using it on
non-Android triples move to Android.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
RuntimeLibcalls: Add helper methods to insert declarations
Add methods to get or insert the declaration of a libcall
implementation in a module with the appropriate type and
annotations. A (potentially incorrectly declared) global that already
has the name is returned unmodified
Use them in DeclareRuntimeLibcalls, which no longer merges attributes
into or replaces the calling convention of existing functions, and no
longer crashes on a global variable with the name of a libcall
function.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[clang] Call getOrCreateFile() just once in AddStringLiteralDebugInfo() (#240382)
getOrCreateFile(Loc) is stored in a variable `File` 3 lines up,
so use that variable instead of calling the function again.
Mostly for code cleanliness, but for usb_ids_gen.cc (from #229808)
this is also a small (0.4%) reduction in retired instructions.
No behavior change.
[libcxx] Switch to llvm-premerge-linux-4-runners for benchmarking (#239065)
These are smaller so take up less resources when we only run benchmarks
on a single thread and they are also c2d vs n2/n2d which means that we
get exclusive cores rather than GCP overcommit.
Fixes #236840
[libc] Reland "Implement copy_file_range in unistd" (#240018)
This patch relands #236914 (reverted in #238956 / commit 53d0afa56861).
### Root Cause & Fix
The revert was caused by pre-commit CI failures where
`copy_file_range_test` encountered environments lacking
`copy_file_range` syscall emulation or running on container overlay
filesystems:
- Emulators return `EFAULT` or `ENOSYS` instead of `EBADF` on invalid
descriptors with `nullptr`.
- Container overlayfs / older kernels may return `EXDEV`, `ENOSYS`, or
`EOPNOTSUPP`.
### Changes in Reland
- Update `InvalidArgs` in `copy_file_range_test.cpp` to accept
`any_of(EBADF, EFAULT, ENOSYS)`.
- Gracefully handle `ENOSYS`, `EXDEV`, and `EOPNOTSUPP` in test copy
cases.
[4 lines not shown]
[LTO][NFC] Use runCodeGenPipeline
This abstracts across the LegacyPM and the NewPM. We add a new optional
parameter to runCodeGenPipeline to take in a ModuleSummaryIndex to
properly handle pipeline setup.
Reviewers: aengelke, teresajohnson
Pull Request: https://github.com/llvm/llvm-project/pull/240252
[NFC][ThinLTO] Use runCodeGenPipeline abstraction (#240226)
This makes the code slightly simpler by moving to a canonical
abstraction and also abstracts between the LegacyPM/NewPM without
additional handling specific to ThinLTO.
arm64 pmap: combine L3C accessed bits in pmap_mincore()
The accessed bit may be set in only some of an L3C superpage's L3
PTEs. However, when pmap_mincore() found an L3C mapping, it reported
the accessed state of the specified L3 PTE only, so mincore(2) could
fail to report MINCORE_REFERENCED for an L3C superpage that had been
accessed. When the accessed bit is not set in the specified entry, use
pmap_load_l3c() to combine the accessed bits from all of the L3C
superpage's L3 PTEs.
Found by: Claude Code (Opus 5.5)
MFC after: 1 week
[lldb] Interrupt the read thread when stopping it
ThreadedCommunication::StopReadThread clears m_read_thread_enabled and
joins the read thread, which checks that flag only once its read
returns. When no data comes, the read returns only when it times out,
after five seconds.
Before lldb reports that a process it launched has exited or that it
detached from the process, it stops the read thread of the process's
terminal. A process that lldb detaches from usually keeps running, and
if it does not write to its terminal, the detach takes five seconds.
StopSTDIOMonitoring closes lldb's own descriptor for the secondary side
of the terminal first, but that ends the read only once the process has
closed its descriptors too. Meanwhile, debugserver or lldb-server exits,
and since the process is not detached yet, ProcessGDBRemote gives it an
exit status, so lldb reports that the process exited.
Interrupt the read after clearing the flag, as SynchronizeWithReadThread
does. A connection reports an interrupt only when no data is pending,
[3 lines not shown]
[CIR][SYCL] Fix null value emission in local addrspace for AMD and NVPTX targets (#237387)
Fixes null value emission bug in local address space for AMDGPU and
NVPTX targets. This is needed to port the following 2 tests from clang
CodeGenSYCL to CIR CodeGenSYCL:
- amd-address-space-conversions.cpp
- cuda-address-space-conversions.cpp
[SCEV] Drop redundant umax when applying signed lower-bound guards. (#237779)
When applying a guard From s>= RHS with a non-negative constant RHS,
From u>= RHS holds as well. If From has already been rewritten to
umax(C, From) with C u<= RHS, the umax is redundant and can be dropped.
This avoids losing range information, as the range of umax(C, From) may
be much less precise than the range of From when using SMax.
More precise range enables additional unrolling end-to-end
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1923.
PR: https://github.com/llvm/llvm-project/pull/237779