[VPlan] Expand strided access start in SafeUDivMode. (#246948)
convertToStridedAccesses expands the start of the strided address from
SCEV at the access. The access may be predicated, e.g. with its address
computed from a udiv in a conditional block, but the expansion executes
unconditionally (and invariant parts are hoisted), so the expanded udiv
can divide by zero or poison where the original loop never evaluates it.
Expand the start in SafeUDivMode. If any lane of the access is active,
the original udiv executed with the same invariant operands, so the safe
divisor yields the same value.
[CMake] Move -Bsymbolic-functions linker check to HandleLLVMOptions (#246238)
The check was in add_link_opts, which runs for every library and
executable. Move it to HandleLLVMOptions so it only runs once. It is
still visible to both llvm-shlib and clang-shlib, including standalone
clang builds.
Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
[MC][NFC] Make MCAsmInfo::getExprForPersonalitySymbol non-virtual (#246826)
This is Darwin-only; replace with two member variables. Saves 400B of
.data.rel.ro.
[GVN] Drop bitcast in PointerUsesQueue. NFC
Typed ptr is retired in previous LLVM version. Adding this to queue
performs no-op in here. Drop this directly.
[libc] Use a syscall wrapper for prctl (#243787)
This PR move prctl behind the centralized syscall wrappers, following
libc/docs/dev/syscall_wrapper_refactor.md.
[GVN] Extend processFoldableCondBr to support switch
A switch with constant condition can also be folded. As a result, we
rename processFoldableCondBr to support switch. The logic of the
function is rewrite as switch can have multiple destinations. Instead
of recording something dead, we record the Live sucessor, and skip
same live BB.
splitCriticalEdges in here is also support merging same BB so that GVN
can reach converge earlier.
Assisted-by: Claude # Test
[mlir][Presburger] Add IntegerRelation::gist (context-based simplification)
Add IntegerRelation::gist(context), a port of ISL's isl_basic_map_gist
(uset_gist / uset_gist_full), along with the supporting row-reduction
helpers IntMatrix::rowReduce and IntegerRelation::reduceUsingEqualities.
Supporting helpers:
- IntMatrix::rowReduce: performs Gauss-Jordan row reduction in place
along a caller-specified column order, swapping pivot rows to the top,
normalizing modified rows by GCD, and returning the pivot columns
(with unit tests in MatrixTest.cpp).
- IntegerRelation::eliminateVarUsingEquality(ArrayRef, col): eliminates
a variable from every constraint using an external equality row.
- IntegerRelation::reduceUsingEqualities: orchestrates IntMatrix::rowReduce
to project context equalities onto involved variables, detect
inconsistent equalities, and rewrite all constraints of a relation
using the remaining equalities (port of ISL's
isl_basic_set_reduce_using_equalities with project_onto_involved).
[58 lines not shown]
[mlir][Presburger] NFC: extract eliminateColumnUsingRow and eliminateVarUsingEquality
Extract IntMatrix::eliminateColumnUsingRow (eliminating a column from a
row using a pivot row with the smallest positive multiplier on the row)
and IntegerRelation::eliminateVarUsingEquality (applying it to every
other equality and every inequality of the relation).
Replace the file-local eliminateFromConstraint helper with these
primitives in gaussianEliminateVars, gaussianEliminate, and
removeRedundantLocalVars, and add a unit test for
IntMatrix::eliminateColumnUsingRow.
[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]