[mlir][ODS] Share optional operand and type parser logic (NFC) (#226066)
Move repeated optional operand and type parsing into out-of-line
helpers.
Generated parsers now reuse those helpers across operations.
This improves MLIR build time by avoid redundant compilation of these
helpers.
Assisted-by: Codex
[TargetFolder] Use getGetElementPtr() overload accepting DataLayout (#226068)
To directly construct the constant GEP in canonical ptradd form.
The test change is because this ends up canonicalizing the vector
GEP case as well, rather than just the scalar cases.
[WebAssembly] Remove per-invoke EH_LABEL handling (#226053)
Per-invoke `EH_LABEL`s are no longer emitted after #225903. This removes
code that handles per-invoke `EH-LABEL`s and removes them from mir
tests.
[flang][OpenMP] Fix crash in defaultmap(none) on structure constructors (#220994)
Fixes :
[https://github.com/llvm/llvm-project/issues/218929](https://github.com/llvm/llvm-project/issues/218929)
Flang was crashing when a target defaultmap(none:...) region contained a
structure constructor, like this:
```
program p
type t
end type
type(t) :: x
!$omp target defaultmap(none:aggregate)
x = t()
!$omp end target
end
```
The problem is in `IsOpenMPAggregate` and `IsOpenMPScalar`. When the
OpenMP attribute visitor walks the names in the region, it hits the t in
[7 lines not shown]
[AMDGPU] Look through readfirstlane/readlane in computeKnownBitsForTargetInstr. (#224275)
Currently, `computeKnownBitsForTargetInstr` in GISel and
`computeKnownBitsForTargetNode` in SDAG treats
`amdgcn.readfirstlane/readlane` as fully unknown, even though both just
return the data operand's value from some lane. This patch teaches it to
recurse into the data operand (operand 2) and reuse its known bits.
Thus, it unblocks known-bits combines (e.g. redundant_and) that see
these intrinsics while still generic.
[flang] Detect loops whose branching is confined to their body
A DO loop is classified as either structured or unstructured, and a single
raw branch anywhere in its body forces the loop -- and every construct
enclosing it -- onto the unstructured path.
That is stronger than necessary. A loop keeps its structured control flow
as long as its branching neither leaves its body nor enters it from
outside. Classify such a loop separately from a fully unstructured one.
This only classifies: lowering is unchanged. PFT dumps mark the new
classification with '~', which is what the tests key on.
[flang][NFC] Say which control successors are not incoming branches
The map records branches, not every control successor: a construct
transferring control between its own statements is not a branch
(F2023 11.2.1 p1), so the successors analyzeBranches sets directly are
absent from it. Say so, rather than calling the map a plain inverse.
[flang] Record the evaluations that branch to each evaluation
The PFT records where each branch goes, but not where it comes from, so
asking whether anything branches into a construct means walking the whole
procedure.
Record the reverse edges beside the forward ones, and print them in PFT
dumps so both directions of the branch graph are visible.
[libc++][docs] Mark LWG2727 Complete in LLVM 24 (#225606)
In 9853cb54d9d2684b27f0d0db89c00c2da7e31b88 and
672843a3f2ee2aaaed0463ec9064b6ccea2a5d4d, we implemented parallel
versions of `std::min_element`, `std::max_element`, and
`std::minmax_element` without adding incorrect `constexpr`. This
essentially implemented the resolution of LWG2727.
[flang] Lower loops whose branching is confined to their body structurally
Such a loop was classified separately by a previous change but still
lowered as a raw CFG, so its structured form was lost.
Lower it structurally instead, with its body folded into a region that can
hold the branching. The loop keeps its bounds on the op, so it remains
available to whatever transforms or parallelizes it. Only the body is
folded: the loop control statements are emitted as they are for any
structured loop, since a branch from outside may target either of them.
Loops an OpenACC or OpenMP directive owns are lowered the same way, so
they keep their form too.
[flang] Detect loops whose branching is confined to their body
A DO loop is classified as either structured or unstructured, and a single
raw branch anywhere in its body forces the loop -- and every construct
enclosing it -- onto the unstructured path.
That is stronger than necessary. A loop keeps its structured control flow
as long as its branching neither leaves its body nor enters it from
outside. Classify such a loop separately from a fully unstructured one.
This only classifies: lowering is unchanged. PFT dumps mark the new
classification with '~', which is what the tests key on.
[flang][NFC] Say which control successors are not incoming branches
The map records branches, not every control successor: a construct
transferring control between its own statements is not a branch
(F2023 11.2.1 p1), so the successors analyzeBranches sets directly are
absent from it. Say so, rather than calling the map a plain inverse.
[flang] Stop using Operation::getAttrs (NFC) (#223049)
Migrate FIR attribute copying and printing to the explicit inherent and
discardable attribute APIs.
Also upgrade the textual assembly to stop mixing inherent and
discardable attributes in the same dictionary.
This is part of a general migration to use the "new" properties-based
APIs and stop mixing discardable/inherent attributes, see #155475
Assisted-by: Codex
[Mips] Add sync instruction aliases (#225866)
These aliases are documented in the MIPS ISA Reference Manual. These
also exist in binutils and are declared to be part of the MIPS32R2 ISA.
[mlir][ODS] Reuse collective builders for zero-result ops (NFC) (#226059)
Forward the no-result separate-argument builder to its collective
counterpart instead of generating the same operand, attribute, and
region construction twice. This cuts OpenMPDialect.cpp build time by
1.5% and its machine-code text by about 71 KB.
Assisted-by: Codex
[mlir] Reduce Diagnostic storage across standard library debug modes (NFC) (#226070)
The multi-part diagnostic support added a SmallVector of part boundaries
to Diagnostic. With libstdc++'s _GLIBCXX_DEBUG enabled, the two
std::vector members also grow substantially: sizeof(Diagnostic) reaches
288 bytes. This exceeds the 256-byte limit for default
SmallVector<Diagnostic> and breaks Transform dialect builds that use
that type.
Use zero-inline SmallVectors for the owned string buffers and attached
notes. Both collections already allocated when populated, while their
empty representation no longer grows under _GLIBCXX_DEBUG. Give the
part-boundary vector zero inline elements as well: ordinary diagnostics
have a single part and never populate it. Keep the four inline argument
slots, so common diagnostic assembly retains its existing allocation
behavior. Splitting a diagnostic now allocates boundary storage.
On this 64-bit checkout, sizeof(Diagnostic) falls from 224 to 192 bytes
normally and from 288 to 192 bytes with _GLIBCXX_DEBUG.
Assisted-by: Codex
[offload][nfc] Move AsyncInfoTy's definitions to libompaccsupport (#220991)
AsyncInfoTy will be used by both OpenMP and OpenACC. Extract its
implementation from `omptarget.cpp` into `libompaccsupport` so that it
can also be compiled independently by libacctarget.
CodeGen: Respect the exception-model module flag in SjLjEHPrepare (#225726)
Teach SjLjEHPrepare to consult the "exception-model" module flag and
only prepare when the module selects the SjLj model. When the flag is absent
the pass runs as before, implicitly relying on the pass config not running
the pass.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[flang] Record the evaluations that branch to each evaluation
The PFT records where each branch goes, but not where it comes from, so
asking whether anything branches into a construct means walking the whole
procedure.
Record the reverse edges beside the forward ones, and print them in PFT
dumps so both directions of the branch graph are visible.
CodeGen: Derive WinEHPrepare PHI demotion from the personality (#225676)
Previously WinEHPrepare had a catchswitch-only pass option which was
set based on the exception model in the pass config. The only special
case using it was for Wasm EH, which reuses the Windows EH instruction but
does not outline funclets so only needs the catchwitch dispatch phi handling.
Instead check the properties of the personality function inside the pass, so the
pass config is less dependent on knowing the exception model.
Also, make sure the pass is a nop for dwarf EH which appears to be untested.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[lldb] Add a corefile fuzzer (#225103)
Fuzzes the metadata parser when LLDB opens a corefile for Mach-O
and ELF.
The fuzzer writes input data to a tempfile and loads it through
`Process::LoadCore()`, the same way `target create --core` does.
It initializes both the macOS and Linux host platforms so the
core-load path runs regardless of which of the two OSes the fuzzer
itself is built on.
`lldb-target-fuzzer` does not reach any of this. It only calls
`SBDebugger::CreateTarget`, which builds a Target and its executable
Module; identifying that module parses the Mach-O/ELF header and
load/section commands, but never calls `Process::LoadCore`.
---------
Co-authored-by: Jonas Devlieghere <jonas at devlieghere.com>
[mlir][ODS] Share generated attribute property conversion (NFC) (#226057)
Move repeated attribute-backed property assignment and dictionary entry
construction into common helpers. This reduces MLIR build time by saving
optimizer work in large generated dialect translation units while
preserving diagnostics and conversion behavior.
Assisted-by: Codex
[mlir][ODS] Reuse property storage in generated builders (NFC) (#226061)
Retrieve operation properties once in each generated builder that writes
them, then use the same reference for segment sizes, properties, and
attributes. This improved MLIR build time by avoiding repeated storage
lookup, e.g. cuts OpenMPDialect.cpp compiler instructions by 1.2%.
Assisted-by: Codex
[Mips][GlobalISel] Keep split double arguments live across calls (#225879)
Mark both GPRs assigned by custom f64 argument lowering as implicit uses
of the call. Without these uses, dead machine instruction elimination
can remove the copies that pass the argument.
Check call operands after IR translation and optimized FPR-to-GPR
argument passing with FP32 and FP64 register modes.