[SimplifyCFG] Mark branch weights unknown in masked switch to lookup (#233321)
We cannot infer the branch weights because this transformation splits
the default case into two (values fully out of range, and holes inside
the range), which we cannot infer without additional value profiling.
[mlir][arith] Drop invalid overflow flags when narrowing
Preserve nsw only when narrowing preserves signed operand and result
values, and nuw only when it preserves unsigned values. Flags proven
at the original width may otherwise introduce poison after narrowing.
Add concrete regression cases for addi, subi, muli, and shli, covering
both overflow flags and retention of valid flags.
[mlir][arith] Preserve unsigned values when narrowing operations
Require unsigned representability for divui, ceildivui, remui, and shrui.
A signed range fitting the narrower type does not preserve the unsigned
operand values, even when the result fits.
Add concrete counterexamples and coverage for safe narrowing of
zero-extended and proven nonnegative operands.
[SLP] Handle REVEC when costing expanded compress mask
With REVEC the scalars are vectors. The masked-load-compress shuffle that is
emitted uses the compress mask expanded to the elements of those vectors
(transformScalarShuffleIndiciesToVector), but the cost was computed with the
unexpanded per-vector mask, so a shuffle such as <24 x i8> -> <16 x i8> was
costed as a <2 x i8> shuffle. This made the compress sequence looked cheaper
than it is.
Assisted-By: Claude Sonnet 5.5
[flang][OpenMP] Switch clause verification to descriptor-based
Delete all the scattered pieces of clause verification that are now
replaced by the unified handling.
[flang][OpenMP] Improve diagnostics about modifier properties
Use OpenMPDeprecated and OpenMPFuture warning categories for modifier
diagnostics as well, analogously to how they are used for clauses.
[flang][OpenMP] Account for using different versions for modifier checks (#229525)
When a modifier from a past/future version is accepted, use its
properties
from the nearest version in which it is allowed.
[flang][OpenMP] Create generic interfaces for "container" entities (#229524)
In short, clauses are containers of modifiers, and directives are
containers of clauses. With the abstractions in place, clauses and
modifiers look almost the same from the point of view of syntactic
properties.
Use these functions to implement generic GetAllowedElements and
GetElementVersionRange functions.
[IR] Reject IR functions that have hot and cold attributes (#233298)
These are mutually exclusive and clang already enforces this. We should
just reject this in the verifier so that passes don't have to think
about precedence of these two attributes.
[LAA] Reject calls with operand bundles that may access memory. (#233304)
Calls to vectorizable intrinsics and vector-variant calls skipped the
memory check, so bundles that may access memory (e.g. deopt) were
ignored. In LV this hoisted, removed or mis-widened such calls.
Reject bundles conservatively for now to fix miscompiles. We can make
this more fine-grained if needed in practice.
[SLP]Allow non-power-of-2 VF for partial register buildvectors
The buildvector, not filling the whole registers (e.g. <3 x float>),
was vectorized as the power-of-2 part plus the scalar remainder. The
type is widened to the full registers anyway, so vectorize it as a
whole.
Partially fixes #56332
Assisted-by: Cursor
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/233314
[memprof] Clean up remnants of MemProf format Version 2 (NFC) (#233288)
This patch cleans up two remnants left after the removal of MemProf
format Version 2 in #229262:
- FrameIdConverter and CallStackIdConverter in MemProfRadixTree.h no
longer need detail::DerefIterator. Note that detail::DerefIterator
was needed only to abstract iterator dereferencing across MapVector
and OnDiskIterableChainedHashTable, the latter of which was used
only in Version 2.
- MemProfUseTest.cpp still named its test helper makeRecordV2 even
though the test uses Version 3. This patch renames it to
makeRecord, matching InstrProfTest.cpp.
Assisted-by: Antigravity
[MemProf] Fix compile-time blowup in connectNewNode (NFC) (#233240)
connectNewNode had efficiency related support to shrink the remaining
set of context ids to move to the new edges. However, when recursive
callsites are allowed (the default), this required an expensive pre-pass
that overwhelmed any efficiency improvement.
It first scanned every context id on every edge of the original node to
find the recursive ids (those on multiple edges), and then used them to
decide which ids to remove from its copy of the remaining context id
set as edges were processed. Each call to connectNewNode rescans all ids
on that node's edges, even though the set of ids being moved is
typically small. On a large ThinLTO application this pre-pass dominated
the thin link, which took over 43 minutes. With
-memprof-allow-recursive-callsites=false it took about 4 minutes.
The updating of the remaining id set is not needed for correctness. An
id on only one edge has already been moved off that edge once matched.
An id on multiple edges is recursive and must be matched on every edge.
[15 lines not shown]