This PR upstreams a piece of infrastructure from Swift's LLVM fork. This
allows adding custom wrappers around the `FrontendAction` that compiles
Clang modules from a module map into a PCM file. This will be used to
implement modules support in the CAS-based compilation caching mode.
Previously only the old barrier name was implemented. Define this
as an indirection around the new name, and move it to common code.
The target implementations are already provided by
__clc_work_group_barrier,
so targets were unnecessarily duplicating these.
This also fixes the default scope, which should be
memory_work_group_scope. Previously this was guessing that
if the flags included global memory, it makes the scope
device which is not the case.
Synthetic providers for collection types use a child name format of
"[N]".
This `ValueObjectSynthetic` to automatically convert child names in this
convention to the index embedded in the subscript string. With this
change, synthetic formatters for collections will only need to implement
`GetIndexOfChildWithName` or `get_child_index` for non-indexed
collection children. Some examples of non-indexed children are
`$$dereference$$` support, or "hidden" children.
The automatic conversion applies to N values that are less than the
number of children reported by the synthetic provider.
Detect cmd.exe special status code 9009 that indicates "command not
found" condition. Crash the process if "command not found" detected when
CMDSTAT was not specified.
lldb is printing an error that the kext-loaded notification breakpoint
can't be set when debugging a kernel corefile. The breakpoint only needs
to be inserted in live debug sessions.
rdar://170813438
This PR refactors Transpose Op Layout Propagation:
1. Add inferTransposeSourceLayout() to layout utility, enhance layout
propagation and conflict handling to use this function
2. Add Layout utility: TransposeDims()
3. Refactor IsTransposeOf() and fix minor bugs
4. Fix minor issue in dropSgLayoutAndData()
The Fortran standard does not allow `PARAMETERS` within a
`namelist-group-object`, it should only allow variables. An error should
be emitted when a `PARAMETER` is found within a `namelist-group-object`.
Fixes: #178955
Implement the remaining CIR lowerings for the AdvSIMD (Neon)
`vceqz{|q|d|s}_*` intrinsic group (bitwise equal to zero).
The `vceqzd_s64` variant was already supported; this patch completes
the rest of the group [1].
Tests for these intrinsics are moved from:
* test/CodeGen/AArch64/neon-misc.c
to:
* test/CodeGen/AArch64/neon/intrinsics.c
The implementation largely mirrors the existing lowering in
CodeGen/TargetBuiltins/ARM.cpp.
`emitCommonNeonBuiltinExpr` is introduced to support these lowerings.
`getNeonType` is moved without functional changes.
Reference:
[1] https://arm-software.github.io/acle/neon_intrinsics/advsimd.html#bitwise-equal-to-zero
Simplify looking for a specific clause in OmpDirectiveSpecification.
This is alternative to DirectiveStructureChecker::FindClause for when
the internal checker structures have not yet been updated in the AST
traversal.
The specification doesn't really forbid the colon notation to be used to
specify the full array. Reference compiler accepts this and our lowering
can already handle it.
I found that the `SupportedRoundMode` pattern for true16 mode is removed
in https://github.com/llvm/llvm-project/pull/177069 by mistake. Added it
back in this patch and add gfx11 to the test which runs true16 mode
`fir::ConvertOp` implements both `ViewLikeOpInterface` and
`OutlineRematerializationOpInterface`. `fir.convert` is also used for
ptr-to-int conversions like `(!fir.ref<i32>) -> i64`. That is not really
a "view" — it converts a pointer to an integer — but
`ViewLikeOpInterface` is still attached, so `getOriginalValue` traces
through it to the underlying value.
When the underlying value is not a rematerialization candidate (e.g.,
`fir.alloca`, a block argument, or a `fir.call` result),
`isRematerializationCandidate` returns false and the `fir.convert` is
left as a live-in. This prevents `ACCImplicitData` from tracing back to
the original pointer to create the data mapping.
This PR:
1. Registers `fir::ConvertOp` with
`OutlineRematerializationOpInterface`.
2. Adds a fallback in `isRematerializationCandidate`: when the traced
original op is not a candidate, check the direct defining op (the
`fir.convert` itself) for `OutlineRematerializationOpInterface`.
```fortran
subroutine test()
integer :: x
!$acc declare create(x)
!$acc parallel
x = 1
!$acc end parallel
end subroutine
```
Before: CSE merges `fir.convert` outside the region; `ACCImplicitData`
cannot map the pointer.
After: `fir.convert` is sunk/rematerialized inside the ACC region
regardless of its input source.
This patch performs small cleanups and fixes in the AArch64 builtins
lowering code, with the goal of aligning the CIR path more closely
with the existing Clang CodeGen implementation.
Changes include:
* Make sure that `noundef` is consistently matched using `{{.*}}`.
* Rename `AArch64BuiltinInfo` to `armVectorIntrinsicInfo` for better
consistency with the original CodeGen implementation.
* Simplify `emitAArch64CompareBuiltinExpr`, fix an incorrect
assert condition (missing `!`) and make sure to use the input `kind`
condition instead of hard-coding `cir::CmpOpKind::eq`.
* Improve and clarify comments.
No functional changes intended (NFC).
Introduce two new codegen operations to the acc dialect that model GPU
compute region execution and parallel launch configuration:
- acc.par_width: specifies a parallel dimension.
- acc.compute_region: wraps a region of code for GPU execution,
capturing
launch configuration (from acc.par_width results) and input values as
block arguments.
These operations bridge the gap between high-level OpenACC compute
constructs (acc.parallel, acc.kernels, acc.serial) and gpu.launch. The
passes that do these transformations will soon follow.
---------
Co-authored-by: Scott Manley <rscottmanley@gmail.com>
This adds support for calling operator delete when an exception is
thrown during initialization following an operator new call.
This does not yet handle the case where a temporary object is
materialized during the object initialization. That case is marked by
the "setupCleanupBlockActivation" diagnostic in deactivateCleanupBlock
and will be implemented in a future change.
This reverts commit 7ad2c6db54a0e77249f2edb3c589ccf4c930d455.
PR #183395 introduced the `exact` flag to `index_cast` and
`index_castui` and updated some canonicalization patterns.
These canonicalization patterns were found to be unsound. For example:
* `index_cast(index_cast(x)) -> x`
* where one first truncates and then widens x
the rewrite is unsound because information is lost on the first cast as
it **may** truncate the value of x, therefore losing information. The
`exact` flag was made to make this transformation sound. Its semantics
are that when the `exact` flag is present, then it is assumed that the
operand to index_cast does not lose information (i.e., fits perfectly in
the destination type).
In PR #183395, the canonicalization rule was rewritten such that would
only match where the inner index_cast had the `exact` flag set.
* `index_cast(index_cast(x, exact)) -> x`
* where source type and destination type are the same
A post-merge review
[highlighted](https://github.com/llvm/llvm-project/pull/183395#discussion_r2880422529)
that the pattern above also disallows the following correct pattern:
* `index_cast(index_cast(x)) -> x`
* when the first index widens and the second one truncates.
Unfortunately the semantics of `index` are such that its bitwidth is
target specific. Attempts were made in
https://github.com/llvm/llvm-project/pull/184631 to automatically add
annotations were possible but no agreement was reached on the best way
to do this. Adding to the disagreement are the following points:
* [there are other unsound patterns that assume index is
64](https://github.com/llvm/llvm-project/pull/184631/changes#r2885181291)
* [The semantics of index is
contested](https://discourse.llvm.org/t/index-type-and-assumption-about-bitwidth/88287)
This lead to the belief that a reversal and an RFC would be a good
approach to get some consensus from the community before proceeding
further.
Add the Gather functions for Texture2D. Variations for all components
are added (Red, Blue, Greed, Alpha). If targeting Vulkan then the
GatherCmp* function for a component other than 0 will result in an
error, as that will lead to invalid SPIR-V.
Part of https://github.com/llvm/llvm-project/issues/175630.
Assisted by: Gemini
Commands such as `clang -- ''` hit two different crash bugs: a buffer
overflow caused by using a `memcmp` that might be larger than the input,
and a bogus assert in the option parser when attempting typo correction.
We only support splat shift amounts. Previously we checked if the shift
amount was a splat_vector and considered it legal.
I don't think there is a guarantee that the splat_vector will stick
around as a splat_vector. It's safer if we capture the splat and create
a dedicated node with a scalar shift amount.
This reverts commit 97572c1860efeeb97b5940927cee72081b61810a.
This patch seems to cause TestWatchpointCommandPython.py to time out
on the ubuntu buildbots (but nowhere else that I can find so far.) The
timeout is weird too, the TEST FILE is timing out but the individual
tests aren't being shown and there's no other output. Grrr...
Anyway I'll revert this and then see if I can do some guessing about
how this change might cause the test to fail.
This reverts commit 894408ded44151e4e34a3402210f671355d66310.
These tests were added by 97572c1860efeeb97b5940927cee72081b61810a
and I am reverting that as well.
This reverts commit a8af467fad7e5fff71643a3d6f2d06ac4f637e66.
This was a follow-on to 97572c1860efeeb97b5940927cee72081b61810a which was me
trying to guess why the ubuntu bots were failing with an entirely unhelpful
failure mode. I'll have to figure out how I can reproduce this somewhere so
I can look at it for real.
Implicitly discovered module maps that reference files outside their
module directory cause order dependent behavior when using implicitly
discovered module maps. This adds an off by default diagnostic about
these cases with the long term goal of removing import order dependent
behavior.
Module maps found via `-fmodule-map-file=` are not a problem because
they are all loaded at the start of translation.
Assisted-by: claude-opus-4.6
Some compilers (e.g. on AIX) do not pack by default. Use LLVM_PACKED to
ensure the VPIRFlags struct is packed as expected on all platforms.
This matches what we already do in other places for AIX, e.g. in
llvm/include/llvm/CodeGen/SelectionDAGNodes.h (added in
844a02e509a4cc03f76ef5dd1c358c57ee164b71), although it uses the more
general LLVM_PACKED unconditionally
PR: https://github.com/llvm/llvm-project/pull/184687
Fixes#168944
Depends on #178762 being merged first.
The commit adds implicit conversion warnings for HLSL matrix types in
Clang's semantic checker by extending SemaChecking.cpp to detect
precision loss when converting between matrix types (specifically,
ConstantMatrixType).
A new test validates float precision warnings, and an existing test was
updated to expect the new diagnostics.
Assisted-by: claude-opus-4.5
This is a speculative fix for the openmp-offload-sles-build-only build
bot that fails after #184376 with:
```
clang/lib/Tooling/DependencyScanningTool.cpp:336:12: error: could not convert ‘CIWithContext’ from ‘clang::tooling::CompilerInstanceWithContext’ to ‘std::optional<clang::tooling::CompilerInstanceWithContext>’
return CIWithContext;
^~~~~~~~~~~~~
```
It is a convention to use uppercase names of directives and clauses in
diagnostic messages, but getting such names is somewhat cumbersome:
```
parser::ToUpperCaseLetters(llvm::omp::getOpenMPDirectiveName(dirId));
parser::ToUpperCaseLetters(llvm::omp::getOpenMPClauseName(clauseId));
```
Implement `GetUpperName` (overloaded for clauses and directives) to
shorten it to
```
GetUpperName(dirId, version);
GetUpperName(clauseId, version);
```
This patch replaces existing instances of this pattern, adding the use
of OpenMP version where it was previously missing.
Replace "compile" with "assemble" in formatter_bytecode. This is in
preparation for the addition of a Python to formatter bytecode compiler.
It will be more clear to have one meaning for "compile".
Inherited constructors in `dllexport` classes are now exported for ABI-compatible cases,
matching MSVC behavior. Constructors with variadic arguments or callee-cleanup
parameters are not yet supported and produce a warning.
This aims to partially resolve https://github.com/llvm/llvm-project/issues/162640.
Assisted by : Cursor // Claude Opus 4.6