[CIR] Implement ArgKind::Expand in CallConvLowering (#201718)
ArgKind::Expand classifies a struct argument for flattening: each field
becomes a separate scalar argument at the ABI level. Classic CodeGen
calls this "struct expansion" — used on targets like MIPS and some ARM
calling conventions.
CIRABIRewriteContext previously emitted errorNYI at both classification
sites. The replacement covers three call paths. In buildNewArgTypes,
the original struct type is replaced by one wire type per field. In
insertArgCoercion, the single struct block argument is replaced by N
scalar block arguments and an alloca+get_member+store+load sequence at
the entry block reassembles them for body uses; a running block-argument
index (rather than classIdx + sretOffset) correctly tracks the expanded
slot count when multiple Expand args or sret+Expand combinations appear.
The Ignore-drop loop gains a classToBlockArg pre-computation so that
Ignore args following Expand args are erased at the correct index. In
rewriteCallSite, cir.extract_member decomposes the struct operand into
its constituent fields, which become separate call arguments.
[2 lines not shown]
[clang][index][USR] GenLoc prints file entry at most once, allow repeated offsets (#205430)
`GenLoc` previously printed the source location at most once per USR,
gated by a member flag toggled on the first call. During the recursive
visit, if both an outer and an inner decl needed to print the location,
only the outer one was printed. When the outer decl did not need the
offset, no offset was ever printed. For example, the USR of
`Holder<decltype([]{})>::method` depends on the location of the type of
the lambda but the outer decl prints the file entry only, which disables
offset printing.
Change the logic so the file-entry part of the location is printed at
most once (it must be identical), while offsets of sub-decl locations
may be printed multiple times.
rdar://180654884
---------
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
[Offload] Unify the kernel argument passing (#205224)
Summary:
Currently we have two conflicting methods of passing kernel arguments, a
flat pointer + size and an array of pointers. We recently decided to
move the offload API to the latter because it is more generic and lets
you construct the other formats.
This PR primarily just changes the format and the one existing core use.
The uses should be simplier now. Future changes will change the OpenMP
argument parsing.
[Clang] Disable C++ exceptions by default for GPU targets (#205402)
Summary:
Exceptions are not supporter, and likely will never be supported, on
GPUs. The SIMT model makes context switching nearly impossible, and
building an unwinder would require stashing a register file that is
over 8 KiB these days. There's precedent to disable this for the target,
so we should just do this.
Offloading languages have their own weird handling, some chimera that
just accepts exceptions but turns them into traps on the device side, so
we leave that unaffected.
[mlir] Fix visitor block erasure (#205854)
I made the visitor test drop block-defined value uses before erasing the
block and added a small regression case.
Fixes #205717
AMDGPU: Avoid default subtarget in hand-written codegen tests (9/9) (#205792)
Fix some manual test checks using amdgcn triples without -mcpu. These
require the most careful consideration. The highest impact changes are the
optimizations removing execz branch now that there's a sched model.
AMDGPU: Avoid default subtarget in hand-written codegen tests (8/9) (#205791)
Introduce the missing -mcpu argument to some tests which are not
autogenerated.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
AMDGPU: Avoid default subtarget in hand-written codegen tests (7/9) (#205790)
Introduce an -mcpu argument to tests missing it to avoid codegening
the default dummy target. These are cases that didn't require adjusting
the check lines.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
[VPlan] Remove unused VPlanPrinter::getOrCreateName(const VPBlockBase*) (#205896)
The block-name printers use getName()/getUID() directly; this overload
has no callers.
[flang][OpenMP] Move clause validity checks into OpenMP-specific code (#205607)
The checks for syntactic properties of clauses (e.g. uniqueness, being
required, etc.) were originally handled by infrastructure common to
OpenMP and OpenACC. That infrastructure, however, is not fully equipped
to handle OpenMP needs: being unable to express version-based properties
or clause set properties being two prominent examples.
The first step towards fulfilling the OpenMP requirements it is to
transfer the handling of clause validity checks into OpenMP-specific
code, which can then be modified without interfering with OpenACC.
In addition to that, this PR also changes the way that clauses on end-
directives are handled: first, a clause appearing on an end-directive is
checked to be allowed to appear on an end-directive, then all clauses
from the begin- and the end-directives are tested together. This unifies
checks for uniqueness of clauses that can appear in both places.
[clang-doc] Try to make testing more uniform
Today clang-doc has tests for its various backends that use the same
input files, and mix the checks for each format. This leads to very
large test files that are quite hard to update or maintain. Thus far
we've assumed that this is better than updating several files, but as we
leverage mustache and JSON more and more to test feature completeness,
much of the output complexity is now limited to each backend and its
mustache templates. To make this simpler to maintain, we can lean into
common test Inputs keeping the annotate source separate from the test
checks, and split the checks out into their own directory hierarchy.
This patch is mostly mechanical rewriting of code. This was done with
the assistance of an LLM, but was checked by me, and verified with
instrumentation based coverage that we did not lose any line coverage.
AMDGPU: Avoid default subtarget in hand-written codegen tests (6/9) (#205789)
Introduce -mcpu arguments in tests which didn't require check line
updates.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
AMDGPU: Avoid default subtarget in hand-written codegen tests (5/9) (#205788)
Introduce -mcpu arguments in tests that did not need check line updates.
Co-Authored-By: Claude <noreply at anthropic.com> (Claude-Opus-4.8)
[clang-format] annotate inline assembly parens (#201703)
Annotate the opening and closing parens of inline assembly. This will
make other improvements related to inline assembly easier.
[GettingInvolved] Add wg-hlsl to online sync ups (#205891)
This has been on the community calendar for a very long time, but
apparently we never added it here.
[VPlan] Handle loads feeding memops in makeMemOpWideningDecisions (NFC) (#196842)
The legacy cost model force-scalarizes loads feeding memory ops, unless
the target prefers vector addressing. Add the logic to
makeMemOpWideningDecisions. Currently this should match the legacy
decision as-is. Should be test-able in VPlan-printing test if legacy
decisions are done in a separate sub-pass as
https://github.com/llvm/llvm-project/pull/182593
PR: https://github.com/llvm/llvm-project/pull/196842
[llvm][NFC] Add invariant.load intrinsic precommit tests (#205894)
Add tests to show what does/doesn't currently happen to !invariant.load
on intrinsics that read memory.
AI disclosure: Codex wrote these. They got put into new files in many cases and I _think_ that's a reasonable call.
Co-authored-by: Codex <codex at openai.com>
[Flang-RT] Make __cuda_builtins dependency explicit (#205895)
When compiling CUDA-Fortran, a use of the module __cuda_builtins is
added implicitly by the compiler. Add explicit use so CMake can consider
it in the built order. The other modules that are compiled with CUDA
enabled (`cudadevice.f90` and `cooperativegroups.f90`) transitively
depend on depend on __cuda_builtins as well.
[DirectX] Widen i1 indexable temps to i32 in DXILDataScalarization (#205444)
fixes #205443
Dynamically-indexed <N x i1> vectors were lowered to alloca [N x i1]
indexable temps. DXIL booleans are 32-bit in memory, and i1 stack arrays
are mishandled downstream (e.g. WARP returns 1 for every
dynamically-indexed element), producing wrong results for dynamic
bool vector/matrix accesses.
Widen i1 indexable-temp arrays to [N x i32], zero-extending on store and
truncating back to i1 on load, matching DXC. Fixes the dynamic bool
extract/insert miscompile.
We make this change in DXILDataScalarization because this is the pass
that adds the i1 allocas which was the cause of our miscompile.
Assisted by Claude Opus 4.7
[OpenACC] Propagate variable names to ops after materializing recipes. (#205821)
ACCRecipeMaterialization only attaches names to the result of the recipe
being materialized. However, some recipes produce multiple ops that need
to carry the variable name.
This change introduces `acc::getVarNamePlaceholder()`, a placeholder
value for `acc.var_name`. Implementations can attach this placeholder
while building the recipe to any ops that should carry the variable
name. ACCRecipeMaterialization will then replace the placeholder with
the actual variable name while materializing the recipe.
Assisted-by: Claude Code