[DebugInfo][CodeView] Fix VFTableShape slot decoding order (#233442)
While working on something else (something like
[MCCAS](https://llvm.org/devmtg/2024-10/slides/techtalk/Rastogi-Fine-grained-compilation-caching-using-llvm-cas.pdf)
for CodeView) I noticed that:
1. The LF_VTSHAPE type record is `TypeRecordMapping` got its
deserialization wrong (this PR)
2. In the usual Codgen path in Clang we get through a
serialize/deserialize/reserialize cycle for each CodeView record (fix
here https://github.com/llvm/llvm-project/pull/233609)
This PR fixes the first issue. In VFTableShapeRecord deserialization
(read), the high and low nibbles were reversed. Writing got it right.
Added a unit test because that's the simplest and more direct thing we
could do.
Also checked against the latest MSVC to ensure we do the right thing.
[flang][debug] Clear the source line of operations hoisted by LICM (#233584)
Fixes #233484.
When `flang-licm` hoists a loop-invariant operation, the operation keeps
the location of the statement it was written in. Because the hoist point
precedes the loop, the line table then claims that statement begins in
the loop setup code, and a breakpoint placed on the statement binds
there rather than in the loop body. At that address the variables the
statement reads are not live yet, so they print as `<optimized out>` in
gdb.
This patch clears the line and column of a hoisted operation, keeping
the file. LLVM does the same to instructions it hoists or sinks, so that
one does not keep reporting a line it no longer belongs to.
[mlir] Split analysis implementations into subsystem libraries (#232793)
Introduce MLIRAnalysisBase, MLIRAnalysisDataFlow and
MLIRAnalysisPresburger with independent source ownership and focused
interface dependencies. Keep the generic Presburger mathematics library
independent of MLIR IR.
Reuse the component objects in the full MLIRAnalysis compatibility
archive, and include only the components in aggregate libMLIR. Migrate
MLIR, CIR and Flang library consumers to their required analysis APIs,
including dependencies previously supplied through other libraries.
This reduces unnecessary transitive dependencies: we don't need to build
Presburger and similar things for CIR for example.
Assisted-by: Codex
[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.
emulators/tic-80: return to pool
Upstream has recently updated this project, redoing the entire build
system. It was very time consuming to port on account of having to
unbundle all sorts of dependencies. Having just started a new job,
I don't seem to have the time to do it all over again for the new
build system.
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>
galene: Install static files and use them by default
Galene server needs static files to run otherwise it will fail to
start.
Install them and also adjust the default for `-static' to automatically
pick them up.
[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>
misc/opencode: New port: AI coding agent for the terminal
OpenCode is an open-source, model-agnostic AI coding agent that runs in
the terminal. It combines a full-screen TUI and a scriptable CLI with
a client/server architecture, LSP awareness and multi-session support.
Tested on arm64 and amd64.