LLVM/project 82a4cd7clang/test/OpenMP loop_transform_final_iv.c interchange_codegen.cpp

[OpenMP] Restore loop variable values after loop-tranformation constructs. (#208533)

This patch fixes loop variable finalization for OpenMP 6.0
loop-transformations constructs: `tile`, `stripe`, `reverse`,
`interchange` and `fuse` to comply with spec requirement page 371, lines
19-21. The spec requires that "After the execution of the
loop-transforming construct, the loop-iteration variables of any of its
transformation-affected loops have the values that they would have
without the loop-transforming directive".
DeltaFile
+224-110clang/test/OpenMP/tile_codegen.cpp
+224-110clang/test/OpenMP/stripe_codegen.cpp
+216-66clang/test/OpenMP/fuse_codegen.cpp
+180-85clang/test/OpenMP/reverse_codegen.cpp
+134-45clang/test/OpenMP/interchange_codegen.cpp
+129-0clang/test/OpenMP/loop_transform_final_iv.c
+1,107-4164 files not shown
+1,265-47910 files

LLVM/project e854fb7llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation BUILD.gn

[gn build] Port 2f910f66e7e1 (#212782)
DeltaFile
+1-0llvm/utils/gn/secondary/llvm/lib/Transforms/Instrumentation/BUILD.gn
+1-01 files

LLVM/project 0189195clang/docs ReleaseNotes.md, clang/lib/Parse ParseOpenMP.cpp

[Clang][OpenMP] Fixed an assertion on omp taskloop transparent (#200663)

In
https://github.com/llvm/llvm-project/blob/15bb4a97a798ed43b3966c99d37585651b965e5e/clang/lib/Parse/ParseOpenMP.cpp#L3289-L3295
We missed a check for `WrongDirective` before calling
`ActOnOpenMPTransparentClause`.

This patch adds the missing check.
fix #197162
DeltaFile
+6-0clang/test/SemaOpenMP/gh197162.c
+3-2clang/lib/Parse/ParseOpenMP.cpp
+1-0clang/docs/ReleaseNotes.md
+10-23 files

LLVM/project 2b06cb5llvm/lib/CodeGen/SelectionDAG DAGCombiner.cpp, llvm/test/CodeGen/AMDGPU amdgpu-codegenprepare-idiv.ll neg_ashr64_reduce.ll

[DAGCombine] Freeze after load is scalarized. (#212587)

fixes #211567
DeltaFile
+58-52llvm/test/CodeGen/AMDGPU/sra.ll
+57-0llvm/test/CodeGen/AMDGPU/freeze-scalar-load.ll
+22-20llvm/test/CodeGen/AMDGPU/mul_int24.ll
+4-7llvm/test/CodeGen/AMDGPU/neg_ashr64_reduce.ll
+5-5llvm/test/CodeGen/AMDGPU/amdgpu-codegenprepare-idiv.ll
+8-0llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+154-846 files

LLVM/project f2453afllvm/lib/Target/AMDGPU AMDGPUMemoryUtils.cpp, llvm/test/CodeGen/AMDGPU global_smrd_cfg.ll move-to-valu-addsubu64.ll

[AMDGPU] Improve MemorySSA walking in isClobberedInFunction (#211817)

Consistently call the two argument overload
`MemorySSAWalker::getClobberingMemoryAccess(MemoryAccess,
MemoryLocation)` to get a clobbering def (according to the AliasAnalysis
used by MSSA) before applying the special cases in `isReallyAClobber`.

This has the effect of marking more loads as `amdgpu-noclobber` and
selecting SMEM load instructions for them.

Fixes: ROCM-28492
DeltaFile
+280-288llvm/test/CodeGen/AMDGPU/agpr-copy-no-free-registers.ll
+52-9llvm/test/CodeGen/AMDGPU/noclobber-barrier.ll
+6-3llvm/lib/Target/AMDGPU/AMDGPUMemoryUtils.cpp
+2-2llvm/test/CodeGen/AMDGPU/move-to-valu-addsubu64.ll
+1-2llvm/test/CodeGen/AMDGPU/global_smrd_cfg.ll
+341-3045 files

LLVM/project 82c7b9aclang/docs ClangFormatStyleOptions.rst, clang/include/clang/Format Format.h

[clang-format] Add Natural option for SortIncludes (#210788)

`SortIncludes` currently orders includes lexicographically with the
option to ignore case or extension. This adds another option, `Natural`,
that compares embedded runs of digits as numbers rather than sequences
of characters, matching the "natural sort" behaviour found in most file
managers and tools like `sort` when called with the `-V` option.

**Disclaimer**

AI assistance was used in initial exploration and review but the code is
"hand generated".
DeltaFile
+52-15clang/lib/Format/Format.cpp
+34-0clang/unittests/Format/SortIncludesTest.cpp
+16-12clang/unittests/Format/ConfigParseTest.cpp
+10-1clang/include/clang/Format/Format.h
+10-0clang/docs/ClangFormatStyleOptions.rst
+122-285 files

LLVM/project a463071llvm/lib/LTO LTOModule.cpp, llvm/test/LTO/X86 ifunc.ll

[LTO] Handle GlobalIFunc in LTOModule::parseSymbols (#212515)

Avoids the assert immediately below.

Fixes #45694

rdar://182744700
DeltaFile
+18-0llvm/test/LTO/X86/ifunc.ll
+1-1llvm/lib/LTO/LTOModule.cpp
+19-12 files

LLVM/project 2faa90allvm/lib/Target/AMDGPU SIInstrInfo.cpp, llvm/test/CodeGen/AMDGPU fix-sgpr-copies-f16-true16.mir

[AMDGPU] Retain subreg when legalising generic operand (#212636)

When building a `COPY` to legalise a generic operand whose register
class does not match what is expected, the subregister is not retained
in the copy, and is not dropped from the newly created virtual
destination register.
DeltaFile
+35-0llvm/test/CodeGen/AMDGPU/fix-sgpr-copies-f16-true16.mir
+3-2llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+38-22 files

LLVM/project e61b2abllvm/lib/CodeGen/GlobalISel InlineAsmLowering.cpp, llvm/lib/Target/AArch64 AArch64RegisterInfo.cpp AArch64RegisterInfo.td

[AArch64] Remove GPR64arg register class (#212457)

GPR64arg was added in fcbec02ea6fb to describe X0-X7 for the reserved
argument-register check. It is an ABI register set rather than an
allocation constraint and should not be used for register allocation.
Given it has a single use that only cares about the number of registers,
a register class isn't necessary.

This exposes that GlobalISel recomputes the minimal register class when
a matching inline asm input is tied to a fixed physical-register output.
For X2 that class was GPR64arg, getRegistersForValue already asks the
target which class implements the output constraint. Retain that class
and reuse it for the matching input.

Assisted-by: codex
DeltaFile
+9-5llvm/lib/CodeGen/GlobalISel/InlineAsmLowering.cpp
+3-3llvm/test/TableGen/aarch64-register-info-stats.td
+0-3llvm/lib/Target/AArch64/AArch64RegisterInfo.td
+1-1llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-inline-asm.ll
+1-1llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
+14-135 files

LLVM/project 7e1aba7llvm/lib/Target/PowerPC PPCISelLowering.cpp, llvm/test/CodeGen/PowerPC fp-classify-nan.ll

Reland [PowerPC] improve performance on the isNan and !isNan function in case of -ffp-model=strict (#212565)

1. reland the patch https://github.com/llvm/llvm-project/pull/204170
2. and fix the regression caused by above patch.
DeltaFile
+126-0llvm/test/CodeGen/PowerPC/fp-classify-nan.ll
+66-6llvm/lib/Target/PowerPC/PPCISelLowering.cpp
+192-62 files

LLVM/project 7f0e5f9clang/include/clang/Basic Diagnostic.h, clang/include/clang/Sema AnalysisBasedWarnings.h

[clang] Cache the analysis-based warning policy in effect (#212213)

While benchmarking with warnings enabled, I found that
`AnalysisBasedWarnings::getPolicyInEffectAt` runs at the end of every
function body, performing six location-sensitive `isIgnored()` queries.
This overhead comes from #136323 ([compile-time
impact](https://llvm-compile-time-tracker.com/compare.php?from=2a9f77f6bd48d757b2d45aadcb6cf76ef4b4ef32&to=71ce9e26aec00e4af27a69ccfab8ca1773ed7018&stat=instructions:u)).

Since these six diagnostics only depend on the diagnostic state at the
query location and whether it is in a system header or macro, we can
cache the computed policy rather than recomputing it for every function.

The cache flushes when a `#pragma clang diagnostic` changes severities,
and it bypasses active diagnostic suppression mappings.

Compile-time results for this pr:

https://llvm-compile-time-tracker.com/compare.php?from=49de424f45389cb757c3cc8c50daf38d024e2314&to=a61503b54e9568254885777cf89f5ca1586ec99f&stat=instructions%3Au
DeltaFile
+39-5clang/lib/Sema/AnalysisBasedWarnings.cpp
+11-0clang/include/clang/Basic/Diagnostic.h
+7-0clang/include/clang/Sema/AnalysisBasedWarnings.h
+4-0clang/lib/Sema/Sema.cpp
+61-54 files

LLVM/project 13a6fc2third-party/benchmark/src sysinfo.cc

[benchmark] Back port 2b0bff7 from upstream (#212278)

Fix compile error with clang -Werror -Wunused-template
(cherry picked from commit 2b0bff7444a8df460daab2e5af18bce45ca00657)
DeltaFile
+3-2third-party/benchmark/src/sysinfo.cc
+3-21 files

LLVM/project dc5f2aallvm/lib/Analysis ValueTracking.cpp, llvm/test/Transforms/Attributor nofpclass-arbitrary-fp.ll

[Analysis] Adding convert_from_arbitrary_fp support in computeKnownFPClass. (#208585)

fixes #208437 

From LangRef for intrinsic convert_from_arbitrary_fp ,
"Normal finite values are converted exactly. NaN values follow LLVM’s
standard NaN rules; the NaN representation is preserved... and the NaN
payload may be truncated or extended..."
-> if src has Nan -> preserve nan

"If a value exceeds the representable range of the target type (for
example, converting Float8E8M0FNU with large exponents to half), the
result is converted to infinity with the appropriate sign."
DeltaFile
+192-0llvm/test/Transforms/Attributor/nofpclass-arbitrary-fp.ll
+39-0llvm/lib/Analysis/ValueTracking.cpp
+231-02 files

LLVM/project 03de9b1mlir/lib/Dialect/Tosa/IR TosaCanonicalizations.cpp, mlir/test/Dialect/Tosa canonicalize.mlir

[mlir][tosa] Extend cancelling block-scaled cast optimisation to bf16 (#212517)

The CancellingBlockScaledCastsOptimization optimises away sequences
where a block-scaled tensor is cast to fp32 and then cast back to its
original block-scaled type.

This patch extends it to also cover cases where the intermediate type is
bf16, since the 7 bits of mantissa and 8 bits in the exponent are
sufficient to encode any `element * scale` product with valid
block-scaled type combinations.

---------

Signed-off-by: Ian Tayler Lessa <ian.taylerlessa at arm.com>
DeltaFile
+42-8mlir/test/Dialect/Tosa/canonicalize.mlir
+2-1mlir/lib/Dialect/Tosa/IR/TosaCanonicalizations.cpp
+44-92 files

LLVM/project c8c6c0fflang/lib/Optimizer/CodeGen CodeGen.cpp, flang/test/Fir convert-to-llvm.fir array_coor_nuw_nusw.fir

[flang] Drop nuw on XArrayCoor for non-positive slice steps (#212639)

Example:
```fortran
z(:, 3:2:-1) = z(:, 1:2)
```

In this code, reverse-section indexing lowers `idx*step` / `diff+adj`
with `nuw`. A negative step can make the product negative, so `nuw` is
invalid and LLVM `-O2` can drop the stores.

Fix: keep `nsw|nuw` only for known positive steps; otherwise keep `nsw`
and drop `nuw` (negative, zero, or unknown).
DeltaFile
+153-0flang/test/Fir/array_coor_nuw_nusw.fir
+24-24flang/test/Fir/convert-to-llvm.fir
+15-4flang/lib/Optimizer/CodeGen/CodeGen.cpp
+192-283 files

LLVM/project b3115cdmlir/include/mlir/Dialect/Affine/Transforms Passes.td Passes.h, mlir/lib/Dialect/Affine/Transforms AffineLoopNormalize.cpp

[mlir][affine] Add useExpensiveMath option to AffineLoopNormalize pass (#211989)

This PR integrates constant bound inference into the existing
`AffineLoopNormalize` pass under a new `useExpensiveMath` option. When
`useExpensiveMath` is enabled (disabled by default due to potential
compilation time overhead), the pass leverages
`ValueBoundsConstraintSet` (uss presburger) analysis to refine dynamic
`affine.for` loop bounds into compile-time constant bounds. RFC:
https://discourse.llvm.org/t/rfc-mlir-enable-dynamic-and-tighter-affine-unrolling-via-valueboundsconstraintset/91055/2

---------

Co-authored-by: Oleksandr "Alex" Zinenko <azinenko at amd.com>
DeltaFile
+96-0mlir/test/Dialect/Affine/affine-loop-normalize.mlir
+92-3mlir/lib/Dialect/Affine/Transforms/AffineLoopNormalize.cpp
+2-1mlir/include/mlir/Dialect/Affine/Transforms/Passes.h
+2-0mlir/include/mlir/Dialect/Affine/Transforms/Passes.td
+192-44 files

LLVM/project 2f910f6llvm/include/llvm/Transforms/Instrumentation CopyProf.h, llvm/lib/Passes PassRegistry.def

[CopyProf] Add CopyProf instrumentation passes. (#207385)

This patch introduces the instrumentation passes and corresponding tests
for CopyProf, a profiling tool designed to identify unnecessary object
copies in C++ applications.
RFC at

https://discourse.llvm.org/t/rfc-copysanitizer-csan-detecting-unneccessary-object-copies-at-runtime/91038.

Three passes are added:
- CopyProfPass inserts enter/exit callback around special member
functions.
- CopyPRofStoresPass instruments store instructions to track memory
modifications.
- ModuleCopyProfPass inserts a module constructor to initialize the
CopyProf runtime at program startup (will be added later).
DeltaFile
+327-0llvm/lib/Transforms/Instrumentation/CopyProf.cpp
+165-0llvm/test/Instrumentation/CopyProf/function-instrumentation.ll
+113-0llvm/test/Instrumentation/CopyProf/store-instrumentation.ll
+80-0llvm/test/Instrumentation/CopyProf/no-instrumentation.ll
+53-0llvm/include/llvm/Transforms/Instrumentation/CopyProf.h
+3-0llvm/lib/Passes/PassRegistry.def
+741-02 files not shown
+743-08 files

LLVM/project 6279654llvm/utils/gn/secondary/llvm/include/llvm/TargetParser BUILD.gn

[gn] port c2fa41286818 (AMDGPUTargetParserDef.inc) (#212763)
DeltaFile
+8-0llvm/utils/gn/secondary/llvm/include/llvm/TargetParser/BUILD.gn
+8-01 files

LLVM/project 31de6f2mlir/lib/Conversion/SPIRVToLLVM SPIRVToLLVM.cpp, mlir/test/Conversion/SPIRVToLLVM gl-ops-to-llvm.mlir

[mlir][SPIR-V] Add SPIRVToLLVM conversions for GL.FSign and GL.SSign (#206934)
DeltaFile
+56-1mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp
+54-0mlir/test/Conversion/SPIRVToLLVM/gl-ops-to-llvm.mlir
+110-12 files

LLVM/project f43c0e2llvm/test/MC/AMDGPU sopp.s sop1.s

AMDGPU: Manually convert some MC tests to subarch triples (#212728)
DeltaFile
+7-7llvm/test/MC/AMDGPU/hsa-metadata-kernel-attrs-v3.s
+6-6llvm/test/MC/AMDGPU/hsa-metadata-kernel-args-v3.s
+3-3llvm/test/MC/AMDGPU/s_endpgm.s
+3-3llvm/test/MC/AMDGPU/hsa-metadata-kernel-code-props-v3.s
+2-2llvm/test/MC/AMDGPU/sopp.s
+2-2llvm/test/MC/AMDGPU/sop1.s
+23-2328 files not shown
+55-5534 files

LLVM/project e393b0aclang/include/clang/AST OpenMPClause.h, clang/lib/AST OpenMPClause.cpp

[OpenMP] Split UPDATE clause into two: for ATOMIC and for DEPOBJ (#212270)

The UPDATE clause has the same spelling on both of these directives, but
functionally it's two different clauses. Split them into "update", and
"update_depend_objects" to be able to tie their properties to their enum
ids.

This should make it easier to implement auto-generating of clause
properties in the future by avoiding spelling conflicts.

---------

Co-authored-by: Alexey Bataev <a.bataev at outlook.com>
DeltaFile
+49-41clang/include/clang/AST/OpenMPClause.h
+19-27clang/lib/AST/OpenMPClause.cpp
+16-26flang/lib/Semantics/check-omp-structure.cpp
+29-0clang/test/OpenMP/update_clause_ast_dump.cpp
+12-12clang/lib/Sema/SemaOpenMP.cpp
+9-10flang/lib/Lower/OpenMP/Clauses.cpp
+134-11623 files not shown
+247-17329 files

LLVM/project ed389callvm/test/CodeGen/ARM regcoalesce-undef-copy-subreg-redef.ll regcoalesce-undef-copy-subreg-redef.mir

[CodeGen][ARM] Add regression tests for #202263 (#202599)

The underlying issue—RegisterCoalescer eliminating an undef COPY and
leaving a partial subregister redef that reads a value that no longer
exists—was fixed in #204039.

This PR adds the regression coverage originally developed alongside the
fix attempt, so the pattern remains covered:

- an end-to-end IR test that checks the generated assembly with
FileCheck;
- a focused single-pass `-run-pass=register-coalescer` MIR test using
`-verify-coalescing`, which reproduces the "Instruction is reading
nonexistent value" verifier error from #202263 when #204039 is reverted,
and passes with the fix applied.

Fixes #202263
DeltaFile
+84-0llvm/test/CodeGen/ARM/regcoalesce-undef-copy-subreg-redef.mir
+36-0llvm/test/CodeGen/ARM/regcoalesce-undef-copy-subreg-redef.ll
+120-02 files

LLVM/project deed195clang/include/clang/StaticAnalyzer/Core/PathSensitive RangedConstraintManager.h, clang/lib/StaticAnalyzer/Core RangedConstraintManager.cpp

[analyzer] Prune infeasible states related to concrete ints early to fix a crash (#210912)

RangedConstraintManager discards a simplified symbol if it reduces to a
concrete integer. This leads to delayed realization that some state
might be infeasible (because the concrete integer does not fit in the
assumed range), which might produce unexpected null pointers on the
following state splits.

PthreadLockChecker has fallen just into this trap. It assumes
`pthread_mutex_lock` is always called in a feasible state, which is was
not true.
In particular, in ZFS the analyzer crashes when runs in CTU mode because
it reaches `pthread_mutex_lock()` in over-constraint state (see the
reduced example in the first commit).

Checkers rely on the invariant that a state split can never result in
both `StateRef`s being null. To fix this violation of the invariant,
this patch helps RangedConstraintManager to realize a state is
infeasible and abort its exploration early so no follow-up state split

    [5 lines not shown]
DeltaFile
+88-0clang/test/Analysis/simplify-drops-concrete.c
+45-10clang/lib/StaticAnalyzer/Core/RangedConstraintManager.cpp
+27-8clang/test/Analysis/z3/z3-crosscheck.c
+25-2clang/test/Analysis/pthreadlock.c
+1-13clang/include/clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h
+186-335 files

LLVM/project 8a2c9abllvm/docs AMDGPUAsyncOperations.md

[Docs][AMDGPU] Explain completion of async operations

This improves the somewhat hand-wavey "memory model" currently described for
async operations. While this version is also not complete, it prepares for the
more complete memory model being written down.
DeltaFile
+25-14llvm/docs/AMDGPUAsyncOperations.md
+25-141 files

LLVM/project 1d6a3ddllvm/test/tools/llvm-offload-wrapper offload-wrapper.ll

[LinkerWrapper][test] fix test offload-wrapper.ll (#212713)

The llc RUN command added in #212614 needs the X86 backend registered
DeltaFile
+1-0llvm/test/tools/llvm-offload-wrapper/offload-wrapper.ll
+1-01 files

LLVM/project a2a2bf8llvm/lib/Target/AMDGPU SIISelLowering.cpp, llvm/test/CodeGen/AMDGPU/GlobalISel atomic_optimizations_mul_one.ll

[AMDGPU] Constant folding for wave-reduce intrinsics
DeltaFile
+377-19llvm/test/CodeGen/AMDGPU/GlobalISel/atomic_optimizations_mul_one.ll
+66-2llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+443-212 files

LLVM/project f53596dclang/docs ReleaseNotes.md, clang/include/clang/Basic ABIVersions.def

[MIPS][clang] make `_Complex` ABI match GCC (#212119)

fixes https://github.com/llvm/llvm-project/issues/212109

From the edits to the release notes:

- On MIPS, a `_Complex` value with an integer element type is now
returned packed
into a single integer register when it fits in one, matching GCC. A
`_Complex char` or
`_Complex short`, and on N32/N64 also a `_Complex int`, is no longer
returned
with one part per register. `-fclang-abi-compat=23` restores the
previous
  behavior. (#GH212109)

- On MIPS N32/N64, a `_Complex float` or `_Complex double` argument is
now packed
into integer registers, or onto the stack, once there is no longer room

    [5 lines not shown]
DeltaFile
+126-0clang/test/CodeGen/mips-complex-abi.c
+62-7clang/lib/CodeGen/Targets/Mips.cpp
+12-0clang/docs/ReleaseNotes.md
+6-0clang/include/clang/Basic/ABIVersions.def
+206-74 files

LLVM/project 25cc0d2llvm/lib/Target/AArch64 AArch64InstrInfo.cpp

[AArch64] NFC: simplify isCopyInstrImpl expression (#212487)

To something more intuitive by applying the following logic:
* `!isVirtual()` -> `isPhysical()`
* `!isPhysical()` -> `isVirtual()`
* `(a || b) && (!a || c)` -> `(!a && b) || (a && c)`
DeltaFile
+14-12llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
+14-121 files

LLVM/project c53789flibcxx/src/include atomic_support.h

[libc++][NFC] Clean up atomic_support.h (#212464)

We don't support any compilers which don't have the atomic builtins, so
we don't need to check whether they exist. There is also no need for an
anonymous namespace, since all the functions are inline.
DeltaFile
+1-23libcxx/src/include/atomic_support.h
+1-231 files

LLVM/project d630025mlir/test/Examples/Toy/Ch6 llvm-lowering.mlir, mlir/test/Examples/Toy/Ch7 llvm-lowering.mlir

[mlir][toy] Fix Ch6/Ch7 llvm-lowering tests (#212118)

Add missing `| FileCheck %s` to `RUN` lines so `CHECK` lines can be
verified. Also correct the expected result from `30` to `36`. The result
should be `6*6=36`.

The example in the tutorial is correct (`3.600000e+01`).
https://mlir.llvm.org/docs/Tutorials/Toy/Ch-6/

Signed-off-by: Felix Ye <felixyjs at gmail.com>
DeltaFile
+2-2mlir/test/Examples/Toy/Ch7/llvm-lowering.mlir
+2-2mlir/test/Examples/Toy/Ch6/llvm-lowering.mlir
+4-42 files