[PowerPC] Use the 16-byte stack and vector alignment on OpenBSD (#245115)
The 64-bit PowerPC data layout appends the stack and vector alignment
components only for AIX, Linux and FreeBSD, so powerpc64-openbsd gets a
shorter layout. OpenBSD also uses the ELFv2 ABI on powerpc64, so there
is no ABI reason for the difference. Without them the natural stack
alignment is left unspecified, which can cause unnecessary dynamic
stack realignment.
Follow-up to #232336, which did the same for FreeBSD.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[CIR] Translate offloading entry attributes to LLVM IR (#241233)
Let -fgpu-rdc reuse llvm::offloading::emitOffloadingEntry instead of
rebuilding the entry layout in CIR
[mlir][SPIR-V] Add spirv.INTEL.FunctionPointerCall op (#245282)
Add OpFunctionPointerCallINTEL from SPV_INTEL_function_pointers for
indirect calls
The verifier checks arguments and result against the pointee function
type
[analyzer] Avoid redundant ProgramState refcounting and copies (#244848)
Every ProgramState retain and release was an out-of-line call, and
creating a state copied it twice: callers build a temporary copy, and
getPersistentState copied that again into the uniqued slot before the
temporary was destroyed. Each copy also retains the store through a
virtual call, and RegionStore's retain/release built a temporary
RegionBindingsRef, adding two more refcount operations.
- Inline the ProgramState retain and the release fast path. The
IntrusiveRefCntPtrInfo members are templates so they are instantiated
only where ProgramState is complete; freeing stays out of line.
- Give ProgramState a move constructor and move the temporary into the
persistent slot.
- Give StoreRef move operations and use them when consuming a StoreRef.
- Retain/release the RegionStore tree root directly.
- Pass ProgramStateRef by const reference along the node creation path
(CheckerContext::addTransition and friends, CoreEngine::makeNode,
ExplodedGraph::getNode).
[10 lines not shown]
[AARCH64] Fix failing builtin tests (#245400)
A recent change to add SVE vector kind information in CIR missed a few
tests in the clang/test/CodeGen/AArch64/sve directory. This change
updates those tests.
[flang][OpenMP] Evaluate composite DISTRIBUTE clauses outside PARALLEL
In composite DISTRIBUTE PARALLEL DO [SIMD], lowering creates omp.parallel
first, nests omp.distribute inside it, and lowers the DISTRIBUTE clauses
inside the parallel region. Take
```
!$omp teams distribute parallel do dist_schedule(static, chunk(n))
```
where chunk has variants for construct={teams} and construct={parallel}.
Flang currently emits
```mlir
omp.teams {
omp.parallel {
%c = fir.call @parallel_chunk(...)
omp.distribute dist_schedule_static dist_schedule_chunk_size(%c) {
```
[23 lines not shown]
[CodeGen] Clarify LiveStacks test comments
Say what to observe in the spill slot test to tell that the slots
were not merged, and make the unit test comment self-contained.
Only rewrite VPExpandSCEVRecipe users that are dominated by the stride check
This "regresses" the code a bit, including relative to LAA-based side
speculation - see
`@stride_dependent_btc`/`@stride_dependent_btc_non_preventive`. We'd
probably need bigger changes around `VPlan::getTripCount` if we'd want
to optimize that in a safe manner.
[Clang][SYCL][Object] Compile SYCL device code once per IGCA target (#239010)
Compile SYCL device code once per IGCA target.
Several Intel GPUs can share an IGCA target, e.g. `xe-mtl-u` and
`xe-mtl-h` are both `igca_30r`.
Until now, `-fsycl --offload-arch=xe-mtl-u,xe-mtl-h` compiled the device
code once per GPU.
Now it is compiled once for `igca_30r`, and then for both GPUs with a
single `ocloc -device xe-mtl-h,xe-mtl-u` call.
The device image records the GPUs, as
`arch=igca_30r,code=xe-mtl-h,xe-mtl-u`.
`clang-linker-wrapper` links device code with the same `arch` and `code`
together, passes the GPUs to `clang-sycl-linker` with a new hidden
`--code=` option, and merges the results into one offload binary, as the
SYCL runtime loads only one. To decide which device images are linked
together, `OffloadFile::TargetID` is now a struct with `Triple`, `Arch`
and `Code` instead of a `std::pair`, so that `areTargetsEquivalent` and
[13 lines not shown]
[flang][OpenMP] Evaluate composite DISTRIBUTE clauses outside PARALLEL
In composite DISTRIBUTE PARALLEL DO [SIMD], omp.distribute is nested
inside omp.parallel, and the DISTRIBUTE clauses were evaluated after
omp.parallel was created. A DECLARE VARIANT call in the DIST_SCHEDULE
chunk-size expression therefore matched construct={parallel}, although
DISTRIBUTE encloses PARALLEL in the source, and every thread evaluated
the expression.
Evaluate the DISTRIBUTE clauses before creating omp.parallel, as for the
explicit nesting, and destroy their temporaries once, after omp.parallel.
Fixes #244760
Assisted-by: GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot at users.noreply.github.com>
[flang][OpenMP] Build the variant construct context from source nesting
Currently, METADIRECTIVE and DECLARE VARIANT selection builds the
construct trait set by walking the MLIR operations around the insertion
point, and that nesting doesn't always match the source. For
```fortran
!$omp teams distribute parallel do
do i = 1, n
a(i) = f()
end do
```
lowering creates omp.teams > omp.parallel > omp.distribute > omp.wsloop,
so the walk sees DISTRIBUTE inside PARALLEL. For
```fortran
!$omp atomic update
x = x + f()
[21 lines not shown]
[mlir][openacc] Anchor OffloadLiveInValueCanonicalization on FunctionOpInterface (#245399)
In preparation to use the pass in the CIR/OpenACC pipeline, CIR uses
cir.func that implement the FunctionOpInterface so the pass is better
anchored on it than func.func.
[clang][Sema][ThreadSafety] Accept attributes without arguments as meaning 'this' (#242937)
An attribute such as ACQUIRE or RELEASE without capability arguments is
documented to refer to 'this': the analysis translates it to the self
argument of the call (ThreadSafetyAnalyzer::getMutexIDs). But Sema
accepts one only on a non-static method of a capability class, and
elsewhere warns, even though it keeps the attribute.
On a function pointer field, the meaning of such an attribute has slowly
changed without being explicitly proposed. d1e84bb9ad3b (#191187)
allowed these attributes on function pointer fields. A call through a
field had no self argument then, so such an attribute on a field
translated to no capability and was dropped. dfeadc6b0836 (#231602) made
the base of the member access the self argument of a call through a
field, so that the attribute could name a sibling member. As a side
effect, an attribute without arguments on a field came to name that
object, as it does on a method. For
struct CAPABILITY("mutex") Node {
[39 lines not shown]
[clang][Sema][ThreadSafety] Name a member through 'this' in a parameter's attribute (#241077)
When parsing a parameters attribute, `this` wasn't in scope, so it
turned into a `DeclRefExpr`, which got turned into a wildcard for `&mu`
or matched nothing for `mu`. But the `DeclRefExpr` was only supposed to
turn into a wildcard for `&S::mu`, not to unexpectedly degrade accuracy
in all cases when parsing was imprecise. For example, in:
struct S {
Mutex mu;
void run(void (*cb)() REQUIRES(mu));
};
The analysis then read 'mu' as no particular object, matching no held
capability, so 'cb()' warned with 'mu' held; and '&mu' as the wildcard
'&S::mu', matching the 'mu' of any object.
This PR now parses a parameter's late-parsed attributes in the
function's scope, along with the function's own: at the end of the
[16 lines not shown]
[flang][OpenMP] Build the variant construct context from source nesting
METADIRECTIVE and DECLARE VARIANT selection collected the construct trait
set by walking the MLIR operations that enclose the current insertion
point. Those operations do not match source nesting: only some
constructs create an operation, composite constructs nest their
operations in a different order, and a clause is emitted wherever the
operation it belongs to is being built.
Collect the context from the source instead. The OpenMP constructs that
enclose the current PFT evaluation give the context of a statement. A
frame is recorded for each construct region entered while lowering an
evaluation, so that a clause sees the outer leaf constructs of its
compound directive. A METADIRECTIVE contributes the directive it
selected.
No functional change is intended. The context still contains only the
constructs counted before: TARGET, TEAMS, PARALLEL, DO, SIMD and
DISPATCH. Counting the remaining enclosing constructs is left to
[11 lines not shown]
[flang][OpenMP] Require an enclosing SIMD for construct={simd}
A construct={simd} selector without properties was ignored, because SIMD
is a predefined trait selector name (it can take clause properties)
rather than a directive name. A DECLARE VARIANT or METADIRECTIVE
alternative that requires SIMD was therefore selected everywhere,
including outside any SIMD construct.
Record the SIMD construct trait for such a selector. Lowering builds the
construct trait set from the enclosing MLIR operations, so also recognize
omp.simd there; otherwise calls inside SIMD would no longer match.
Fixes #244759
Assisted-by: GitHub Copilot
[SLP]Handle CouldNotCompute GEP pointer diff
getMinusSCEV returns CouldNotCompute for different pointer bases.
SCEVs cached before LCSSA formation make that possible for GEPs on
the same pointer operand; isLoopInvariant then crashed.
Fixed #245379
Pull-request: https://github.com/llvm/llvm-project/pull/245398
[X86] isGuaranteedNotToBeUndefOrPoisonForTargetNode - add X86ISD::VBROADCAST_LOAD/SUBV_BROADCAST_LOAD handling (#245057)
Similar to #241972 - inspect constant loads by
X86ISD::VBROADCAST_LOAD/SUBV_BROADCAST_LOAD nodes for UNDEF/POISON
pr45443.ll - fixes regression from #243097
[analyzer] Avoid redundant lookups when removing dead bindings (#244748)
RegionStoreManager::removeDeadBindings looked up every cluster it was
already iterating over to check whether it was visited. SymbolReaper
re-walked the dependents of symbols that were already marked live and
looked up symbols twice. This reduces the instructions of analyzing some
LLVM TUs by about 1%.
Assisted-by: Claude Opus 5.5
---------
Co-authored-by: Gabor Horvath <gaborh at apple.com>
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
[RISCV][P-ext] Rename pabs/pabd intrinsics to match latest spec. (#245321)
The type suffix should be unsigned to match the return type.
Spec change: https://github.com/riscv/riscv-p-spec/pull/383