LLVM/project a7831dcclang-tools-extra/clang-tidy/bugprone ImplicitWideningOfMultiplicationResultCheck.cpp, clang-tools-extra/docs ReleaseNotes.md

[Clang-Tidy] Improve `bugprone-implicit-widening-of-multiplication-result`. (#214501)

Implicit integer promotions make it a bit difficult to deduce the
correct type in the following expression:
```
std::uint64_t calc_array_size(std::uint16_t width, std::uint16_t height) {
    return width * height;
}
```

Originally, Clang-Tidy suggested to use the following code:
```
return static_cast<long long>(width) * height;
```

It is fully correct according to the C++ rules, but it makes it a bit
harder to reason for people. This change adds a more readable "FixIt"
taking into account the source type and avoid intermediate
representations.

Co-authored-by: Dmitrii Kuragin <dkuragin at adobe.com>
DeltaFile
+34-8clang-tools-extra/test/clang-tidy/checkers/bugprone/implicit-widening-of-multiplication-result-short.cpp
+13-5clang-tools-extra/clang-tidy/bugprone/ImplicitWideningOfMultiplicationResultCheck.cpp
+7-1clang-tools-extra/docs/ReleaseNotes.md
+54-143 files

LLVM/project b0d94cborc-rt/include/orc-rt/bedrock IntervalSet.h ExecutorAddress.h

[orc-rt] Fix relative paths in includes. NFC. (#219340)
DeltaFile
+2-2orc-rt/include/orc-rt/bedrock/BitmaskEnum.h
+1-1orc-rt/include/orc-rt/bedrock/IntervalSet.h
+1-1orc-rt/include/orc-rt/bedrock/ExecutorAddress.h
+1-1orc-rt/include/orc-rt/bedrock/Endian.h
+5-54 files

LLVM/project 58b67abclang/lib/Driver OffloadBundler.cpp

[clang][OffloadBundler] Fix uninitialized iterator in BinaryFileHandler (#219346)

This patch initializes NextBundleInfo at the top of ReadHeader to
prevent an uninitialized iterator comparison.

ReadHeader has several early return points where it exits without
reading any bundles.  Upon an early return, NextBundleInfo never reaches
the assignment at the bottom of ReadHeader:

  NextBundleInfo = BundlesInfo.begin();

leaving NextBundleInfo default-constructed.  A subsequent call to
ReadBundleStart then attempts an invalid iterator comparison:

  if (NextBundleInfo == BundlesInfo.end())

where NextBundleInfo is still default-constructed.

This bug was discovered with tightened epoch checks in

    [2 lines not shown]
DeltaFile
+3-1clang/lib/Driver/OffloadBundler.cpp
+3-11 files

LLVM/project b0c1de2flang/lib/Parser parsing.cpp openmp-parsers.cpp, flang/lib/Semantics check-omp-structure.cpp

[flang][OpenMP] Support omx/ompx extension sentinels (#218475)

This adds support for the OpenMP 5.2 extension sentinels: !$omx, c$omx,
*$omx in fixed form and !$ompx in free form. Known directives after
these sentinels are handled just like !$omp, and unknown ones are
ignored with a warning so code using vendor extensions stays portable.
Added lit tests covering fixed form, free form, and the
ignore-with-warning behavior.

Assisted-by: Claude Opus 4.6

---------

Co-authored-by: Chandra Ghale <ghale at pe34genoa.hpc.amslabs.hpecorp.net>
Co-authored-by: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
DeltaFile
+45-0flang/test/Parser/OpenMP/sentinel-omx.f
+39-4flang/lib/Parser/openmp-parsers.cpp
+43-0flang/test/Parser/OpenMP/sentinel-ompx.f90
+34-0flang/test/Parser/OpenMP/sentinel-extension-ignored.f90
+18-7flang/lib/Parser/parsing.cpp
+17-1flang/lib/Semantics/check-omp-structure.cpp
+196-125 files not shown
+232-1611 files

LLVM/project e565c72flang/test/Lower/OpenMP metadirective-loop.f90

Improve metadirective loop tests
DeltaFile
+271-12flang/test/Lower/OpenMP/metadirective-loop.f90
+271-121 files

LLVM/project 06bfa42llvm/lib/Transforms/Scalar ScalarizeMaskedMemIntrin.cpp, llvm/utils profcheck-xfail.txt

[ScalarizeMaskedMemIntrin][ProfCheck] Correctly annotate branch weights (part 2) (#219286)

https://github.com/llvm/llvm-project/pull/218753 broke LLVM CI because
it added a new test in `ScalarizeMaskedMemIntrin` that was not opted out
of during profcheck. Profcheck failed because this pass creates new
branches that did not attach branch weight metadata. We don't have any
information on the distribution of masks at runtime, so we have to mark
branch weights as explicitly unknown.

This basically extends https://github.com/llvm/llvm-project/pull/181568,
Aiden am I missing something for why you didn't add the branch weight
metadata for all branch creation before?

Tested the `ScalarizeMaskedMemIntrin` tests with profcheck locally and
they all pass.
DeltaFile
+35-7llvm/lib/Transforms/Scalar/ScalarizeMaskedMemIntrin.cpp
+0-7llvm/utils/profcheck-xfail.txt
+35-142 files

LLVM/project 50d4fbcllvm/include/llvm/ADT FoldingSet.h, llvm/include/llvm/Analysis ScalarEvolution.h

[ADT] Remove unused IDHash parameter from Equals (NFC) (#219313)

This patch removes the unused IDHash parameter from several functions.
Now that FoldingSetTrait<SDVTListNode>::Equals no longer checks IDHash,
no implementation of Equals uses this parameter.

Assisted-by: Antigravity
DeltaFile
+8-12llvm/include/llvm/ADT/FoldingSet.h
+3-4llvm/lib/Support/FoldingSet.cpp
+2-2llvm/include/llvm/Analysis/ScalarEvolution.h
+1-1llvm/include/llvm/CodeGen/SelectionDAG.h
+14-194 files

LLVM/project ce4f490llvm/lib/Transforms/Vectorize VPlanTransforms.cpp

Use make_pointer_range
DeltaFile
+1-2llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+1-21 files

LLVM/project be0676allvm/test/Transforms/LoopVectorize/RISCV tail-folding-complex-mask.ll

Precommit test
DeltaFile
+163-0llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-complex-mask.ll
+163-01 files

LLVM/project 3099e1cllvm/lib/Transforms/Vectorize LoopVectorizationPlanner.h VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize/RISCV tail-folding-complex-mask.ll

[VPlan] Append recipes created via builder to worklist

The previous PR appended the top most created recipe to the worklist, and this PR extends it to any other nested recipes that were created, similar to InstCombine.

This removes the header mask in a good few more places on RISC-V as measured on SPEC CPU 2017, e.g. for the following loop:

```c
long f(const int *p, const int *q, long n) {
  long a = 0, b = 0;
  for (long i = 0;; i++) {
    if (p[i] && q[i]) { a += i; b += i; }
    if (i + 1 == n) break;
  }
  return a + b;
}
```

Before:


    [49 lines not shown]
DeltaFile
+24-7llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+11-4llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+5-7llvm/test/Transforms/LoopVectorize/RISCV/tail-folding-complex-mask.ll
+40-183 files

LLVM/project b8bd749llvm/test/Transforms/LoopVectorize blend-i1.ll

Precommit test
DeltaFile
+58-0llvm/test/Transforms/LoopVectorize/blend-i1.ll
+58-01 files

LLVM/project fe1edc7llvm/lib/Transforms/Vectorize VPlanTransforms.cpp, llvm/test/Transforms/LoopVectorize blend-i1.ll dont-fold-tail-for-divisible-TC.ll

[VPlan] Process simplifyRecipes in a worklist

This brings simplifyRecipes further in line with InstCombine, and asides from unlocking more simplifications it also helps avoid spurious test churn whenever passes are moved around simplifyRecipes.

For now just push the new recipe onto the worklist, not its users.
This uses a post order traversal so we maintain the same simplification order as before.

I've gone through and checked every simplification we do is a canonicalisation that converges, and I checked on llvm-test-suite + SPEC CPU 2017 in various configurations that we don't hit any cycles.
DeltaFile
+23-14llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+4-8llvm/test/Transforms/LoopVectorize/dont-fold-tail-for-divisible-TC.ll
+2-3llvm/test/Transforms/LoopVectorize/blend-i1.ll
+29-253 files

LLVM/project 5eaa5caflang/lib/Lower ConvertConstant.cpp, flang/lib/Optimizer/CodeGen CodeGen.cpp

[flang] Speed up large CHARACTER DATA initializers (#218813)

[flang] Speed up large CHARACTER DATA initializers

Repeated CHARACTER(KIND=1) array constants were lowered as one
fir.insert_value per element. Converting those chains to LLVM IR is
quadratic and can make compilation take tens of minutes.

Lower consecutive equal KIND=1 character elements with
fir.insert_on_range
and emit full-range initializers as a single flattened [N x i8] LLVM
global
string, keeping Fortran blank padding.

A 160000-element character DATA statement now compiles in well under a
second and before was more than 10 minutes.
DeltaFile
+51-11flang/lib/Optimizer/CodeGen/CodeGen.cpp
+40-0flang/test/Lower/character-array-constant.f90
+20-13flang/lib/Lower/ConvertConstant.cpp
+111-243 files

LLVM/project f6dbeb9libcxxabi/src/demangle ItaniumDemangle.h, libcxxabi/test DemangleTestCases.inc

[ItaniumDemangle] Fix conversion operators failing to demangle types with substitutions
DeltaFile
+9-0llvm/unittests/Demangle/DemangleTest.cpp
+5-0llvm/include/llvm/Testing/Demangle/DemangleTestCases.inc
+5-0libcxxabi/test/DemangleTestCases.inc
+4-0llvm/include/llvm/Demangle/ItaniumDemangle.h
+4-0libcxxabi/src/demangle/ItaniumDemangle.h
+27-05 files

LLVM/project 92efec0clang/docs ReleaseNotes.md, clang/lib/AST RecordLayoutBuilder.cpp

[AST] Make err_struct_too_large check target-aware (#218749)

ASTContext::getASTRecordLayout used a fixed 1ULL << 60 threshold for
err_struct_too_large, regardless of the target's size_t width.

Scale the threshold to the target's size_t width instead, so it is below
(1 << 32) on 32-bit architectures. Diagnosing the overflow in Sema
avoids the crash in codegen.

rdar://183351516
DeltaFile
+15-4clang/test/AST/absurdly_big_struct.cpp
+4-1clang/lib/AST/RecordLayoutBuilder.cpp
+4-0clang/docs/ReleaseNotes.md
+23-53 files

LLVM/project 1442b18llvm/lib/CodeGen TargetLoweringObjectFileImpl.cpp, llvm/test/CodeGen/X86 code-model-elf-text-sections.ll

[X86] Properly inherit all section flags from parent for basic block sections (#219289)

Or else we miss flags like SHF_X86_64_LARGE.
DeltaFile
+18-0llvm/test/CodeGen/X86/code-model-elf-text-sections.ll
+3-1llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
+21-12 files

LLVM/project 8950c53utils/bazel/llvm-project-overlay/lldb/source/Plugins plugin_config.bzl BUILD.bazel

[Bazel] Fixes 8921ec7 (#219331)

This fixes 8921ec7e89e024c6185bc99cc195d787b3537ea6 (#217791).

Buildkite error link:
https://buildkite.com/llvm-project/upstream-bazel/builds?commit=8921ec7e89e024c6185bc99cc195d787b3537ea6

Co-authored-by: Google Bazel Bot <google-bazel-bot at google.com>
DeltaFile
+9-3utils/bazel/llvm-project-overlay/lldb/source/Plugins/BUILD.bazel
+1-1utils/bazel/llvm-project-overlay/lldb/source/Plugins/plugin_config.bzl
+10-42 files

LLVM/project 860a07blibc/include netdb.yaml, libc/include/llvm-libc-macros/linux netdb-macros.h

[libc] Add stubs for POSIX netdb.h and getaddrinfo (#219337)

* Add the `<netdb.h>` POSIX header and declare `struct addrinfo` and
`freeaddrinfo` and `getaddrinfo` methods
as defined in
https://pubs.opengroup.org/onlinepubs/9799919799/functions/getaddrinfo.html
;
* Provide Linux-specific definitions for `EAI_` macro family;
* Add header/entrypoints to the list of "experimental" (i.e. WIP)
entrypoints on Linux systems;
* Create the proxy header harness for types / Linux-specific macro.
* Provide stub implementations - no-op `freeaddrinfo` and `getaddrinfo`
that returns `EAI_SYSTEM` and sets errno to `ENOSYS`. Validate this
behavior in unit tests.

Assisted by automated tooling, human-reviewed
DeltaFile
+44-0libc/include/netdb.yaml
+34-0libc/src/netdb/getaddrinfo.cpp
+34-0libc/test/src/netdb/netdb_test.cpp
+31-0libc/include/llvm-libc-types/struct_addrinfo.h
+29-0libc/src/netdb/getaddrinfo.h
+28-0libc/include/llvm-libc-macros/linux/netdb-macros.h
+200-019 files not shown
+423-025 files

LLVM/project 0309576libc/src/__support/macros config.h, libc/src/unistd/linux execle.cpp

[libc] Do not suppress -Wvla-cxx-extension for older clang versions. (#219342)
DeltaFile
+4-0libc/src/__support/macros/config.h
+1-1libc/src/unistd/linux/execle.cpp
+5-12 files

LLVM/project d2a9262llvm/lib/Transforms/Utils PredicateInfo.cpp, llvm/test/Transforms/SCCP issue219130-assume-range.ll

[PredicateInfo] Insert copy instructions from assume in dependency order
DeltaFile
+12-3llvm/lib/Transforms/Utils/PredicateInfo.cpp
+4-7llvm/test/Transforms/SCCP/issue219130-assume-range.ll
+2-2llvm/test/Transforms/Util/PredicateInfo/assume-range-order.ll
+18-123 files

LLVM/project 370c3callvm/test/Transforms/SCCP issue219130-assume-range.ll, llvm/test/Transforms/Util/PredicateInfo assume-range-order.ll

pre-commit test
DeltaFile
+71-0llvm/test/Transforms/SCCP/issue219130-assume-range.ll
+22-0llvm/test/Transforms/Util/PredicateInfo/assume-range-order.ll
+93-02 files

LLVM/project 592d30fclang/test/AST/HLSL Textures-vector-AST.hlsl Textures-scalar-AST.hlsl

Remove IS_ARRAY macro. Use ARRAY and NOARRAY check-prefixes instead
DeltaFile
+37-113clang/test/AST/HLSL/Textures-vector-AST.hlsl
+37-113clang/test/AST/HLSL/Textures-scalar-AST.hlsl
+74-2262 files

LLVM/project 01e1ec8clang/lib/CodeGen CGHLSLBuiltins.cpp, clang/lib/Sema HLSLExternalSemaSource.cpp HLSLBuiltinTypeDeclBuilder.cpp

Merge branch 'users/icohedron/texturecube' into users/icohedron/texturecubearray
DeltaFile
+187-131clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
+40-14clang/lib/CodeGen/CGHLSLBuiltins.cpp
+29-10clang/lib/Sema/HLSLExternalSemaSource.cpp
+15-22clang/test/SemaHLSL/Resources/Textures-SampleGrad.hlsl
+15-22clang/test/SemaHLSL/Resources/Textures-SampleCmp.hlsl
+15-22clang/test/SemaHLSL/Resources/Textures-SampleBias.hlsl
+301-2218 files not shown
+436-25514 files

LLVM/project d1470d1libc/src/__support/math lgammaf16.h, libc/src/unistd/linux execle.cpp

[libc] Fix some warnings. (#219252)

vla warnings in libc/src/unistd/linux/execle.cpp and constexpr warnings
in libc/src/__support/math/lgammaf16.h
DeltaFile
+6-0libc/src/unistd/linux/execle.cpp
+1-1libc/src/__support/math/lgammaf16.h
+7-12 files

LLVM/project 0fe1ca3libc/hdr/types CMakeLists.txt struct_itimerspec.h, libc/include time.yaml

[libc][time] Add struct itimerspec. (#219325)

According to
https://man7.org/linux/man-pages/man3/itimerspec.3type.html.
DeltaFile
+27-0libc/hdr/types/struct_itimerspec.h
+24-0libc/include/llvm-libc-types/struct_itimerspec.h
+8-0libc/hdr/types/CMakeLists.txt
+5-0utils/bazel/llvm-project-overlay/libc/BUILD.bazel
+1-0libc/include/time.yaml
+1-0libc/include/llvm-libc-types/CMakeLists.txt
+66-01 files not shown
+67-07 files

LLVM/project edfd91cclang/include/clang/Lex PreprocessorOptions.h, clang/include/clang/Options Options.td

[clang][modules] Introduce a flag to keep redundant module lookups on relocation checks (#219107)

cf8597bd3b87 introduced relocation checks for dependency scans but also
disabled it when the modules were built in the same build session for
implicit module builds.

It turns out downstream projects (using implicit modules) can depend on
the relocation check calling `lookupModule` for order-dependent module
resolution to hide poorly modularized dependencies within the same build
session, since that call loads discovered modules during search.

Introduce `-fmodules-force-redundant-lookup` as an escape hatch to
maintain preexisting redundant lookup for those projects while keeping
the fast path the default for dependency scans.
DeltaFile
+21-0clang/test/Modules/build-session-validation-force-redundant-lookup.c
+7-4clang/lib/Serialization/ASTReader.cpp
+5-0clang/include/clang/Options/Options.td
+5-0clang/include/clang/Lex/PreprocessorOptions.h
+38-44 files

LLVM/project 3ede2f0libcxx/test/std/language.support/support.limits/support.limits.general unordered_map.version.compile.pass.cpp thread.version.compile.pass.cpp, libcxx/utils generate_feature_test_macro_components.py

[libc++][FTM] Updated FTMs from C++29 (#218241)

... and a few missing ones from previous standard versions.

---------

Co-authored-by: Hristo Hristov <zingam at outlook.com>
Co-authored-by: A. Jiang <de34 at live.cn>
DeltaFile
+314-0libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+72-6libcxx/utils/generate_feature_test_macro_components.py
+37-0libcxx/test/std/language.support/support.limits/support.limits.general/unordered_map.version.compile.pass.cpp
+37-0libcxx/test/std/language.support/support.limits/support.limits.general/thread.version.compile.pass.cpp
+37-0libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
+37-0libcxx/test/std/language.support/support.limits/support.limits.general/mdspan.version.compile.pass.cpp
+534-64 files not shown
+640-610 files

LLVM/project 5bff640llvm/lib/Target/WebAssembly WebAssemblyDebugValueManager.cpp

[WebAssembly] Avoid scanning unrelated debug values (NFCI) (#218378)

RegStackify looks for debug values when moving an instruction.

But when a debug use comes before the definition, it may collect values
for a lot of unrelated variables until the end of the block.

Stop early once all relevant values have been found instead.
DeltaFile
+74-54llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
+74-541 files

LLVM/project 54fcb62clang/test/SemaHLSL/Resources Textures-unsupported-methods-errors.hlsl

Fixup test comment
DeltaFile
+1-1clang/test/SemaHLSL/Resources/Textures-unsupported-methods-errors.hlsl
+1-11 files

LLVM/project b59c343clang/lib/CodeGen CGHLSLBuiltins.cpp, clang/lib/Sema HLSLExternalSemaSource.cpp HLSLBuiltinTypeDeclBuilder.cpp

Add setupTextureCubeType function, and add missing clamp overloads
DeltaFile
+187-131clang/lib/Sema/HLSLBuiltinTypeDeclBuilder.cpp
+40-14clang/lib/CodeGen/CGHLSLBuiltins.cpp
+15-22clang/test/SemaHLSL/Resources/Textures-SampleGrad.hlsl
+15-22clang/test/SemaHLSL/Resources/Textures-SampleCmp.hlsl
+15-22clang/test/SemaHLSL/Resources/Textures-SampleBias.hlsl
+28-6clang/lib/Sema/HLSLExternalSemaSource.cpp
+300-2177 files not shown
+426-24213 files