[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
[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
[lldb][test] Build PDB test inferiors with column info (#238604)
Clang emits columns into DWARF line tables by default but leaves them
out of `CodeView` unless `-gcolumn-info` is passed, so pdb test
inferiors have no columns.
This patch passes `-gcolumn-info` for `MAKE_PDB` builds.
Fixes `TestBreakOnCPP11Initializers`, `TestStepThroughTrampoline` and
`TestStructuredBinding` with PDB debug info.
rdar://191741281
hwpmc: release a PMC whose ID could not be copied out
If copyout of the newly allocated PMC ID fails, the caller cannot use or
release the PMC. Release it in the kernel.
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: Advanced Micro Devices, Inc.
Differential Revision: https://reviews.freebsd.org/D60562
(cherry picked from commit e5a48c8e0dd026ba953cf401c4dec02f76078aa2)
pmc(8): zero-initialize the event descriptor in stat mode
cmd_pmc_stat allocated the event descriptor with malloc and then set
only some of its fields, so the rest held whatever was on the heap.
Use calloc() instead.
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: AMD
Signed-off-by: Andre Silva <andasilv at amd.com>
Differential Revision: https://reviews.freebsd.org/D59364
(cherry picked from commit a97914284c2e7a7dc330f4d93218e8d7f1e758b2)
[SelectionDAG] Add selectShiftAmountMask and use it for RISC-V (NFC) (#240214)
Many targets drop a shift-amount AND that keeps every bit the shift
reads, each with its own code. This moves RISC-V's version into
`SelectionDAGISel::selectShiftAmountMask` so other targets can share it.
X86 uses it next, for #199697.
The helper looks through one truncate and an AND whose constant, with
known-zero bits, keeps the low Log2(width) bits. It sets the output only
on success. It ignores other users of the AND, so each target decides
that.
RKSimon suggested a TableGen-level fix in #199697. This shares the C++
selector behind target ComplexPatterns instead.
RISC-V output does not change.
Assisted-by: Claude Opus 5.5
pmc(8): zero-initialize the event descriptor in stat mode
cmd_pmc_stat allocated the event descriptor with malloc and then set
only some of its fields, so the rest held whatever was on the heap.
Use calloc() instead.
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: AMD
Signed-off-by: Andre Silva <andasilv at amd.com>
Differential Revision: https://reviews.freebsd.org/D59364
(cherry picked from commit a97914284c2e7a7dc330f4d93218e8d7f1e758b2)
hwpmc: release a PMC whose ID could not be copied out
If copyout of the newly allocated PMC ID fails, the caller cannot use or
release the PMC. Release it in the kernel.
Reviewed by: mhorne
MFC after: 3 days
Sponsored by: Advanced Micro Devices, Inc.
Differential Revision: https://reviews.freebsd.org/D60562
(cherry picked from commit e5a48c8e0dd026ba953cf401c4dec02f76078aa2)