[clang][HLSL] Complete the pattern an instantiation is built from, not the primary template (#216388)
Fixes https://github.com/llvm/llvm-project/issues/212575
When an external AST source lazily supplies class template patterns,
Clang stopped asking it for definitions once the primary pattern had
been completed. A partial specialization declared after that point is
then instantiated from a pattern that had never been defined, failing
with `err_template_instantiate_undefined`.
So whether a declaration compiled depended on what had been declared
before it (as seen in https://hlsl.godbolt.org/z/vW3xGY6sW).
The problem Is that `ClassTemplateSpecializationDecl::Create` copies the
`hasExternalLexicalStorage()` flag only from the primary template, and
only while the primary template was still incomplete. Partial
specializations therefore failed when the primary template was
completed, hence exhibiting the aforementioned
`err_template_instantiate_undefined` error behavior when the primary
template was completed.
[14 lines not shown]
[libc][realpath][test] Allow test directory to contain symlinks (#216828)
CI for https://github.com/llvm/llvm-project/pull/212925 failed because
the `libc-riscv32-qemu-yocto-fullbuild-dbg` buildbot on Yocto uses a
symlink for `/tmp` to `/var/volatile/tmp`
([source](https://github.com/openembedded/openembedded-core/blob/07a342aa80c7349dd014f743a695a5e006add8df/meta/recipes-core/initscripts/initscripts-1.0/volatiles#L32)).
It's fair enough that a system may define `/tmp` as a symlink, so this
PR updates the realpath tests to call `realpath` on the test directory
to resolve symlinks.
This PR also updates the test to use `libc_make_test_file_path` instead
of `/tmp`. Previously, the tests used `/tmp` because
`libc_make_test_file_path` might have symlinks in it. Since we fully
resolve symlinks now, we can use the more standard approach now.
[NVPTX] Add NewPM codegen pipeline (#215712)
This exactly mirrors the LegacyPM implementation and produces identical
PTX for all lit tests. Right now this is opt-in with `-enable-new-pm`
for llc and clang.
[MLIR][NVVM] Spell strict assembly properties directly
Bind every NVVM inherent property in its operation assembly format and
re-enable strict property parsing for the dialect. Use direct named clauses
for declarative formats and custom MMA parsers while retaining dictionaries
for discardable attributes.
Assisted-by: Codex
[flang][cuda] Allow call to len intrinsic on host with device argument (#216846)
This is fine to call `len` intrinsic on the host with a device actual
argument since the descriptor is allocated in managed memory.
[RISCV] Simplify the SelectCompressOpt patterns. NFC (#216819)
Use a PatLeaf and a predicate to check the condition code instead of
having a SETEQ and SETNE pattern. CCtoRISCVCC will take care of
converting the condition code.
[CIR] Mark bit-field access units as their own member kinds
A bit-field access unit is only as wide as the compiler needs it to be,
which can be narrower than the type the bit-fields were declared with.
Nothing in the record type says so. The unit just gets `data`, or
`empty` when none of its bit-fields are named, and an ordinary field
gets those same marks.
That makes `struct { long long x : 32; }` and `struct { unsigned x; }`
look identical here. Classic CodeGen tells them apart and coerces the
first to `i64`, the second to `i32`. It reads the declared type, where
the bit-field still leaves user data past bit 32.
The fix is to give a unit its own marks, `bitfield` and
`empty_bitfield`. Nothing reads them yet, and no record's emptiness
answer changes. The next PR records a zero-width bit-field, which the
marks miss too, and pad-aware classification can then use both.
Assisted-by: Cursor / claude-opus-5
[VPlan] Verify VPIRFlags when creating VPWidenRecipe. (#213039)
VPWidenRecipe's constructor didn't check its flags at all, unlike
VPInstruction and VPWidenCastRecipe. Add checks and fix remaining
violations.
PR: https://github.com/llvm/llvm-project/pull/213039
To fix test failures. (#216763)
This PR is to fix test failure in the AIX buildbot.
Flang supports 64-bit mode only. Add a config file to set OBJECT_MODE.
[MLIR][SCF] Prioritize single-iteration loop inlining (#188986)
Loops with a statically known trip count of one expose a single acyclic
path and can be handled by the existing region branch op inliner.
Give that rewrite a higher benefit than the generic region branch op
canonicalizations. This ensures that the loop is inlined before dead
successor inputs can be removed independently and temporarily invalidate
the op under expensive pattern API checks.
This fixes some tests with MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS
enabled.
Assisted-by: Codex
[ARM] Allow tTAILJMPd on v8-M Baseline
a1189106d5a1 added B.W to v8-M Baseline, relaxing t2B, tCBZ and tCBNZ
from Requires<[IsThumb2]> to Requires<[IsThumb, HasV8MBaseline]>, and
enabled tail calls for it. It missed tTAILJMPd, which expands to t2B
but still required IsThumb2, so emitting a tail call for a Thumb1 MachO
target failed:
LLVM ERROR: Attempting to emit tTAILJMPd instruction but the
Feature_IsThumb2 predicate(s) are not met
[NFC][MemProf] Replace memprofraw with YAML in memprofmissingfunc.ll test
Use split-file to create a basic `.memprofdata` file to be used in the test. This also allows us to remove the REQUIRES because we are no longer reading a binary file.
[asan][test] Fix invalid-pointer-pairs-vector-extract.cpp breakage after #210729 (#216827)
compiler-rt/test/asan/TestCases/invalid-pointer-pairs-vector-extract.cpp
(introduced in #216532) started failing (or rather, unexpectedly
passing) after #210729 (e.g.,
https://lab.llvm.org/buildbot/#/builders/66/builds/35645,https://lab.llvm.org/buildbot/#/builders/51/builds/42365), because it
changes the codegen for pointer subtraction if -fwrapv-pointer is not
set.
This patch fixes the test case by adding -fwrapv-pointer.
[clang-format] Add support for additional C++ declaration specifiers in QualifierOrder (#160853)
Fixes #60866
This PR extends clang-formats `QualifierOrder` option to support
additional C++ declaration specifiers, addressing the limitation where
many common qualifiers were not recognized.
## Problem
Previously, `QualifierOrder` only supported a limited subset of C++
declaration specifiers:
- `const`, `volatile`, `static`, `inline`, `constexpr`, `restrict`,
`friend`
This meant that many common C++ qualifiers like `extern`, `mutable`,
`typedef`, `unsigned`, etc. were not recognized and could not be
properly reordered, limiting the usefulness of the feature.
[17 lines not shown]
AMDGPU: Capture G_PTR_ADD flags via m_MIFlags in getBaseWithConstantOffset (#216809)
Read the nuw flag from the m_GPtrAdd match itself instead of a redundant
getVRegDef of the pointer register. NFC.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
AMDGPU: Use mi_match for G_BITCAST check in RegBankLegalize (#216808)
Replace the getVRegDef + G_BITCAST opcode check in
tryEliminateReadAnyLane
with m_GBitcast. NFC.
Co-authored-by: Claude (Opus 4.8) <noreply at anthropic.com>
AArch64: Guard optimizeCondBranch against a physical copy source (#216699)
optimizeCondBranch walks COPY chains from the branch condition register,
calling getVRegDef on each copy's source operand. A COPY source can be a
physical register which doesn't make sense to pass to getVRegDef.
Co-authored-by: Claude (Claude-Opus-4.8) <noreply at anthropic.com>
[LLVMABI][AARCH64] Add support for simple direct return case (#216437)
This adds LLVM ABI library support for AArch64 return type
classification for scalar and matrix types that are classified as
Direct. Other types and all arguments are now reported as not yet
implemented.
This also introduces the hook in Clang to use the ABI library for
non-Windows AArch64 targets when `-fexperimental-abi-lowering` is passed
and adds a test for the ABI handling of types which are handled by the
library.
Assisted-by: Cursor / various models