[Instrumentor] Improve the config wizard script
This makes the config wizard script more generic as we grow
instrumentation opportunities. Better output, e.g., clear paths, are
also displayed now.
Prepared with Claude (AI) and tested by me afterwards.
[CIR] Fix a problem with hoisting allocas out of nested cleanup scopes (#199093)
A recent change to the code that hoists allocas out of a cleanup scope
introduced an assertion that triggers when we're trying to hoist an
alloca that is in a cleanup scope that is nested within the cleanup
scope we're processing. I didn't think that could happen, but it turns
out the LLVM code itself triggers it.
This change removes the assertion and updates the check for the alloca
being contained within the cleanup scope we're processing so that it can
handle the case with nested scopes.
Assisted-by: Cursor / claude-opus-4.7-thinking-xhigh
[Instrumentor][FIX] Ensure we indicate changes properly.
We now indicate changes whenever we might have changed things even if
the filter will rule out instrumentation. The issue was that we need to
get the argument to check the filter and that process might create new
IR, e.g., a global variable containing the function name.
[libc++][iterator] Applied `[[nodiscard]]` (#172200)
`[[nodiscard]]` should be applied to functions where discarding the
return value is most likely a correctness issue.
- https://libcxx.llvm.org/CodingGuidelines.htm
- https://wg21.link/iterators
Also moves the test to the correct location:
`libcxx/test/libcxx/iterators/nodiscard.verify.cpp`
Towards #172124
---------
Co-authored-by: Hristo Hristov <zingam at outlook.com>
[OpenMP][mlir] Support iterator modifier LLVM lowering for map/motion
Lower iterator modifiers on map and motion
(target_data/target_data_begin/target_data_end/target_update) by
building dynamic offload map arrays in OpenMPIRBuilder and populating
them from iterator-expanded map entries during MLIR OpenMP to LLVM IR
translation.
Hoist runtime-sized offload map array allocation for target data with
iterator modifiers so the dynamic count and arrays dominate runtime calls.
This patch is part of feature work for #188061.
Assisted with copilot.
[clang-format] Fix unrecognized qualifiers breaking east-const (#198656)
Long time reader, first time contributor. :3
I've been experimenting with `_Nullable` and `_Nonnull` qualifiers in my
project for which the `.clang-format` configures:
```
QualifierAlignment: Custom
QualifierOrder: [type, const, volatile]
```
This results in the following form:
```cpp
T const* _Nullable const identifier =
```
Formatting as:
```cpp
T const* _Nullable identifier const =
```
[10 lines not shown]
[flang] Implement lowering for BOZ literal arguments in BGE, BLE, BGT, BLT (#191874)
BGE/BGT/BLE/BLT allow one or both arguments to be a BOZ literal
constant. Unlike other intrinsics that accept BOZ arguments, these do
not convert the BOZ to a typed value during semantic analysis.
When both arguments are constants, the comparison is folded at compile
time in `fold-logical.cpp`. However, when the non-BOZ argument is a
variable, folding is skipped and the BOZ literal constant persists in
the expression tree through to lowering.
The lowering implementation wraps the `BOZLiteralConstant]` in a
`Constant<LargestInt>` and feeds it through the existing
`convertConstant` infrastructure. Since BOZ is always a scalar, this
always produces a trivial SSA value. This follows the same pattern as
`gen(Constant<T>)` for the trivial scalar path. The `AddrOfOp` branch
from that template is intentionally omitted because a scalar i128
constant never produces a global reference. The
`outlineBigConstantInReadOnlyMemory` parameter is set to false to make
[10 lines not shown]
[Flang][OpenMP] Support iterator modifiers in map and motion clauses
Support iterated array elements and array sections in map and motion clauses for
target data, target enter data, target exit data, and target update constructs.
Preserve mapper resolution for iterated entries, including explicit mappers,
user-defined default mappers, declare mapper entries, and implicit default
mappers.
This PR stacked on top of #197047 and #197752.
This patch is part of the feature work for #188061.
Assisted with copilot.
[HLSL][SPIRV] Correct reversebit 64 split (#197849)
Replace the split-lanes + OpCompositeConstruct sequence in
selectBitreverse64 with a single OpVectorShuffle to swap the high/low
32-bit halves, simplifying both the selector logic, the emitted SPIR-V
and fixing the bug.
fix: #197810
Assisted by: Claude Opus 4.6
[lldb][CMake] Enforce lldbUtility and lldbHost layering invariants (#198952)
lldbUtility cannot depend on any other lldb library, and lldbHost can
only depend on lldbUtility. Breaking those invariants is an easy mistake
to make and has happened repeatedly: most recently in #198931.
Because LLDB statically links its libraries on macOS, a stray LINK_LIBS
entry, or a stray cross-library #include without a matching CMake
dependency, both succeed at link time and only surface much later as a
layering bug.
Add two configure-time checks in `add_lldb_library` so the build fails
fast when these invariants are broken:
1. A new `ALLOWED_INTERNAL_DEPENDENCIES <list>` parameter allowlists
which `^lldb`-prefixed `LINK_LIBS` entries a target may depend on. The
existing `NO_INTERNAL_DEPENDENCIES` flag is the empty-allowlist case and
continues to work.
[21 lines not shown]
[Flang][OpenMP] Support iterator modifiers in map and motion clauses
Support iterated array elements and array sections in map and motion clauses for
target data, target enter data, target exit data, and target update constructs.
Preserve mapper resolution for iterated entries, including explicit mappers,
user-defined default mappers, declare mapper entries, and implicit default
mappers.
This PR stacked on top of #197047 and #197752.
This patch is part of the feature work for #188061.
Assisted with copilot.
[RISCV] Fold Bitcast long bitwidth int to vector type (#194788)
Prevent bitcasts from `i256` to `<16 x i16>` or `<8 x i32>` from falling
back to scalar types.
Fixes: https://github.com/llvm/llvm-project/issues/180910
---------
Signed-off-by: ZakyHermawan <zaky.hermawan9615 at gmail.com>
[AIX][clang][compiler_rt] rename libatomic archive to libclang_rt (#197485)
This PR implements the following on AIX to avoid conflicts between LLVM
libatomic and the GNU libatomic in the AIX toolbox as they share the
same library name:
- Updates the clang driver to use `-lcompiler_rt` instead of `-latomic`
- Renames the compiler-rt archive from `libatomic.a` to
`libcompiler_rt.a`
Only the archive and not the shared object (`libatomic.so.1`) is renamed
because renaming one component is enough to distinguish between the LLVM
and GNU libatomic libraries. This also allows us to add additional
shared objects to the `libcompiler_rt.a` archive in the future if
needed.
[flang] Canonicalize sliced array access by fir.array_coor. (#197845)
This patch adds a canonicalization pattern for pulling rank-reducing
slices into `fir.array_coor`. This is helpful to preserve the original
rank of the array in `fir.array_coor`, which then helps representing
slice accesses in memref dialect as accesses to the original array.
This way, further conversion to affine dialect has benefits of
exposing the math applied to indices of all array dimensions.
For example, if a non-scalar slice depends on a loop IV, pulling
this into the original array access allows building access maps
enabling affine dependency analysis.
I considered the following three models for the addressing used
in `fir.array_coor` with rank reducing slices:
1) Mixed model:
- Encoding
* Scalar-sliced dims: index is slice_lb
[38 lines not shown]
[Instrumentor] Improve the config wizard script
This makes the config wizard script more generic as we grow
instrumentation opportunities. Better output, e.g., clear paths, are
also displayed now.
[clang] implement CWG2064: ignore value dependence for decltype
The 'decltype' for a value-dependent (but non-type-dependent) should be known,
so this patch makes them non-opaque instead.
This patch also implements what's neceessary to allow overloading
on pure differences in instantiation dependence, making `std::void_t`
usable for SFINAE purposes.
This also readds a few test cases from da98651, which was a previous attempt
at resolving CWG2064.
Fixes #8740
Fixes #61818
Fixes #190388
[flang][OpenMP][NFC] Share declare mapper helpers for iterator modifier lowering
Move mapper lookup and implicit default mapper creation into reusable
OpenMP lowering helpers so regular map lowering and iterator-generated
map entries can use the same resolution path.
This prepares Flang iterator modifier lowering for map and motion clauses
without changing the generated IR for existing non-iterator maps.
[Clang][AST] Fix ExplicitInstantiationDecl accessors for variable templates with tag types (#197856)
Several `ExplicitInstantiationDecl` accessors assumed that
`TypeSourceInfo` always encodes a class entity, but for variable
templates the `TypeSourceInfo` holds the *declared type* (e.g. `Plain`,
`Color`, `Wrap<int>`). When that declared type happened to be a
`TagType` or `TemplateSpecializationType`, the accessors would
misinterpret it:
- `getTypeAsWritten()` returned `nullptr` → crash in `DeclPrinter`
- `getQualifierLoc()` leaked the type's qualifier into the variable name
- `getTagKWLoc()` returned the type's elaborated keyword
- `getNumTemplateArgs` / angle-loc getters extracted from the type
instead of the variable's template arguments
Add a private `getClassTypeLoc()` helper that returns the entity
`TypeLoc` only for class-like instantiations
(`isa<RecordDecl>(getSpecialization())`), and guard all `TypeSourceInfo`
fallback paths with it. For non-class entities the accessors now
[10 lines not shown]
[SLP] Treat ExtractElement from terminator results as gather
When canReuseExtract sees an ExtractElement bundle whose source vector
is produced by a terminator instruction (invoke or callbr), the SLP
vectorizer used to mark the bundle as Vectorize and reuse the
terminator result as the bundle's vectorized value. For external uses
of the bundle, vectorizeTree later sets the IRBuilder insertion point
to next(VecI), which lands past the terminator and produces an invalid
CFG (a new extractelement is inserted after the terminator in the
predecessor block).
Fixes #199021
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/199089
[PowerPC] Change arguments of PPCEmitTimePseudo
Like #198861 but for PPCEmitTimePseudo.
This is not NFC. The asm name of LDtocBA was set to #LDtocCPT,
which is the name of the instruction before. This looks like a
cut`n`paste error, and I changed the asm name.
[flang][FIRToMemRef] Fixed array_coor with box/shape/slice. (#198933)
A `fir.array_coor` with box input, a slice and a shape without
a shift, should also be converted using dimensions information
stored in the input box (case (c) in the updated code).
[flang][OpenMP] Limit scope creation to constructs with data environment (#198780)
Identify specific constructs that require data envorinments, and only
create scopes for them. This avoids scopes for loop-transformation
constructs, for example.
This isn't a correctness fix, but a clarification and a simplification
of the name-resolution code for OpenMP.