[Loads][NFC] Add isDereferenceablePointer overload taking a size (#203905)
Quite a few places just end up passing `Align(1)` as the alignment.
Instead, provide an overload of `isDereferenceablePointer` taking a size
instead of a `Type*` and use that.
[SPIRV] Let atomic load load pointers (#202823)
SPIRV atomic load permits only integer or floats as per SPIRV spec. When
compiling libc there several places in the code where pointers are
atomically loaded causing compilation to break. It can be fixed by using
casting in the libc code but in order to keep the libc code clean it is
preferrable to do it in SPIRV backend. This change will cast pointer
parameter to a pointer to integer of appropriate size and generate
atomic load instruction that uses integers per SPIRV spec. The value
returned by atomic load is casted to an original pointer type
---------
Co-authored-by: Dmitry Sidorov <dsidorov at amd.com>
[libc] Add Endian::from_{big,little}_endian (#203895)
This is actually the same function as its to_ counterpart, but it lets
us correctly express the intent.
The functions are already useful for implementing ntoh?, but I'll add
other uses of them soon.
[flang][OpenMP] Parsing and semantics of locators as part of OmpObject
Allow function call references and reserved locator names as parts of
OmpObject. Function calls and array element accesses have the same syntax,
and the OmpObject parser will parse them as function calls. This is then
corrected (if needed) immediately after the name resolution is complete.
There are no clause-specific semantic checks of proper locators. Existing
code will check if a proper locator is specified on a clause that allows
it.
Lowering of proper locators to MLIR is not implemented, and a TODO
message is emitted.
[mlir][linalg] Add maps-based inferConvolutionDims overload (#203323)
This PR adds an overload of `inferConvolutionDims` that takes only
indexing maps (input, filter, output), mirroring the maps-based
`inferContractionDims` overload added in #76081, along with the
corresponding C API and python bindings.
Assisted by: Claude-code
[GlobalISel] Add known-bits for G_INSERT_VECTOR_ELT. (#200930)
This adds known-bits for G_INSERT_VECTOR_ELT, mostly a copy of the SDAG equivalent code.
[mlir] Use explicit op targets for region successors (#203552)
Replace the RegionSuccessor parent sentinel with an explicit Operation *
target. Operation successors now model continuing after that operation,
while region successors continue to point at Region.
Update RegionBranchOpInterface helpers, analyses, and dialect
implementations to use operation successors. This removes the ambiguity
of interpreting parent relative to whichever operation produced the
successor when introducing early-exits.
For downstream integration for this API change:
- `successor.isParent()` -> `successor.isOperation()`
- `RegionSuccessor::parent()` -> RegionSuccessor(op)` ; that means that
you need to have access to the target op. In general it is either
`getOperation()` or `getParentOp()` (depending if you're updating a
method on the `RegionBranchOpInterface` operation or on the terminator.
Assisted-by: Codex
[flang][OpenMP] Parsing and semantics of locators as part of OmpObject
Allow function call references and reserved locator names as parts of
OmpObject. Function calls and array element accesses have the same syntax,
and the OmpObject parser will parse them as function calls. This is then
corrected (if needed) immediately after the name resolution is complete.
There are no clause-specific semantic checks of proper locators. Existing
code will check if a proper locator is specified on a clause that allows
it.
Lowering of proper locators to MLIR is not implemented, and a TODO
message is emitted.
[mlir][emitc] Support member access for values (#203308)
The `emitc.member` op is currently limited to taking lvalues of opaque
types representing structs and returning either lvalues or arrays of its
fields. Accessing members of SSA values of opaque types, therefore,
requires assigning them to an `emitc.variable`, applying `emitc.member`
to it and `emitc.load` to the member's lvalue. For users only wishing to
read members of a struct value, this should be redundant.
This PR extends `emitc.member` to handle struct values directly by
accepting opaque types as argument, as long as the result type is
neither an lvalue nor an array, which imply memory location. This
provides similar semantics to extracting elements out of SSA
tensors/vectors.
[CHERI] Add a Support utility for determining alignment requirements of CHERI capabilities. (#197402)
On CHERI systems with compressed bounds representations (which is all of
them that anyone cares about today), one of the tradeoffs to achieve
that compression is a requirement for larger allocations to be more
highly aligned. This impacts both code generation and linking in places
where globals need to be aligned and/or padded based on this
requirement. The specific alignment requirements vary by capability
format.
Co-authored-by: Alex Richardson <alexrichardson at google.com>
[AMDGPU] Track LDS DMA VGPR source reads in expert scheduling (#203292)
LDS DMA instructions are marked as VALU but we need to treat them as
FLAT instructions for expert mode waitcnt insertion. This meant we were
missing a `vm_vsrc` wait for WAR and RAW on input registers of the LDS
DMA instruction.
I added lit tests for other memory ops as well to catch future
regressions.
[flang] Extract misparsed function reference check into function
Function calls and array element acceses have the same syntax, and some
array element accesses may be misparsed as calls. The ExprChecker will
identify and correct such cases in expressions, but they may also occur
outside of expressions (e.g. OpenMP directives and clauses).
To avoid code duplication extract the check into a new function
`IsMisparsedFunctionReference`.
[Dexter] Add condition check to state nodes
This patch enables the ability for state nodes to check conditions, meaning
they will be active only if the condition is met.
Condition evaluation is somewhat language specific; we directly check
whether the value of the evaluated expression is "true" (case-insensitive),
which works for the languages we actually use Dexter with, but may require
generalizing in future.
We also cache conditions as they are evaluated; each time we step, we clear
all cached conditions for the current frame and any expired frames, but we
keep the cached conditions for any frames rootwards from the current frame;
this prevents us from unexpectedly exiting out of a callee frame because of
debug info not surviving a stack unwind; if the early exit is desired, an
!and{at_frame_idx, condition} under the lower frame may suffice.
[Dexter] Add !address node
Adds a node type for Dexter that allows checking abstract labels instead of
concrete addresses. Each address node has a label and optional offset, and
the first time during evaluation that a given address label is matched
against a valid pointer value, the address label will be assigned a value
that matches the seen address (adjusting for any offset). From that point,
the resolved address value will be used for the remainder of the test
evaluation.