[AMDGPU] Reland "Fixed verifier crash because of multiple live range components." (#190719) (#193286)
PR #190719 was reverted by PR #193135 because a .s file was left behind
by a test. This patch fixes it by adding -filetype=null to the RUN line
of the test rewrite-vgpr-mfma-to-agpr-spill-multi-store.ll.
In Rewrite AGPR-Copy-MFMA pass, after replacing spill instructions, the
replacement register may have multiple live range components when the
spill slot was stored to more than once. The verifier crashes with a bad
machine code error. This patch fixes the problem by splitting a live
range but assigning the same physical register in this scenario. A new
test has been added that verifies the absence of this verifier error.
Assisted-by: Claude Opus
[JTS] Add a temporary workaround for multiple zero GUIDs (#193292)
We can sometimes end up with multiple zero values in the VP metadata if
profile loading cannot map multiple addresses to their functions. We
should probably eventually fix this case in the profile loader, but as a
temporary workaround, handle this in JTS explicitly by dropping the
assertion, similar to how this is handled in ICP.
This is similar to #192905, but with more researched justification.
Co-authored-by: Alexander Shaposhnikov <ashaposhnikov at google.com>
[lldb] Make global lookup in DIL configurable by caller (#192592)
DIL has supported unlimited global lookup, which is in contrast with
long standing `frame variable` behavior, which supports only globals
from the current file.
This is semantically incorrect for frame variable, and has shown to
produce bugs in `dwim-print`. For these reasons, this change makes
global lookup opt-out, controlled by a new
`eExpressionPathOptionsDisallowGlobals` flag.
For `dwim-print`, the bug manifests when a global shadows a computed
property of the instance variable (`self`). As an example, if a global
named `text` exists, and a property named `text` exists (ie
`self.text`), then running `dwim-print text` will unexpectedly print the
global, not `self.text`.
rdar://174834020
Assisted-by: claude
[compiler-rt][asan] Add asan checks for __builtin_assume_dereferencable (#190871)
This checks that the range covered by this intrinsic is dereferencable.
Specifically it checks for `llvm.assume` intrinsics using the
`dereferencable` operator bundle and just asserts the shadow for this
range is zero.
The bulk of this PR was made by gemini but it was thoroughly edited and
reviewed to the best of my ability.
[Clang] Diagnose UB and emit error when identifier has both internal and external linkage (#192116)
C11 6.2.2p7 says if the same identifier appears with both internal and
external linkage in a translation unit, the behavior is undefined.
This patch adds a check in `Sema::MergeVarDecl` that uses
`LookupResult::isShadowed()` to detect when a block-scope `extern` found
a file-scope `static` through a shadow, and emits an error.
Fixes #54215
[LV] Remove IV use restrictions for epilogue vectorization. (#190552)
There have been a number of improvements to epilogue handling over the
last year, including improved resume value handling and consistent final
induction value handling via ExitingIVValue.
With those, the restriction can be removed, as direct uses of induction
phis are already handled correctly.
PR: https://github.com/llvm/llvm-project/pull/190552
[clang][deps] Simplify scanner VFS (#190843)
This PR removes a hack from the scanning VFS that introduced a bypass
mechanism for module cache queries. Now that we go through the
`ModuleCache` interface for implicitly-built modules, this is no longer
necessary.
[docs] Add missing command line options to llvm-profgen.rst (#192890)
Resolves #192867
This PR fix some of the undocumented options that are visible in
llvm-profgen --help and --help-hidden
[clang][bytecode][HLSL] Complete the HLSL aggregate splat and elementwise cast implementations, and enable the new constant interpreter on all HLSL tests with static asserts (#189126)
This PR fixes https://github.com/llvm/llvm-project/issues/183426,
completing the implementations of `CK_HLSLAggregateSplatCast` and
`CK_HLSLElementwiseCast` in Clang's new bytecode-based constant
expression evaluation engine / interpreter.
This PR also adds new RUN lines with
`-fexperimental-new-constant-interpreter` to all HLSL tests that have
static assertions.
The tests exercising the `CK_HLSLAggregateSplatCast` and
`CK_HLSLElementwiseCast` implementations in the new constant interpreter
are
- `clang/test/SemaHLSL/Types/AggregateSplatConstantExpr.hlsl` and
- `clang/test/SemaHLSL/Types/ElementWiseConstantExpr.hlsl`
respectively.
[5 lines not shown]
[X86][GlobalISel] Ignore non-vregs in regbank mapping (#182880)
`X86RegisterBankInfo`'s regbank-mapping helpers work under the
assumption that every register operand was a typed virtual register.
This caused `RegBankSelect` crashes when such operands reached these
helpers:
* `getInstrPartialMappingIdxs` called `MRI.getType()` on a non-vreg
operand.
* `getInstrValueMapping` then called `getValueMapping(PMI_None, ...)`
for it.
Skip non-virtual register operands in both helpers. This keeps non-vregs
out of LLT/mapping logic while still mapping real vreg operands.
Fixes https://github.com/llvm/llvm-project/issues/182735
[Github] Set persist-credentials in libclang-python-tests.yml (#193282)
Not exactly sure how this slipped through the crack in the mass cleanup,
but fix it now.
[Clang] Allow VDBPSADBW intrinsics in constexpr (#188887)
Add constexpr evaluation support for the VDBPSADBW intrinsics (`__builtin_ia32_dbpsadbw128/256/512`) in both Clang constant evaluators.
Fixes #188747
[lld/mac] For catalyst outputs, tolerate implicitly linking against arm64e mac tbd files (#193065)
Some mac libraries published in the Xcode SDK are now arm64e only, and
catalyst applications should be able to link against these even if
building for arm64.
This matches ld-prime behavior.
https://reviews.llvm.org/D124336 allows linking against MacOS libraries,
but only if the architecture matches exactly.
https://reviews.llvm.org/D130683 allows linking against tbds with ABI
compatibility architectures, but the logic isn't used for this
particular case.
[Assisted-by](https://t.ly/Dkjjk): [Claude Opus
4.6](https://www.anthropic.com/news/claude-opus-4-6)
---------
Co-authored-by: Nuri Amari <nuriamari at fb.com>
[SSAF][UnsafeBufferUsage] Make UnsafeBufferUsageExtractor a registered ASTConsumer (#191931)
- Removed UnsafeBufferUsageExtractor.h
- Registered UnsafeBufferUsageExtractor
- Changed unit tests to enable the extractor with
`HandleTranslationUnit`
- Fixed bugs in `UnsafeBufferUsageExtractor::HandleTranslationUnit`
---------
Co-authored-by: Balázs Benics <benicsbalazs at gmail.com>
[APINotes][unsafe-buffer-usage] Add [[clang::unsafe_buffer_usage]] support in APINotes (#189775)
Support the ``[[clang::unsafe_buffer_usage]]`` attribute in APINotes,
e.g.,
```
Functions:
- Name: myUnsafeFunction
UnsafeBufferUsage: true
```
rdar://171859135
[ROCDL] Add dot intrinsics to rocdl (#193129)
This patch adds dot intrinsic support to the rocdl dialect. Having these
(inc. follow up `amdgpu` wrapper) as first class citizens in MLIR will
allow us to lower thread local reductions involving `<=16bit` data more
effectively. This is in line with the spirit of `dot` intrinsic support
wrt existing edge dialects (`x86`, `nvvm`, `spirv`).
Assisted by: Claude
---------
Signed-off-by: Eric Feng <Eric.Feng at amd.com>
[lldb][test] Add support for building Wasm test inferiors (#192872)
This PR adds support for building the test inferiors to WebAssembly.
Specifically, it allows you to configure a sysroot and resource dir
(pointing at the WASI SDK). The Wasm runtime can be configured through
the `LLDB_TEST_USER_ARGS`.
```
LLDB_TEST_TRIPLE:STRING=wasm32-wasip1
LLDB_TEST_SYSROOT:PATH=/path/to/wasi-sdk-32.0-arm64-macos/share/wasi-sysroot
LLDB_TEST_RESOURCE_DIR:PATH=/path/to/wasi-sdk-32.0-arm64-macos/lib/clang/22/
LLDB_TEST_USER_ARGS:STRING=--setting;platform.plugin.wasm.runtime-path=/path/to/iwasm;--setting;platform.plugin.wasm.runtime-args=--heap-size=1048576;--setting;platform.plugin.wasm.port-arg=-g=
```
With the configuration listed above I was able to confirm that I could
build and run a handful of C and C++ tests. To set expectations: lots of
tests are unsupported because they rely on things not available in Wasm
(e.g. shared libraries) or they use features currently unsupported in
LLDB (most notably: expression evaluation).
[clang] Get the directory identity from `ModuleCache` instead of `FileManager` (#193070)
Using `FileManager`'s caching and deduplication functionality for
assigning identity to the module cache is handy, but it relies on two
assumptions:
* the rest of the compiler consistently calls
`FileManager::getOptionalDirectoryRef()` with `/*CacheFailure=*/false`
for the module cache path,
* the VFS is not caching failed stats for the module cache path.
This PR implements this functionality in the `ModuleCache` interface,
which is conceptually the right place for it. This PR enables us to land
the VFS simplifications in
https://github.com/llvm/llvm-project/pull/190843.
[clang] implement CWG2064: ignore value dependence for decltype
The 'decltype' for a value-dependent (but non-type-dependent) should be known,
so this patch makes them non-opaque instead.
This patch also implements what's neceessary to allow overloading
on pure differences in instantiation dependence, making `std::void_t`
usable for SFINAE purposes.
This also readds a few test cases from da98651, which was a previous attempt
at resolving CWG2064.
Fixes #8740
Fixes #61818
Fixes #190388