[clang][modules] Add test coverage on module map resolution, NFC (#230569)
* In ScanDeps test, capture which modulemap gets resolved as fmodule-map
dependency.
* In Modules test, capture how adding relocation checks can alter the
ordering of serialized input files.
[SemaHLSL] Add missing validations of existing semantics (#224139)
This pr adds the following semantic analysis for semantics:
- Validate scalar/vector shapes, element types, and supported widths for
system semantics
- Enforce indexing restrictions and SV_Target bounds
- Add diag that shows previous use of overlapping semantics
- as well as, simplifying some related sema logic.
Resolves #189765
Assisted by: GPT-6 Astra
[mlir][LLVM] Use a disjoint scope domain when inlining noalias
This matches recent changes to the LLVM inliner.
AI disclosure: Claude wrote the code, I wrote the commit message and
have done initial review.
[mlir][LLVM] Add disjointScopes to AliasScopeDomainAttr
This also updates the MLIR-side inliner to clone disjoint domains
while cloning alias scopes, matching changes to LLVM.
AI disclosure: Claude wrote the code, I wrote the commit message and
looked at the code.
[AI test fix] Use property syntax for alias scope attributes
The strict-properties assembly format change means inherent attributes
such as `alignment`, `alias_scopes` and `noalias_scopes` on
`llvm.load`/`llvm.store` can no longer be parsed out of the trailing
attribute dictionary. Switch the newly added tests to the `<...>`
property syntax already used by the rest of these files.
[AMDGPU] Use a disjoint scope domain for merged LDS structs
When lowering LDS values, all the values are mutually disjoint, so we
can use the newly-added disjoint scopes feature to simplify the IR.
AI disclosure: Claude wrote this and I reviewed it and wrote the
commit message
[AMDGPU] Use a disjoint scope domain for noalias kernel arguments
All noalias arguments of a kernel are disjoint with each other, so we
can use a disjoint scope to save on metadata construction.
AI disclosure: Claude wrote this, I looked at it and wrote this
message.
[Inliner] Use a disjoint scope domain for noalias arguments
InlineFunction creates alias.scope/noalias metadata to represent the
set of `noalias` arguments to a function. We don't need the `!noalias`
now that we have the ability to use disjoint scopes, saving us IR size
and metadata bloat.
TODO move these to a previous commit.
Also changes InstCombine to not drop the experimental.noalias.scope.decl
for disjoint scopes even if they're not mentioned in a `!noalias`, but
do still delete them if they're not used.
[SLP]Do not copy disjoint to widened reduction ops
i1 leaves constrain bit 0 only, and an or of the narrowed chain may
overlap its operands. Copying the disjoint flag to the emitted wide ops
is a miscompile.
Fixes #230419
Reviewers:
Pull Request: https://github.com/llvm/llvm-project/pull/230624
[CIR][OpenMP] Add support for the OpenMP 'for' directive
This patch adds support for wsloop in ClangIR: the `for` directive and its
combined forms `parallel for` and `target parallel for`. This is lowered to an
omp.wsloop + omp.loop_nest, nested utilizing the existing queue-based
decomposition.
Assisted-by: Cursor / Claude Sonnet 5 High
[RISCV] Correct violations of SDTCisSameNumEltsAs. (#230612)
We missed a conversion to scalable vector in
lowerVectorMaskVecReduction.
lowerINSERT_SUBVECTOR used an all 1s mask with the wrong type. This made
a call to getDefaultVLOps unnecessary as both of its Mask and VL are
overridden.
Assisted-by: Claude
CodeGen: Compute live-outs of a split critical edge while updating LiveIntervals (#230499)
Fill in the new block's live-out set in the same loop that updates the
live intervals, instead of walking the original block's set a second
time with another liveAt query per register. A register is live out of
the new block if it is a PHI source or is live into Succ, which the
update already checks.
Instructions retired in phi-node-elimination, x86_64 -O3, on a generated
chain of N compare blocks branching to a shared PHI block:
N before after after/before
1k 94,119,121 88,904,465 0.94
2k 353,559,942 330,642,394 0.94
4k 1,201,233,649 1,136,359,710 0.95
8k 4,305,218,922 4,136,184,186 0.96
16k 16,076,293,247 15,539,552,966 0.97
gcc-c-torture compile/20001226-1.c (liveintervals,phi-node-elimination
[2 lines not shown]
[flang][CUDA] Safely verify registered kernel symbols (#230588)
`cuf.register_kernel` resolved GPU module and kernel symbols during
nested function verification, potentially racing with concurrent changes
to the sibling GPU module. Add `SymbolUserOpInterface` and move these
lookups to `verifySymbolUses()`, where they run as part of module-level
symbol verification while the sibling IR is stable.
Associate a BLOCK across ignored compiler directives
A standalone METADIRECTIVE that selects a block-associated directive
takes the BLOCK that follows it. An ignored compiler directive between
them, such as !dir$ ignored_comment, ended the search, so the selected
TARGET was empty and the BLOCK was lowered outside it.
Skip the compiler directives that semantics reports as ignored (an
unrecognized directive, a bare name/value list, LOOP COUNT, and
ASSUME_ALIGNED) and move them with the BLOCK as the DO path does. Other
compiler directives, such as PREFETCH, still end the search like any
statement.
[flang][cuda] initialize the CUDA module after all units register managed variables (#230350)
With relocatable device code, every unit registers its managed variables
on the same CUDA module, and the runtime does not fill variables
registered after the module is initialized. Move CUFInitModule to a
second constructor with the next priority value, so that it runs after
the registration constructors of every unit in the executable or shared
library.
This will fix segmentation fault in example like:
```
module m1
integer, managed :: x1
contains
attributes(global) subroutine k1()
x1 = 1
end subroutine
end module
[20 lines not shown]
[SeparateConstOffsetFromGEP] Track cast state during offset extraction (#229839)
Keep the cast state used while searching for a constant offset and reuse
it when rebuilding the GEP index. This lets constants be extended or
truncated at the point where they are found, instead of carrying
separate sign/zero extension flags and then redistributing casts in a
second pass.
This also allows the RHS-of-sub zero-extension case because the constant
is zero-extended before it is negated.
RuntimeLibcalls: Require system library members to be libraries (#230306)
Every SystemRuntimeLibrary now lists only LibcallLibrary and LibraryRef
members, so the inline path that expanded unhomed RuntimeLibcallImpl
members directly into the system's block is dead. Remove it, and error
on any member that is not a library.
This drops the SystemAvailableImpls bitset and the predicate groups
from the system setup function. Conditional and calling-convention
groups now only appear inside a LibcallLibrary, whose own setup
function emits them. The generated RuntimeLibcalls.inc is unchanged.
Co-authored-by: Claude Opus <noreply at anthropic.com>