[SPARC] Don't combine misaligned memory ops with BSWAP (#206345)
Doing it will result in a misaligned LD*A/ST*A instruction, which will
raise a bus error.
This should fix the failure in `clamscan` test.
[LifetimeSafety] Support field-sensitivity in lifetime tracking
This patch enables field-sensitivity when tracking lifetimes of nested objects.
- FactsGenerator now generates `PathElement::getField` for `MemberExpr` accesses, mapping fields to loans.
- LoanPropagation now propagates field paths along flow facts, appending fields to base loans.
- Removes false-positive warnings in `invalidations.cpp` where modifications to one field were incorrectly reported as invalidating iterators/pointers to another field.
- Adds comprehensive unit tests checking nested field access and placeholder fields.
TAG=agy
CONV=2cfd8d00-18d7-4a03-8d78-2aba2f9a8f23
[LifetimeSafety][NFC] Update Checker to use prefix comparison interfaces
This patch switches the Checker's expiry and invalidation checks to use `AccessPath::isPrefixOf` instead of equality (`==`).
Since all generated access paths are currently empty, `isPrefixOf` is behaviorally identical to `==` (NFC). This prepares the checker to handle nested paths (fields and container interiors) in subsequent commits.
TAG=agy
CONV=2cfd8d00-18d7-4a03-8d78-2aba2f9a8f23
[LifetimeSafety][NFC] Refactor AccessPath and Loan representations
This patch refactors the internal representations of `AccessPath` and `Loan` to support path elements, preparing for field-sensitive and interior-sensitive lifetime tracking.
- Introduces `PathElement` representing a field or interior dereference.
- Refactors `AccessPath` to contain a base and a list of `PathElement`s.
- Updates `Loan` and `LoanManager` to use the new `AccessPath` structure.
- Refactors debug dump formatting to output path elements if present.
- Updates Checker and FactsGenerator to compile with the new interfaces, keeping logic behaviorally identical (NFC).
TAG=agy
CONV=2cfd8d00-18d7-4a03-8d78-2aba2f9a8f23
[LifetimeSafety] Add multi-block support to buildOriginFlowChain (#204592)
After introducing `buildOriginFlowChain` to use-after-scope diagnostics,
it should support multi-block analysis. This also allows it to be reused
by other diagnostics.
In some loops, `UseFact` may appear before `OriginFlowFact`:
```cpp
void for_loop_use_before_loop_body(MyObj safe) {
MyObj* p = &safe;
for (int i = 0; i < 1; ++i) {
(void)*p;
MyObj s;
p = &s;
}
(void)*p;
}
```
[6 lines not shown]
[clang][CIR] Add lowering for Neon rounding builtins (#195021)
This PR adds CIR lowering for AArch64 NEON rounding builtins:
- vrnd (trunc), vrnda (round), vrndi (nearbyint), vrndm (floor),
vrndn (roundeven), vrndp (ceil), vrndx (rint)
- vrnd32x, vrnd32z, vrnd64x, vrnd64z (v8.5-a FRINT variants)
The standard rounding builtins lower to the corresponding CIR ops
(cir.trunc, cir.round, etc.). The vrndi_v/vrndiq_v cases are handled
in the common NEON switch since they enter via AArch64SIMDIntrinsicMap
(NEONMAP0). The vrnd32/64 builtins use NEONMAP1 entries with their
aarch64.neon.frint* intrinsic names.
The lowering follows the existing implementation in
CodeGen/TargetBuiltins/ARM.cpp.
Prior to this patch, the original neon-intrinsics.c had zero f32
standard rounding tests :
[6 lines not shown]
[RISC-V][RVY] Initial ISAInfo support for RVY
RVY is a new base ISA, so the syntax to enable it is rv32y/rv64y.
Since the compressed instructions reuse the space for Zcf (RV32) and
Zcd (RV64), those are marked as incompatible and the logic for C/Zce
is updated as part of this PR.
RVY can also extend RVE instead of RVY (as is done for CHERIoT), but the
official arch string syntax for that has not been finalized yet.
Related discussion on that includes the "long base name" proposal:
https://lists.riscv.org/g/tech-unprivileged/message/1134
Reviewers: topperc, lenary, jrtc27
Pull Request: https://github.com/llvm/llvm-project/pull/201931
[VPlan] Move consecutive vector pointer construction to VPBuilder (NFC). (#207563)
Introduce VPBuilder::createConsecutiveVectorPointer to create vector
pointers for consecutive accesses. This enables re-use in follow-up
changes.
[clang-format] Fix BlockIndent compat mapping of AlignAfterOpenBracket (#207187)
be11e2b3d25 (#192283) replaced the `[[fallthrough]]` chain in the
`AlignAfterOpenBracket` backward-compatibility switch with explicit
per-case assignments. In the `BAS_BlockIndent` case the
`BreakBeforeCloseBracket{BracedList,Function,If} = true` assignments are
immediately overwritten with `false`, and
`BreakAfterOpenBracket{BracedList,Function,If}` (previously inherited
from the `BAS_AlwaysBreak` case via fallthrough) are never set. As a
result, `AlignAfterOpenBracket: BlockIndent` parses to the same flag set
as `Align`, silently dropping the block-indent style for existing
configurations.
Restore the pre-#192283 mapping and pin the full BlockIndent flag
mapping in ConfigParseTest so the compat shim cannot regress silently
again.
Fixes #207186.
Note for the release branch: if #205920 (backport of #192283 to
release/22.x) lands, this fix needs to be backported together with it.
[MC] Generate FeatureKV with compact string table (#206331)
FeatureKV is responsible for a fair amount of .data.rel.ro size and
relocations; in an all-target build, this amounts to ~139 kiB that need
to be touched on every startup. Therefore, store strings adjacent to the
SubtargetFeatureKV in memory and reference the strings via relative
offsets to avoid dynamic relocations.
[Support][NFC] Use single predecessor array in DomTreeConstr (#207535)
Storing many small vectors of predecessors is bad for performance, as
each of these has to be non-trivially initialized when growing the
NodeInfos vector. Therefore, store all predecessors in a separate
vector, in which predecessors form a linked list.
[Support] Remove virtual functions from formatv (#207516)
Currently, formatv erases types using a base class and calls the virtual
function format() to format the objects. To avoid these vtables,
refactor formatv to instead store function_refs to a functor (struct
with overloaded operator()). This saves ~5kiB in vtables.
Additionally, add a static assertion that a formatter is present instead
of relying on errors due to missing templates. This requires a little
change to MLIR's tgfmt to use a different name -- previously, the
substitution failure on ArrayRef<> would cause the variadic function to
be skipped, but a static assertion failure is not a substitution error.
Also, simplify the code in FormatVariadicDetails to use if constexpr
instead of template overloads with enable_if, making the code shorter
and easier to read.
[MC][NFC] Generate ComplexDeprecationInfos as function (#207496)
The only user of ComplexDeprecationInfos is ARM, where 19 instructions
are deprecated. Instead of emitting a ~36kiB function pointer table,
emit a single 201B (x86-64) function switching over the opcodes.
[AMDGPU][NFC] Remove direct access to FeatureKV (#206231)
This is preparatory work for changing the representation of
FeatureKV/SubTypeKV, in which they will no longer be that easily
accessible as global variables. Therefore, get them from the subtarget
instead.
[AMDGPU] Fix gfx1250 WMMA latencies
- 16x16x64 FP8/BF8 WMMA run in 4 cycles, not 8. Add a 4-cycle
WriteXDL1PassWMMA write and split the FP8/BF8 InstRW by shape so that
16x16x128 FP8/BF8 (and F16/BF16) keep the 8-cycle latency.
- f8f6f4 WMMA run in 4 cycles when both matrix inputs are f4 and 8 cycles
when any input is f6 or f8, instead of the previous 8/16. Update the
scheduling predicate accordingly.
The co-execution hazard category is derived from the WMMA latency. The
4-cycle WMMAs have a single co-execution slot, so give them their own
category (2 wait states before a dependent WMMA, 1 before a dependent VALU)
rather than bucketing them with the 8-cycle WMMAs.
[LifetimeSafety] Support container interior paths and invalidations
This patch completes the implementation of path-sensitive lifetime tracking by supporting container interior paths (`.*`) and deep-nested invalidation.
- Enables `PathElement::getInterior` generation in `FactsGenerator` for GSL Owners and Views (e.g. member functions, function parameters, lambda captures).
- Removes bypass checks in `FactsGenerator::handleInvalidatingCall` to track container invalidation on fields.
- Updates `Checker` to use strict prefix comparison (`isStrictPrefixOf`) for container invalidations, ensuring invalidation of container contents (interior) correctly invalidates iterators but not other sibling fields.
- Reorganizes tests in `invalidations.cpp` by resolving duplicates and distributing them logically.
- Updates unit tests and sema tests with correct expectations for interior paths.
TAG=agy
CONV=2cfd8d00-18d7-4a03-8d78-2aba2f9a8f23
[LifetimeSafety] Support field-sensitivity in lifetime tracking
This patch enables field-sensitivity when tracking lifetimes of nested objects.
- FactsGenerator now generates `PathElement::getField` for `MemberExpr` accesses, mapping fields to loans.
- LoanPropagation now propagates field paths along flow facts, appending fields to base loans.
- Removes false-positive warnings in `invalidations.cpp` where modifications to one field were incorrectly reported as invalidating iterators/pointers to another field.
- Adds comprehensive unit tests checking nested field access and placeholder fields.
TAG=agy
CONV=2cfd8d00-18d7-4a03-8d78-2aba2f9a8f23