[flang] Fix fir.call setCalleeFromCallable (#187124)
The CallOpInterface setCalleeFromCallable allows either value or
SymbolRef to be passed in. However, the implementation showed an issue
because while it was able to set attribute, it would fall-through and
also try to set value.
This PR improves the implementation to handle updating the callee even
when switching modes (direct vs indirect) and adds testing for these
APIs.
[clang-doc] Enclose documented entities in a card (#185121)
This patch adds a card that encompasses the whole documented entity
instead of just the description. This helps to visually separate the
documentation which was previously more difficult to distinguish. The
description card is also changed to only show a left border to create
less visual noise within the card.
The light theme colors are also changed slightly to not be completely
white.
[llvm-remarkutil] filter: Add --exclude flag (#187163)
Add --exclude to invert filter behavior, keeping all remarks excluding
those matching the filter.
Pull Request: https://github.com/llvm/llvm-project/pull/187163
[flang][acc] Handle deduplicated use_device (part 2) (#187305)
After https://github.com/llvm/llvm-project/pull/186855 there was still
one additional part of the pass that assumed it was able to erase
acc.use_device. Thus extend the same solution and add test.
[mlir][Transform] Fix crash in SequenceOp::getEffects when body region is empty (#185063)
When walking operations post-order and erasing blocks, the inner body
block of a nested transform.sequence can be erased while the outer op is
still alive. If printAsOperand is called on the outer block at that
point, it triggers verification, which calls SequenceOp::getEffects ->
getPotentialTopLevelEffects -> getBodyBlock() -> Region::front() on an
empty region, causing an assertion failure in ilist_iterator
('\!NodePtr->isKnownSentinel()').
Fix by checking that the body region is non-empty before passing its
front block to detail::getPotentialTopLevelEffects in the
PossibleTopLevelTransformOpTrait.
Fixes #60213
Assisted-by: Claude Code
[LoopFusion] Use DA by default for dependence analysis (#187309)
Loop Fusion includes some internal dependence analysis code. Currently
the pass uses both DA and internal code and chooses the best result. The
goal is to use DA for all dependence analysis requirements in fusion.
This patch changes the default value. Removing the code will be done
separately later.
[libc][docs] Generate configure.rst in the build directory (#187266)
generate_config_doc() was writing configure.rst directly into the source
tree, which fails when building from a read-only source directory (e.g.
when the source is on a read-only filesystem or in a packaging
environment).
The Sphinx build in libc/docs/CMakeLists.txt already copies static .rst
files from the source tree into the build tree so that generated docs
don't pollute the source directory. Move configure.rst generation to
follow this same pattern by writing to LIBC_BUILD_DIR/docs/ instead of
LIBC_SOURCE_DIR/docs/.
This also removes configure.rst from the checked-in source tree, since
it was fully generated content that was being regenerated on every CMake
configure anyway.
[clang][modules] Stop uniquing implicit modules via `FileEntry` (#185765)
This PR changes how `ModuleManager` deduplicates module files.
Previously, `ModuleManager` used `FileEntry` for assigning unique
identity to module files. This works fine for explicitly-built modules
because they don't change during the lifetime of a single Clang
instance. For implicitly-built modules however, there are two issues:
1. The `FileEntry` objects are deduplicated by `FileManager` based on
the inode number. Some file systems reuse inode numbers of previously
removed files. Because implicitly-built module files are rapidly removed
and created, this deduplication breaks and compilations may fail
spuriously when inode numbers are recycled during the lifetime of a
single Clang instance.
2. The first thing `ModuleManager` does when loading a module file is
consulting the `FileManager` and checking the file size and modification
time match the expectation of the importer. This is done even when such
module file already lives in the `InMemoryModuleCache`. This introduces
racy behavior into the mechanism that explicitly tries to solve race
[14 lines not shown]
[ASan] Fix overflow and last byte handling in __asan_region_is_poisoned (#183900)
__asan_region_is_poisoned() uses an exclusive end address
(end = beg + size) to validate the region [beg, end) and to compute
the aligned inner shadow region. This causes correctness issue
near memory range upper boundary and could trigger address space
overflow on 32-bit targets.
1. Incorrect handling of the last byte of a memory range
The implementation checks AddrIsInMem(end) instead of the last
application byte (end - 1). For regions ending at the last byte
of Low/Mid/HighMem (e.g. __asan_region_is_poisoned(kHighMemEnd, 1)),
this returns end (kHighMemEnd + 1) instead of the original
pointer. This behavior is inconsistent with the function’s
semantics and with __asan_address_is_poisoned().
2) address space overflow and invalid shadow range
[27 lines not shown]
[clang][Headers] add endian.h (#186032)
POSIX.1-2024 defines a header called
`endian.h`` which contains macros and helpers for
handling byte order conversions.
Unfortunately it is not available on all platforms, however LLVM libc
has a useful endian.h
implementation that is essentially only casts and
builtins.
This PR draws on that implementation to add a
clang header so applications on
platforms without it can make use of this header.
The clang header forwards to the system header if
available, so existing usages are not affected.
[DAGCombiner] Move the XORHandle in rebuildSetCC inside the while loop. (#187189)
If N was changed on the previous loop iteration, we need the handle to
point at the new N.
Fixes #186969.
[NFC] Update `LoopVectorize/predicator.ll` test (#187125)
Align it with the style of `LoopVectorize/VPlan/predicator.ll`:
* Move ascii-graphs close to IR to avoid scrolling through CHECKs when
comparing the picture and actual IR
* Rename `%cN` to ensure that `bbN` branches on `%cN`
[RISCV] Rename add_like pattern -> riscv_add_like (#187306)
Rename to riscv_add_like to discriminate from generic pattern in a future patch
Ideally we'd make the riscv patterns generic but they're currently using value tracking and I'm not sure if we want to that generically?
[mlir][acc] Fix bindNameValue for RoutineOp (#187307)
If the routine op only has one of the string or id attributes, the API
was crashing since it was attempting to search in both. Guard each
search individually.
[AMDGPU] Use native instructions for f16 to u16/i16 saturated conversion (#186769)
This addresses one of the limitations of #174726 by directly selecting
`v_cvt_[u16/i16]_f16` instructions for conversion between 16-bit types,
as they already handle saturation internally.
[VPlan] Compute cost for predicated loads/stores to invariant address. (#181572)
Update VPReplicateRecipe::computeCost to compute the cost for stores to
invariant addresses only masked by the header mask.
This matches the legacy cost model logic, but it is slightly odd that
the legacy cost model only seems to do this for stores predicated by the
header mask (i.e. tail-folding and not executed conditionally
otherwise). This is probably something we want to re-evaluate
eventually.
PR: https://github.com/llvm/llvm-project/pull/181572
[PrefixMap] Teach lldb to auto-load compilation-prefix-map.json (#187145)
Add a LoadCompilationPrefixMap() helper in SymbolFile::FindPlugin that
walks up from the symbol file's directory looking for a
compilation-prefix-map.json file. When found, each key→value entry is
applied to the module's source path mapping list, allowing LLDB to
resolve source file paths that were rewritten by -fdebug-prefix-map at
build time without requiring manual `settings set target.source-map`.
The JSON file format maps fake paths (as written into debug info) back
to their real on-disk counterparts:
{ "/fake/srcdir": "/real/srcdir" }
Directory results are cached so the filesystem is walked at most once
per unique directory across all modules loaded in a session.
Also apply the module's source path remappings in
SymbolFileDWARFDebugMap::ParseCompileUnitAtIndex when constructing
compile units from N_SO stabs. This mirrors what MakeAbsoluteAndRemap
[5 lines not shown]
[llvm-remarkutil] filter: Support multiple input files (#187162)
Refactor filter into a FilterTool class that can process multiple input
files sequentially and emits the remarks into a single output file.
Pull Request: https://github.com/llvm/llvm-project/pull/187162
[clang][bytecode] Allocate local variables in `InterpFrame` tail storage (#185835)
Instead of heap-allocating an `InterpFrame` and then immediately
heap-allocating more space for the local variables, do only one
heap-allocation and use tail storage for the local variables.
We already know how many bytes we need to for the tail storage after
all.
This also makes `InterpFrame` a little smaller since we don't need to
save an explicit pointer for the local variable memory.
For an artificial test case doing lots of function calls with local
variables like:
```c++
constexpr int plus(int a, int b) {
[27 lines not shown]