LLVM/project cfcdf93

[bazel][libc] Update path to syscall.h for darwin aarch64 (#215399)

This file was moved in bfd7024b0d665de02abbfc7b16f593020d2c12c9.
DeltaFile
+0-00 files

LLVM/project 7fe69beclang/lib/CIR/CodeGen CIRGenStmtOpenACCLoop.cpp CIRGenStmtOpenACC.cpp, clang/lib/CodeGen CodeGenFunction.h

[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
DeltaFile
+24-0clang/test/CodeGen/openacc-invalid-stmt.cpp
+12-6clang/lib/CodeGen/CodeGenFunction.h
+6-3clang/lib/CIR/CodeGen/CIRGenStmtOpenACC.cpp
+2-1clang/lib/CIR/CodeGen/CIRGenStmtOpenACCLoop.cpp
+44-104 files

LLVM/project 66a11b2clang/lib/StaticAnalyzer/Checkers LifetimeModeling.cpp

Clean up dead symbols.
DeltaFile
+6-0clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.cpp
+6-01 files

LLVM/project 5bb2565flang/lib/Optimizer/OpenMP MapsForPrivatizedSymbols.cpp, flang/test/Transforms omp-maps-for-privatized-symbols.fir

[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]
DeltaFile
+44-1flang/test/Transforms/omp-maps-for-privatized-symbols.fir
+24-1flang/lib/Optimizer/OpenMP/MapsForPrivatizedSymbols.cpp
+68-22 files

LLVM/project 8045b02clang/include/clang/Basic DiagnosticDriverKinds.td, clang/lib/Driver Driver.cpp

[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.
DeltaFile
+35-12clang/lib/Driver/Driver.cpp
+28-0flang/test/Driver/aix-object-mode.f90
+5-5flang/test/Driver/m32-option.f90
+2-3flang-rt/test/lit.cfg.py
+4-0flang/test/lit.cfg.py
+3-0clang/include/clang/Basic/DiagnosticDriverKinds.td
+77-206 files

LLVM/project 1cbfd51clang/include/clang/CIR/Dialect/IR CIROps.td CIRAttrs.td, clang/lib/CIR/Dialect/IR CIRDialect.cpp

[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.
DeltaFile
+24-0clang/test/CIR/IR/invalid-call.cir
+8-8clang/test/CIR/CodeGen/callsite-inline-attributes.cpp
+16-0clang/test/CIR/IR/inline-attrs.cir
+11-2clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
+2-2clang/include/clang/CIR/Dialect/IR/CIROps.td
+1-0clang/lib/CIR/Dialect/IR/CIRDialect.cpp
+62-126 files

LLVM/project 71cc370clang/lib/StaticAnalyzer/Checkers LifetimeModeling.h

Update doc comment for markAsReported.
DeltaFile
+2-2clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.h
+2-21 files

LLVM/project 2ad7d47llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer Scheduler.h, llvm/lib/Transforms/Vectorize/SandboxVectorizer Scheduler.cpp

[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.
DeltaFile
+34-1llvm/unittests/Transforms/Vectorize/SandboxVectorizer/SchedulerTest.cpp
+12-6llvm/include/llvm/Transforms/Vectorize/SandboxVectorizer/Scheduler.h
+9-3llvm/lib/Transforms/Vectorize/SandboxVectorizer/Scheduler.cpp
+55-103 files

LLVM/project c2cd1ffclang/lib/StaticAnalyzer/Checkers LifetimeModeling.h DanglingPtrDeref.cpp, clang/test/Analysis dangling-ptr-deref.cpp

[analyzer] Only report the first dereference of the same variable in DanglingPtrDeref
DeltaFile
+13-0clang/test/Analysis/dangling-ptr-deref.cpp
+8-0clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.cpp
+6-0clang/lib/StaticAnalyzer/Checkers/DanglingPtrDeref.cpp
+5-0clang/lib/StaticAnalyzer/Checkers/LifetimeModeling.h
+32-04 files

LLVM/project 40001fdclang/include/clang/Options Options.td, clang/lib/Basic/Targets NVPTX.cpp

[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.
DeltaFile
+12-12llvm/test/CodeGen/NVPTX/clusterlaunchcontrol-multicast.ll
+4-10llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
+9-3clang/lib/Basic/Targets/NVPTX.cpp
+5-3clang/test/Driver/cuda-short-ptr.cu
+3-3clang/include/clang/Options/Options.td
+2-2llvm/test/CodeGen/NVPTX/tcgen05-commit.ll
+35-3345 files not shown
+116-11551 files

LLVM/project 86410eaclang/lib/Parse ParseOpenMP.cpp, flang/lib/Parser openmp-parsers.cpp

[OpenMP] Delete now unused OMPD_ordered

It has been replaced by OMPD_ordered_standalone and
OMPD_ordered_blockassoc.
DeltaFile
+0-13llvm/include/llvm/Frontend/OpenMP/OMP.td
+1-2llvm/unittests/Frontend/OpenMPDirectiveNameParserTest.cpp
+1-2flang/lib/Semantics/check-omp-structure.cpp
+1-2flang/lib/Parser/openmp-parsers.cpp
+1-1llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+1-1clang/lib/Parse/ParseOpenMP.cpp
+5-216 files

LLVM/project e6dc106clang/include/clang/AST StmtOpenMP.h, clang/lib/AST StmtOpenMP.cpp

[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.
DeltaFile
+77-71clang/lib/CodeGen/CGStmtOpenMP.cpp
+65-13clang/include/clang/AST/StmtOpenMP.h
+24-18clang/lib/AST/StmtOpenMP.cpp
+12-5clang/lib/Serialization/ASTReaderStmt.cpp
+14-3clang/lib/Sema/TreeTransform.h
+13-3clang/tools/libclang/CIndex.cpp
+205-11314 files not shown
+279-13720 files

LLVM/project 0b724a4clang/lib/Parse ParseOpenMP.cpp

Update function name in all places
DeltaFile
+2-2clang/lib/Parse/ParseOpenMP.cpp
+2-21 files

LLVM/project 5bd4130clang/include/clang/AST StmtOpenMP.h

format
DeltaFile
+2-3clang/include/clang/AST/StmtOpenMP.h
+2-31 files

LLVM/project d77446fclang/lib/Parse ParseOpenMP.cpp

Update clang/lib/Parse/ParseOpenMP.cpp

Co-authored-by: Alexey Bataev <a.bataev at outlook.com>
DeltaFile
+1-1clang/lib/Parse/ParseOpenMP.cpp
+1-11 files

LLVM/project 01123baclang/bindings/python/clang cindex.py, clang/include/clang-c Index.h

Avoid horrible hack by using separate opcodes for the two ordered kinds
DeltaFile
+9-10clang/lib/AST/StmtOpenMP.cpp
+5-10clang/include/clang/AST/StmtOpenMP.h
+9-3clang/lib/Serialization/ASTReaderStmt.cpp
+6-2clang/include/clang-c/Index.h
+5-2clang/bindings/python/clang/cindex.py
+3-1clang/lib/Serialization/ASTWriterStmt.cpp
+37-283 files not shown
+43-319 files

LLVM/project ed3159cclang/include/clang/AST StmtOpenMP.h

Add comment
DeltaFile
+2-0clang/include/clang/AST/StmtOpenMP.h
+2-01 files

LLVM/project 2920732clang/include/clang/AST StmtOpenMP.h, clang/lib/AST StmtOpenMP.cpp

[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.
DeltaFile
+36-23clang/lib/Parse/ParseOpenMP.cpp
+33-20clang/lib/Sema/SemaOpenMP.cpp
+10-6clang/lib/CodeGen/CGOpenMPRuntime.cpp
+9-3clang/lib/AST/StmtOpenMP.cpp
+7-3clang/include/clang/AST/StmtOpenMP.h
+4-2llvm/lib/Frontend/OpenMP/DirectiveNameParser.cpp
+99-574 files not shown
+107-6210 files

LLVM/project c584282flang/test/Semantics/OpenMP ordered03.f90

Add testcase
DeltaFile
+9-0flang/test/Semantics/OpenMP/ordered03.f90
+9-01 files

LLVM/project 5b79e1bflang/lib/Semantics check-omp-structure.cpp

Show type of ORDERED directive
DeltaFile
+9-2flang/lib/Semantics/check-omp-structure.cpp
+9-21 files

LLVM/project 5ec674cclang/test/CodeGen/X86 x86_64-union-abi.c, llvm/lib/ABI/Targets X86.cpp

[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]
DeltaFile
+78-0clang/test/CodeGen/X86/x86_64-union-abi.c
+3-30llvm/lib/ABI/Targets/X86.cpp
+81-302 files

LLVM/project 2fad983clang/include/clang/Analysis/Analyses UnsafeBufferUsage.h, clang/include/clang/Basic DiagnosticGroups.td DiagnosticSemaKinds.td

[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>
DeltaFile
+132-0clang/lib/Analysis/UnsafeBufferUsage.cpp
+62-0clang/test/SemaCXX/warn-unsafe-buffer-usage-string-view.cpp
+33-3clang/lib/Sema/AnalysisBasedWarnings.cpp
+5-1clang/include/clang/Basic/DiagnosticSemaKinds.td
+4-0clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h
+2-1clang/include/clang/Basic/DiagnosticGroups.td
+238-52 files not shown
+242-58 files

LLVM/project aaf177ecompiler-rt/lib/ubsan_minimal ubsan_minimal_handlers.cpp

[compiler-rt] Use `fprintf` for proper targets (#215362)

Summary:
Needs fprintf to flush properly for sanitization.
DeltaFile
+12-1compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp
+12-11 files

LLVM/project 9c47595offload/test/offloading/fortran declare-target-common-block-main.f90 usm_map_close.f90

[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.
DeltaFile
+2-2offload/test/offloading/fortran/usm_map_close.f90
+2-2offload/test/offloading/fortran/target-use-dev-ptr.f90
+1-1offload/test/offloading/fortran/declare-target-common-block-main.f90
+5-53 files

LLVM/project cbe3031clang/test/CIR/CodeGen lambda-dtor-field.cpp attr-noundef.cpp

[CIR] Fix a pair of classic codegen tests (#215389)
DeltaFile
+2-2clang/test/CIR/CodeGen/attr-noundef.cpp
+1-1clang/test/CIR/CodeGen/lambda-dtor-field.cpp
+3-32 files

LLVM/project 0a168c4utils/bazel/llvm-project-overlay/libc BUILD.bazel

[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.
DeltaFile
+2-1utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+2-11 files

LLVM/project dd601a4lldb/include/lldb/Symbol SymbolLocator.h, lldb/source/Core DynamicLoader.cpp

[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]
DeltaFile
+83-63lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+142-4lldb/unittests/Symbol/SymbolLocatorTest.cpp
+82-11lldb/source/Symbol/SymbolLocator.cpp
+43-19lldb/source/Core/DynamicLoader.cpp
+30-0lldb/include/lldb/Symbol/SymbolLocator.h
+25-0lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py
+405-976 files

LLVM/project 1683451lldb/include/lldb/Symbol SymbolLocator.h, lldb/include/lldb/Target Platform.h

[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
DeltaFile
+70-0lldb/unittests/Symbol/SymbolLocatorTest.cpp
+18-0lldb/include/lldb/Target/Platform.h
+10-0lldb/source/Symbol/SymbolLocator.cpp
+4-0lldb/include/lldb/Symbol/SymbolLocator.h
+1-0lldb/source/Core/DynamicLoader.cpp
+103-05 files

LLVM/project af80aadlldb/include/lldb/Symbol SymbolLocator.h, lldb/source/Core DynamicLoader.cpp

[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]
DeltaFile
+199-0lldb/unittests/Symbol/SymbolLocatorTest.cpp
+44-36lldb/source/Core/DynamicLoader.cpp
+58-0lldb/include/lldb/Symbol/SymbolLocator.h
+49-0lldb/source/Symbol/SymbolLocator.cpp
+1-0lldb/unittests/Symbol/CMakeLists.txt
+351-365 files

LLVM/project f527e7allvm/lib/Target/RISCV RISCVInstrInfo.td RISCVInstrInfoZclsd.td, llvm/test/MC/RISCV rv32c-invalid.s

[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
DeltaFile
+30-60llvm/lib/Target/RISCV/RISCVInstrInfoC.td
+11-34llvm/lib/Target/RISCV/RISCVInstrInfoXqci.td
+7-17llvm/lib/Target/RISCV/RISCVInstrInfoZc.td
+4-19llvm/lib/Target/RISCV/RISCVInstrInfoZclsd.td
+15-1llvm/lib/Target/RISCV/RISCVInstrInfo.td
+4-8llvm/test/MC/RISCV/rv32c-invalid.s
+71-1394 files not shown
+83-14810 files