[OpenACC] Don't generate a call to emitStmt if we don't have one. (#215387)
OpenACC assumed that the statement it got when parsing the associated
statement would either be an error or a valid statement. However, there
are some cases where a statement does nothing where we don't bother to
generate a statement object at all. This patch makes the OpenACC codegen
tolerant of that.
Fixes: #215246
[Flang][OpenMP] Generate maps for allocatable components of privatized symbols for target offload (#214015)
Currently we do not generate maps for allocatable components of derived
types for privatized derived type symbols, this can be a problem when
the variable requires initialization from the original copy, as the
device will try to perform initialization and the data will not be
present to do so. This causes a runtime memory access error on device.
Some example code that can trigger this:
type :: btype
real(kind=8),allocatable, dimension(:) :: a
end type
!$omp target teams distribute parallel do firstprivate(b)
This does not apply to pointers as they aren't mandated to be
initialized as allocatables are at the moment I believe when they're
sub-objects. But it does apply to allocatables where initialization and
copy blocks are generated.
[4 lines not shown]
[flang][AIX] Diagnose unsupported OBJECT_MODE setting and -maix32 option (#209919)
This patch is to align flang's default behavior to the other tools in
toolchain on AIX. Flang assumes 32-bit compile by default. The compile
mode can be overridden by setting environment variable OBJECT_MODE=64 or
specifying the -maix64 option.
[CIR] Change the 'inline_kind' enum to have an explicit attribute (#215335)
If we use the builtin automatic inline-kind here, we don't get to have
it printed reasonably/normally. This patch adds the
'genSpecializedAttr=0' and adds an explicit attribute so we print it as
an enum value.
[SandboxVec][Scheduler] Fix false negatives (#211108)
This patch fixes an issue where trySchedule() could return false even
though scheduling was legal. This would happen after a failed
trySchedule(Bndl1) attempt for a bundle that would span a large number
of instructions. Any subsequent trySchedule(Bndl2) for a bundle that
would span fewer instrs than Bndl1 would return false because the
scheduler would not scan the required instructions to add them to the
ready list.
[NVPTX] Make `shortptr` a target ABI (#214112)
Refactor our handling of `shortptr` to make it a proper target ABI
instead of plumbing it through with CLI options.
Assisted by AI.
[clang][OpenMP] Split OMPOrderedDirective into two classes
Now that OMPD_ordered has been replaced with two variants, split
the OMPOrderedDirective class into two classes, one for each
variant.
[clang][OpenMP] Use different ids for block and s/a ORDERED directive
Use OMPD_ordered_blockassoc for the block-associated ORDERED directive,
and OMPD_ordered_standalone for the standalone variant.
This still uses a single AST class for both though. The directive
kind stored in can now take either of the two values.
[LLVMABI] Drop the union arm of bitsContainNoUserData (#213357)
A union whose widest member is narrower than the union itself, such as
one carrying `__attribute__((aligned(16)))`, has its tail padding
classified as user data. The union arm of `bitsContainNoUserData`, which
came in with the System V x86-64 implementation in
[#194718](https://github.com/llvm/llvm-project/pull/194718), computes a
member-relative start offset and then compares it against the absolute
end of the queried range, so an `int` member occupying bits 0 to 32 is
judged to overlap a query over bits 32 to 64, and the recursion that
follows re-queries that member from its own bit 0. The eightbyte then
coerces to `i64` where clang's own ABI code uses `i32`, which the
cross-check in `CodeGenModule::computeABIInfoUsingLib` turns into an
abort on an assertions build.
A union needs no arm of its own. `TypeBuilder::getUnionType` places
every member at offset zero, so the generic field loop already queries
each member over the same range as the union, and a member ending before
that range returns through the size check at the top of the function.
[11 lines not shown]
[Clang][UnsafeBufferUsage] Warn about two-arg string_view constructors. (#214967)
This patch extends the unsafe buffer usage warning to cover
std::string_view constructors that take a pointer and size, similar to
the existing check for std::span.
The warning message has been updated to be generic ('container
construction' instead of 'span construction') and existing tests have
been updated to match.
Reapplys #180471 by @pjalwadi adding a fix for the crash that lead to
the revert in #185692 by @nico.
Fixes #166644
---------
Co-authored-by: Prajwal P J <prajwaljalwadi at gmail.com>
[Flang][OpenMP] Tweak offload tests to work on generic architectures (#215343)
Using the amdgcn arch directly in the object compilation makes these
tests a little unportable, even to some AMD systems e.g gfx942 which
utilises an APU, will fail to find kernels if we compile the additional
include/link file like this. Which is a rather unsual result in itself,
as the extra files don't actually have device code. Regardless, the
extra files are helper utility functions that can be compiled with the
generic command as opposed to a target device command.
The secondary test case is the same, but opting to test another less
restrictive method than using the inbuilt generic command as it does
contain code that in theory is device code via declare target.
[bazel][libc] Fix Darwin syscall header path and missing hardening dependency (#215397)
Fixes two issues in `libc/BUILD.bazel`:
- Update the macOS syscall header path in `__support_osutil_syscall`
from `src/__support/OSUtil/darwin/arm/syscall.h` to
`src/__support/OSUtil/darwin/aarch64/syscall.h`.
- Add `:__support_macros_hardening` to `shared_math_headers_for_apfloat`
dependencies.
[lldb] Search for a corefile's images before loading any of them
A userland or kernel corefile can list hundreds of images, and searching for
one can shell out to a symbol server or fetch over the network. Searching for
them one at a time is where loading such a corefile spends its time.
Add a batch form of SymbolLocator::Locate that runs the searches on the
debugger's thread pool, gated on target.parallel-module-load. Results come
back in the order the requests were given, since that order decides the
Target's module order. Only the results are ordered, and anything a search
reports to the user arrives in whatever order the searches finish in.
Only the plugin searches run concurrently, so a platform hook does not have to
be thread safe to take part, and reading a binary's UUID out of memory stays
on the calling thread.
Setting up a platform binary can replace the Target's platform and dynamic
loader, and now happens for every image before any of them is searched for, so
the platform a corefile asks for is the one all of its images are searched
[4 lines not shown]
[lldb] Consult the platform before the symbol locator plugins (NFC)
A symbol locator plugin has no Platform to consult, so a platform that knows
where its binaries live cannot take part in a search. The only way to reach
one is Platform::GetSharedModule, which also creates the module and registers
it, so the lookup cannot be reused by a caller that wants to search for many
binaries before creating any.
Add a hook that only answers where the files are. An answer ends the search,
so an override owns what the plugins would otherwise have been asked for.
No platform overrides it yet. A follow-up moves PlatformDarwinKernel's kext
and kernel index lookups behind it.
Assisted-by: Claude
[lldb] Add a unified entry point for locating a binary and its symbols
The three-plugin composition that finds a binary and its symbol file is open
coded in several places. Give it one home, as a pure function of a module
spec, so that a caller holding several binaries can search for all of them
before creating any.
Nothing on this path takes a lock, where ModuleList::GetSharedModule holds the
shared module list's lock across the plugin search. That is what will make
searching for several binaries at once worth doing.
A miss that nothing could explain gets its own error type rather than an error
code, because a Status carrying an errno converts to the same llvm::ECError,
and a caller composing its own message for a plain miss must not swallow a
failure to reach a symbol server.
DynamicLoader's search no longer runs twice for a binary that is not already
known, and a module created from a located binary is now registered in the
shared module list, so a second Target asking for the same binary reuses it.
[2 lines not shown]
[RISC-V] Use an optional offset for C/Zc* extension instruction
Add uimm*_optional via OptionalMemOffsetAsmOperand and use it for the
instructions to allow dropping the "(${rs1})" zero-offset aliases.
This commit was prepared with the help of AI.
Reviewed By: topperc
Pull Request: https://github.com/llvm/llvm-project/pull/211674