[Clang][AMDGPU] Remove redundant isAMDGCN checks. NFC
After the r600 target removal, AMDGPUTargetInfo is only created for
the amdgcn triple, so every `isAMDGCN()` check in it is always true.
Drop those checks and the helpers that only wrapped them.
```
if (hasFMAF())
Builder.defineMacro("__HAS_FMAF__");
-->
Builder.defineMacro("__HAS_FMAF__");
```
RFC: https://discourse.llvm.org/t/rfc-amdgpu-deprecating-and-removing-llvm-s-r600-terascale-backend/92840
[Clang][AMDGPU] Remove R600 target support
Remove the r600 triple from the clang frontend, driver and CodeGen,
together with the `__R600__` macro and the `__builtin_r600_*` builtins.
AMDGPUTargetInfo now only handles amdgcn, so the R600 branches are gone.
```
$ clang --target=r600 -S test.cl
error: unknown target triple 'r600'
```
RFC: https://discourse.llvm.org/t/rfc-amdgpu-deprecating-and-removing-llvm-s-r600-terascale-backend/92840
[clang-tidy] Respect explicit(false) on conversion operators (#240521)
Commit eb3b063995d6 (#82689) taught `ExplicitConstructorCheck`
(`misc-explicit-constructor`, aliased as `google-explicit-constructor`
and `cppcoreguidelines-explicit-constructor`) to ignore C++20
`explicit(false)` and instantiation-dependent `explicit(...)`
expressions on constructors, and to diagnose non-literal `false`
expressions without emitting an invalid `explicit` fix-it.
However, the `CXXConversionDecl` branch still unconditionally warned on
any conversion operator where `isExplicit()` was false and suggested
inserting `explicit `, even when `explicit(false)` or a dependent
`explicit(...)` specifier was already written. Apply the same
`ExplicitSpecifier` inspection to conversion operators so deliberately
implicit C++20 `explicit(false)` and dependent `explicit(...)`
conversion operators are not diagnosed.
Assisted-by: Gemini
[Attributor] Merge the scopes of potential values with a `|=`
`recurseForValue` merges the scopes of a value with `+=`. If a value appears
more than once in the values of one scope, the sum is not a valid scope.
This PR was assisted by AI but I reviewed all the changes.
[RegAllocFast] Keep inline asm uses off a tied physical def's register (#246907)
```
%1:gr32 = MOV32ri 0
INLINEASM ..., def %2, implicit-def $ecx, %0(tied-def 3), %0(tied-def 5), %1
$edx = COPY %0
```
%0 is used after the asm, so both tied uses are copies of it. %1 is
assigned $ecx, and the copy into $ecx overwrites it:
```
renamable $ecx = MOV32ri 0
$eax = COPY $edx
$ecx = COPY $edx
INLINEASM ..., killed renamable $ecx
```
lowerTiedUse frees the tied def's register after inserting the copy. A
[4 lines not shown]
[Sparc][MC] Don't report "unexpected token" after an operand error (#245208)
When an operand failed to parse, parseInstruction always reported
"unexpected token", even when the operand parser had already reported a
more specific error. So most operand errors were followed by a second,
less useful one, e.g.:
```
error: invalid register name
error: unexpected token
```
Make the operand parsers follow the ParseStatus convention, where
Failure means an error was reported and NoMatch means nothing was
consumed and no error was reported, and only report "unexpected token"
for NoMatch:
- parseSparcAsmOperand returns NoMatch for tokens it does not handle,
and Failure only after an error.
[19 lines not shown]
[msan][test] Show masked_store with zero mask incorrectly sets origin (#246161)
handleMaskedStore() unconditionally sets the origin, even in cases where
the mask ends up being zero (as evaluated at compile-time or runtime)
i.e., no bytes were stored. This PR adds a regression test case and a
TODO in the MSan instrumentation pass.
---------
Co-authored-by: Vitaly Buka <vitalybuka at google.com>
[ASan][test] Use %run in dlopen-mixed-c-cxx.c (#246215)
The test ran its binary directly, so it failed on targets that need an
emulator or a remote device.
Assisted-by: Claude Code
[analyzer][NFC] Memoize inferred symbol ranges per ProgramState
The inferred range of a symbol is a pure function of the ProgramState, yet
simplifying an SVal queries the range of every sub-expression again and again
against the same state. Memoize the ranges for the most recently queried
state in RangeConstraintManager (a DenseMap<SymbolRef, RangeSet> plus the
state it belongs to; it is cleared when a different state is queried).
SymbolicRangeInferrer takes the cache as an optional, nullable pointer; the
static inferRange() call sites pass none (a stack-local cache there never got
a lookup: 0 hits over 76406 instances on the corpus below).
Why this is safe: the cache holds a ProgramStateRef, so the state stays alive
and its address cannot be recycled for a different state while it is the
cache key. To make that hold at destruction time, ConstraintMgr is now
declared last in ProgramStateManager and is destroyed first, while the state
set, the allocator and the GDM contexts are still alive. ~ProgramStateManager
is declared out of line because the defaulted one needs the complete types
used by the members. Behavior is unchanged: the diagnostics are
byte-identical on every input below, and check-clang-analysis passes
[72 lines not shown]
[mlir][SPIR-V] Support Centroid and NonUniform decorations (#245443)
Adds serialization and deserialization support for the `Centroid` and
`NonUniform` SPIR-V unit decorations (both enums are already defined in
`SPIRVBase.td`).
Assisted by Google Antigravity Gemini 4.0 Neon Model
[mlir][SPIR-V] Add spirv.GL.Refract op (#245349)
Adds the `spirv.GL.Refract` op corresponding to `GLSL.std.450` extended
instruction `Refract` (opcode 72).
Per the `GLSL.std.450` specification:
- `I`, `N`, and the result must all have the same floating-point scalar
or vector type.
- `eta` must be a floating-point scalar.
Serialization and deserialization are automatically generated via
`SPIRV_GLOp`.
Assisted with Google Antigravity Gemini 4 Neon model
[mlir][SPIR-V] Add spirv.ArrayLength op (#245462)
This PR adds support for SPIR-V's `OpArrayLength` (opcode 68).
What changed:
Op definition & serialization: Registered `OpArrayLength` in
`SPIRVBase.td` and defined `SPIRV_ArrayLengthOp` in `SPIRVMemoryOps.td`
with binary serialization and deserialization.
Verification: Implemented `ArrayLengthOp::verify()` to ensure the
structure operand points to a struct ending in a RuntimeArrayType, and
that array_member correctly indexes that final member.
Assisted with Google Antigravity Gemini 4 Neon model
[lld][MachO] Avoid redundant work in Writer::scanRelocations()
During relocation scanning, `Writer::scanRelocations()` looks up
`target->getRelocAttrs(r.type)` up to three times per symbol relocation
(in `scanRelocations()`, `validateSymbolRelocation()`, and
`prepareSymbolRelocation()`), tests `r.referent` twice for symbol
referents, and makes an out-of-line call to `validateSymbolRelocation()`
on every symbol relocation even though it only rejects two rare
thread-local-variable cases.
Move `validateSymbolRelocation()` (whose only caller is
`Writer::scanRelocations()`) into `Writer.cpp`, split the rare TLV
validation logic into a `LLVM_ATTRIBUTE_NOINLINE` helper, and mark
`DylibSymbol` `final` so `dysym->isTlv()` avoids a virtual call on the
fast path. Fetch `RelocAttrs` once per relocation, pass it to
`validateSymbolRelocation()` and `prepareSymbolRelocation()`, hoist
loop-invariant `target->relocAttrs` and `config->emitChainedFixups`, and
dispatch on `r.referent` once for non-subtractor relocations.