[ADT] Adopt SmallVectorWithFlags in padding-saving records
Pack boolean and small-bitfield state into SmallVectorWithFlags across
464 records in LLVM, Clang, MLIR, Flang, LLD, LLDB, BOLT, Polly, and
clang-tools-extra. Preserve inline capacities, initial flag values,
payload-only comparisons, and existing copy and move behavior. Remove
redundant state where doing so provides the same layout improvement.
Add ordinary-vector construction and payload move assignment support.
Use ArrayRef for read-only vector interfaces and explicit payload transfers
where existing mutable SmallVectorImpl interfaces need ordinary vectors.
Add regression tests for flag retention during vector growth, copy, move,
serialization, and calling-convention lowering.
Leave ELFObjectFile lazy caches separate from immutable flags to preserve
independent const access. Leave generated AffineVectorizeOptions unchanged
because its public aggregate contract needs a separate generator change.
Validation: Clang unit tests, check-lld, 21 selected unit-test binaries,
[4 lines not shown]
feat(gisel): simplify demanded bits through shifts
Propagate demanded bits through constant shifts and convert ASHR to
LSHR when sign fill is unobserved or the source is nonnegative.
Enable the combiner for AMDGPU with focused MIR coverage.
ProcessImplicitDefs: Mark kept physreg IMPLICIT_DEFs dead (#232821)
An IMPLICIT_DEF is erased by setting undef an all uses of the def in a
block. If there are uses outside of the block, it is kept. In the case of
physical registers, this was left as an unused def without a dead flag.
Look at the liveins of the successors to check if it's live, and add the
dead flag if not. We probably should just erase the instruction, but I've
left that for a future change.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[mlir][math] Avoid integer division by zero when lowering math.ipowi (#230271)
`math.ipowi` with a zero base and a negative exponent is lowered to an
integer division by zero in two places: `MathToFuncs` emits a literal `1
/ 0` for that case, and `PowIStrengthReduction` rewrites a constant
negative exponent into `1 / (b * b * ...)` for a base that may be zero.
`arith.divsi` by zero is undefined behavior, so the result depends on
the target and the optimizer: on AArch64, `0 ** -1` lowered through
`MathToFuncs` returns 0 under `mlir-runner --O0` and 1 under `--O3`.
This patch:
- deletes the `b == 0` branch from the `MathToFuncs` helper, so a zero
base with a negative exponent returns 0 through the same final return as
every `|b| > 1` base;
- stops `PowIStrengthReduction` from reducing `ipowi` on `IntegerType`
with a negative exponent, leaving it to `MathToFuncs`;
- makes `PowIStrengthReduction` bail out for an `INT64_MIN` exponent,
since negating it is signed overflow (this changes `fpowi`,
[22 lines not shown]
[Bitcode] Avoid emitting trailing zeros for non-GlobalValue IDs in writeGUIDList (#233554)
ModuleBitcodeWriterBase::writeGUIDList previously sized the GUIDs vector
to VE.getValues().size(), which includes not only M.global_values()
(assigned the lowest ValueIDs by ValueEnumerator) but also all constants
and ConstantAsMetadata enumerated in the module (such as global
initializers, profile metadata, and debug info constants).
Because only GlobalValues can have GUIDs, and both BitcodeReader and
IndexBitcodeReader already bound lookups by GUIDList.size() and ignore
zero entries, sizing GUIDs to VE.getValues().size() emitted a 64-bit
zero for every constant in the module.
Instead, resize GUIDs dynamically up to the highest ValueID among
M.global_values() with a non-zero assigned GUID. On two large ThinLTO
applications, this reduced the total size of the minimized thin link
bitcode files by 8.6% (1.14 GiB) and 14.7% (0.79 GiB), with an
equivalent reduction in thin link peak RSS.
[5 lines not shown]
RuntimeLibcalls: Add signatures for atomic libcalls
Define type signatures in tablegen for the various atomic
library functions.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[GlobalOpt] [NFC] Skip cold call analysis when no function can use coldcc (#227944)
OptimizeFunctions() starts by calling hasOnlyColdCalls() on every
function in the module to find functions whose callers are all cold.
That analysis needs BlockFrequencyInfo for each caller and can be
expensive on large modules.
The result is only used to switch functions to the cold calling
convention, which happens only if TargetTransformInfo::
useColdCCForColdCall() returns true for the function (or if
-enable-coldcc-stress-test is set). On targets where that hook never
returns true, the analysis is wasted work.
Add a cheap pre-scan that asks TTI whether any non-intrinsic function in
the module can use coldcc, and only run the hasOnlyColdCalls() loop if
one can, or if the stress-test flag is set. The pre-scan stops at the
first match.
This is a compile-time improvement only; there is no change in output.
[5 lines not shown]
[MLIR][XeVM] Set the required sub-group size on every kernel (#232844)
When serializing a gpu.module to SPIR-V, the XeVM target sets
intel_reqd_sub_group_size = 16 on the first kernel only: the walk stops
after the first kernel it finds. The other kernels of the module get no
required size, so the GPU compiler may pick a different sub-group size
for them, for example 32. Code that the XeGPU and XeVM lowering emits
assumes 16 lanes, so those kernels can compute wrong results.
Set the required sub-group size on every kernel of the module.
---------
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[flang][OpenMP] Don't treat different runtime conditions as subsets
When two METADIRECTIVE candidates have the same score and one selector is
a strict subset of the other, the superset wins. Flang ranks every
runtime condition with the same property, so isStrictSubset saw
different conditions as the same:
!$omp metadirective &
!$omp& when(user={condition(a)}, &
!$omp& implementation={vendor(score(4): llvm)}: taskyield) &
!$omp& when(user={condition(b)}, device={kind(host)}, &
!$omp& implementation={vendor(score(3): llvm)}: taskwait)
Both candidates score 5, and `b` was tested first, so TASKWAIT ran when
both conditions were true. Neither selector is a subset of the other, so
clause order should decide.
This patch adds a UserCondition key to VariantMatchInfo, and
isStrictSubset requires equal keys when the first selector has a
[14 lines not shown]
[lldb] Move register support out of ProcessUtility (#232969)
Create lldbRegister under lldb/Register and move register classes that
do not call OS-specific interface directly.
RuntimeLibcalls: Add the remaining vector libraries (#232770)
Add definitions for Accelerate, Darwin_libsystem_m, LIBMVEC, MASSV and
SVML, and fill out SLEEFGNUABI, ArmPL and AMDLIBM to match VecFuncs.def.
The struct-returning ArmPL modf and sincos variants need new _STRET
libcalls.
With the new implementations available, type-split vector math calls
can now be expanded, and the vectorizer keeps pow as an intrinsic for
codegen to lower to the library call.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[lldb][Fortran] Added support for base types to DWARFASTParserFortran, tests for DWARFASTParserFortran and a method to get the parser from TypeSystemFortran