[RISCV] NFC: Use the new "let append" TableGen feature to reduce duplication (#198761)
llvm#182382 introduced a language extension to accumulate field values:
“append” concatenates the new value after the current value, whilst
"prepend" concatenates before the existing value. This change uses that
feature to eliminate repetition in the definition of some of the
compressed instructions.
For example, line 267 of RISCVIntrInfoC.td establishes a scope for “`let
Predicates = [HasStdExtZca] in {`”; this scope ends on line 515.
Meanwhile, line 454 wants to add the `IsRV64` predicate for a single
instruction but was forced to duplicate the previous condition as well:
“`let Predicates = [HasStdExtZca, IsRV64] in`”. That’s no longer
necessary since the addition can now be explicit: “`let append
Predicates = [IsRV64] in `”
I‘ve verified that this change has no effect on the TableGen output.
It seems quite likely that this same change could be made in some of the
other RISC-V TableGen source files…
[libc][nfc] Include header for EFIAPI macro (#198876)
This file uses `EFIAPI`, but it's not included. It looks like
compilation currently succeeds because `EFI_SYSTEM_TABLE.h` is the only
header that includes `EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.h`, and it happens
to include `EFIAPI-macros.h` indirectly.
We will be adding Bazel rules for this file, and Bazel typically
requires all headers to be compilable on their own. This build error is
theoretically reproducable by running cmake build with
`-DCMAKE_VERIFY_INTERFACE_HEADER_SETS` if we had the appropriate
FILE_SETs defined.
[lldb/Interpreter] Plumb ScriptedMetadata through scripted plugin CreatePluginObject (NFC) (#198425)
Replace the (class_name, args_sp) parameter pair on CreatePluginObject
across the scripted plugin interfaces (ScriptedThread, OperatingSystem,
ScriptedBreakpoint, ScriptedFrameProvider, ScriptedProcess, and the
underlying ScriptedPythonInterface template) with a single `const
ScriptedMetadata &`. Callers (OperatingSystemPython, ScriptedThread,
ScriptedProcess, BreakpointResolverScripted, ScriptedFrameProvider) pass
their existing ScriptedMetadata directly, removing the need to re-bundle
class_name and args at every call site.
ScriptedBreakpoint, ScriptedFrameProvider and ScriptedProcess no longer
carry a redundant `args_sp` parameter; their callers fold those args
into the metadata, and the Python overrides reconstruct a
StructuredDataImpl from the metadata's args dict for the dispatched
call.
ScriptedInterface gains an `m_scripted_metadata` member and a
`GetScriptedMetadata()` accessor; ScriptedPythonInterface populates it
[6 lines not shown]
[SSAF][WPA] Bounds propagation graph is a supergraph of the pointer-flow graph
Background: The whole-program UnsafeBufferReachableAnalysis propagates bounds
between pointers. It uses the pointer-flow graph extracted and linked
from translation units.
This commit patches the gap between the semantics of bounds
propagation and pointer-flow: the bounds propagation graph is a
supergraph of the pointer-flow graph in that a pointer-flow graph edge
(src, i) -> (dst, j) is the projection of a finite set of bounds
propagation graph edges {(src, i+d) -> (dst, j+d) | 0 <= d < UB} for a
small constant upper bound UB. See the following example for the idea:
```
void f(int ***p, int **q) {
*p = q;
(**p)[5] = 0;
}
```
[7 lines not shown]
[CIR] Handle atomic-fetch lowering of pointer types. (#198871)
We previously didn't properly handle the pointer type conversions, which
resulted in a verifier error. This patch does what classic codegen does
for these: casts them to an integer type. The rest of the logic around
this in classic codegen isn't necessary as the llvm intrinsics now
handle those types properly.
[CIR] Fix bugs with array new in a ternary expression (#198869)
While attempting to compile Clang with CIR enabled, we ran into a
problem with the cleanup handling for array new inside of a ternary
operation. The reduced test case ended up showing different failure
modes with and without exceptions enabled, but it failed in both cases.
With exceptions enabled, we were failing to spill the value to be
returned and reload it outside of the cleanup scope. With exceptions
disabled, we were pushing an effectively empty entry on the EH stack and
later asserting when trying to pop it.
This change fixes the spill and reload problem by inserting a
RunCleanupsScope RAII object around the ternary branch generation code
with a call to forceCleanups to generate the spill and reload.
The assertion failure is fixed by replacing the assert call with code to
safely handle the condition of having an empty cleanup on the EH stack.
We should probably modify the code that pushes EH-only cleanups to avoid
doing so when exceptions are disabled, but that's a more extensive
[7 lines not shown]
[VPlan] Add type in VPRecipeValue, migrate first set of recipes. (NFC) (#195485)
This patch adds a new Type field to hold the scalar type for the
VPRecipeValue. It starts the migration of an initial set of recipes to
set the scalar type and use it directly in VPTypeAnalysis, removing
special handling for those types.
Eventually, VPTypeAnalysis can be retired when the migration is
complete, hopefully eliminating the need for type related caching, which
can lead to subtle invalidation errors.
To help the transition, a temporary getScalarTypeOrInfer has been added,
which returns the scalar type set in the VPValue for already migrated
recipes or falls back o type inferrence otherwise.
VPlanVerifier has been extended verify the set scalar type where
possible.
Tracking the type directly means a few places that change the type will
[5 lines not shown]
[Offload] Make profiling support opt-in on events (#198810)
Summary:
Profiling requires getting time stamp information, which required
actually materializing barriers on the event. This caused performance
regressions in some OpenMP applications. Instead, we want to make this
opt in. This just adds a new argument to `olCreateEvent` which takes
some flags. Right now this is just none and profiling. Pretty mechanical
beyond that. Should revert this to the old behavior for OpenMP.
Co-authored-by: Kevin Sala Penades <kevinsala.ks at gmail.com>
[libc++] Require the exact assignment expression to be trivial in __uninitialized_allocator_copy_impl (#196648)
Fixes https://github.com/llvm/llvm-project/issues/196645
`__uninitialized_allocator_copy_impl` has an optimization that replaces
`allocator_traits::construct` with `std::copy` for raw pointer ranges
when the element type is trivially copy constructible and trivially copy
assignable.
The copy-assignment trait only checks whether assignment from `const T&`
is trivial. That is weaker than the expression used by `std::copy`,
which evaluates `*out = *in`. If overload resolution selects a different
non-trivial assignment operator for that expression, `std::copy` can
call that operator on uninitialized storage.
Check `is_trivially_assignable<_Out&, _In&>` instead. This matches the
assignment expression used by `std::copy`, preserves the optimized path
when that assignment is actually trivial, and avoids making non-const
raw pointer callers select the generic `allocator_traits::construct`
[4 lines not shown]
[flang][PPC] Improve vector type names in expression diagnostics (NFC) (#197821)
Improve Flang semantic diagnostics for vector types by printing vector
type spellings in Fortran syntax instead of internal builtin-derived
type names.
Use `DerivedTypeSpec::VectorTypeAsFortran()` when producing vector
operand type names in `ArgumentAnalyzer::TypeAsFortran()`, instead of
relying on the generic type formatting path.
This updates diagnostics to print vector types as Fortran source-like
spellings, such as:
- `vector(integer(4))`
- `vector(real(4))`
while preserving the existing formatting for non-vector derived types.
[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
Reject target map iterators without captures
Reject target map iterators until the follow-up capture-binding
representation is added since currently map_iterated on omp.target
only represents the dynamic map list and does not consider the
target-region arguments required by IsolatedFromAbove.
[mlir][OpenMP] Add iterator support to motion clauses
Extend omp.target_data, omp.target_enter_data, omp.target_exit_data,
and omp.target_update to support `!omp.iterated<Ty>`.
This is part of feature work for #188061
Assisted with copilot
Require explicit yield in iterator op
Remove the implicit terminator trait from omp.iterator so iterator
modifiers must explicitly yield the value used to form the iterated list.
Add and update verfier and test accordingly.
Simplify map iterator clause assembly
- Split MLIR map syntax into separate map_entries(...) and map_iterated(...),
removing the custom MapEntryList parser/printer.
- Moved omp.target map_iterated out of TargetOpRegion
- it now prints before the target region instead of as map_iterated_entries(...) after the region.
- Renamed LLVMIR TODO helper to clause-style checkMap.
- Added DeclareMapperInfoOp builder from DeclareMapperInfoOperands
and updated Flang call sites so they do not need to spell out newly
added operands..
[llvm][OpenMP] Add option to disable default max threads adjustment (#198719)
This commit adds the option
`-openmp-ir-builder-use-default-max-thread=<boolean-value>` to
enable or disable the use of a default max threads in OpenMPIRBuilder
when no max threads constant is provided. The option is enabled by
default, thus maintaining the same behavior as it is currently.
This flag is useful to avoid limiting the number of threads that an
OpenMP target region can run with when no `thread_limit` or
`num_threads` (in a nested parallel region) are specified. This flag may
be used when recording a kernel to allow replaying it later with a
higher number of threads (e.g., reaching the maximum thread limit
supported by the device).
[OpenMP][OMPIRBuilder] Avoid querying SmallPtrSet during removal (#198690)
openmp-cli-fuse02.mlir can intermittently leave behind a dead block
after loop fusion, causing LLVM IR verification to fail.
(https://github.com/llvm/llvm-project/pull/197637#issuecomment-4497502486)
This happened because `removeUnusedBlocksFromParent` queried
`BBsToErase` while using `SmallPtrSet::remove_if` on the same set, which
made the result depend on the set's internal mutation order during
removal.
This patch tracks candidate blocks by index with `SmallBitVector`
instead of mutating and querying the same `SmallPtrSet`. This also
preserves the original `BBs` order when collecting the final dead
blocks.
---
The original PR was created with assistance from Copilot. The later
[2 lines not shown]