LLVM/project 8b56d41llvm/lib/Transforms/Vectorize LoopVectorize.cpp

[VPlan] Create casts before ComputeReductionResult (NFC). (#199372)

This ensures ComputeReductionResult is created with operands that have
their correct types set at construction.
DeltaFile
+30-34llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+30-341 files

LLVM/project 5ccea57llvm/utils/gn/secondary/clang/lib/CodeGen BUILD.gn, llvm/utils/gn/secondary/lldb/source/Target BUILD.gn

[gn build] Port commits (#199375)

170d37d861b0
1b0e603087b6
9997b11c6469
DeltaFile
+1-0llvm/utils/gn/secondary/llvm/lib/TargetParser/BUILD.gn
+1-0llvm/utils/gn/secondary/lldb/source/Utility/BUILD.gn
+0-1llvm/utils/gn/secondary/lldb/source/Target/BUILD.gn
+1-0llvm/utils/gn/secondary/clang/lib/CodeGen/BUILD.gn
+3-14 files

LLVM/project 7bf2d97clang/docs LanguageExtensions.rst, clang/lib/CodeGen CodeGenModule.cpp CodeGenModule.h

[PowerPC][AIX] Add -mloadtime-comment-vars support to preserve variables
in the final object file.
DeltaFile
+154-74llvm/lib/Transforms/Utils/LowerCommentStringPass.cpp
+77-0clang/lib/CodeGen/CodeGenModule.cpp
+67-0clang/docs/LanguageExtensions.rst
+37-0clang/test/CodeGen/loadtime-comment-vars.c
+34-0llvm/test/Transforms/LowerCommentString/loadtime-comment-vars.ll
+8-0clang/lib/CodeGen/CodeGenModule.h
+377-743 files not shown
+392-749 files

LLVM/project 5c6af83llvm/lib/Transforms/Vectorize LoopVectorizationLegality.cpp, llvm/test/Transforms/LoopVectorize optsize.ll

[LV] Don't add stride SCEV predicates when runtime checks are disabled. (#199370)

Don't pass symbolic strides to getPtrStride if SCEV runtime checks are
not allowed (e.g. because optimizing for size). This prevents
getPtrStride from adding additional SCEV checks for symbolic strides.
DeltaFile
+30-20llvm/test/Transforms/LoopVectorize/optsize.ll
+5-3llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+35-232 files

LLVM/project 0344e9fllvm/lib/Transforms/Vectorize LoopVectorize.cpp VPlan.h

[VPlan] Thread types through VPHeaderPHIRecipe and VPDerivedIVRecipe (NFC) (#195894)

Update VPHeaderPHIRecipe and VPDerivedIVRecipe to set the scalar types
for their defined values.

This requires updating addReductionResultComputation to construct the
new chain for AnyOf reductions up-front.

Depends on https://github.com/llvm/llvm-project/pull/195891

PR: https://github.com/llvm/llvm-project/pull/195894
DeltaFile
+37-20llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+21-14llvm/lib/Transforms/Vectorize/VPlan.h
+1-12llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
+11-0llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp
+2-2llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+72-485 files

LLVM/project a992929llvm/lib/Transforms/Utils LowerCommentStringPass.cpp

Apply changes from code browser

Apply changes from code browser
DeltaFile
+53-24llvm/lib/Transforms/Utils/LowerCommentStringPass.cpp
+53-241 files

LLVM/project aaf3e32clang/include/clang/Options Options.td, clang/lib/CodeGen CodeGenModule.cpp CodeGenModule.h

[PowerPC][AIX] Add -mloadtime-comment-vars support
DeltaFile
+88-54llvm/lib/Transforms/Utils/LowerCommentStringPass.cpp
+78-0clang/lib/CodeGen/CodeGenModule.cpp
+28-0clang/test/CodeGen/loadtime-comment-vars.c
+26-0llvm/test/Transforms/LowerCommentString/loadtime-comment-vars.ll
+8-0clang/lib/CodeGen/CodeGenModule.h
+7-0clang/include/clang/Options/Options.td
+235-542 files not shown
+243-548 files

LLVM/project 47e6290llvm/lib/Transforms/Utils SimplifyLibCalls.cpp, llvm/test/Transforms/InstCombine fmod.ll

[SimplifyLibCalls] Don't set nnan on synthesized frem in optimizeFMod (#199284)

LibCallSimplifier can fold a libcall to fmod to an frem instruction if
the fmod call doesn't set errno.

fmod(x, y) sets errno if x == +/-Inf or y == 0.  The old code assumed
that this was also a sufficient condition to prove that the result is
not NaN, and so unconditionally set the nnan fmf on the new frem
instruction.  That's not sound; e.g. fmod(x, NaN) == frem(x, NaN) ==
NaN.

We don't actually have to worry about propagating the `nnan` flag;
B.CreateFRemFMF does it for us automagically.

This bug was found by a large run of Opus 4.7 looking for bugs in LLVM.
DeltaFile
+19-5llvm/test/Transforms/InstCombine/fmod.ll
+7-12llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+26-172 files

LLVM/project 6d3bc00llvm/lib/Transforms/Utils SimplifyLibCalls.cpp, llvm/test/Transforms/InstCombine fdim.ll

[SimplifyLibCalls] Fix optimizeFdim for Inf-Inf cases (#199306)

fdim(x,y) is defined as

    NaN if x or y is NaN, otherwise
    (x > y) ? x - y : +0

optimizeFdim computed fdim(x,y) as max(x-y, +0).  This is not correct
when x == y == +/-Inf; the result should be 0, but this optimization
returns NaN.

I was surprised by this bug because there's even a testcase checking the
incorrect behavior.  But returning 0 matches the description in C99 and
POSIX, where, just to be extra clear, the spelling of the piecewise
function is

    NaN if either input is NaN
    x - y if x > y
    +0    if x <= y

    [4 lines not shown]
DeltaFile
+9-1llvm/test/Transforms/InstCombine/fdim.ll
+4-4llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+13-52 files

LLVM/project 9d533e9clang/tools/libclang CIndex.cpp

[clang] Fix crash in getCursorRawComments. (#199328)

Fix a regression introduced in PR #198452 where querying raw comments on
invalid cursors caused a segmentation fault due to unconditional
ASTContext lookup. Adding an early exit for unsupported cursor kinds at
the top of getCursorRawComment safely avoids resolving the context on
invalid cursors with null translation units.
DeltaFile
+2-0clang/tools/libclang/CIndex.cpp
+2-01 files

LLVM/project 37a2205llvm/lib/Transforms/Vectorize LoopVectorize.cpp, llvm/test/Transforms/LoopVectorize/X86/CostModel masked-interleaved-store-i16.ll

[LV] Determine NumPredStores before computing widening costs. (#199341)

Determine NumPredStores before computing widening costs, so we
consistently apply large predicated store cost to all stores, matching
the VPlan cost model. In practice that should not impact vectorization
decisions, as the huge cost for any predicated store other than the
first already effectively disables vectorization.
DeltaFile
+10-7llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+4-4llvm/test/Transforms/LoopVectorize/X86/CostModel/masked-interleaved-store-i16.ll
+14-112 files

LLVM/project 494c9d9clang/docs LanguageExtensions.rst, llvm/lib/Analysis ModuleSummaryAnalysis.cpp

[Analysis][AIX] Add !implicit.ref globals as ThinLTO summary ref edges to support pragma comment(copyright) LTO interaction

Teach ModuleSummaryAnalysis to include globals referenced via
!implicit.ref metadata as explicit reference edges in the ThinLTO
module summary via a new helper findImplicitRefEdges.
DeltaFile
+89-0llvm/test/LTO/PowerPC/pragma-comment-copyright-thinlto.ll
+52-34llvm/test/LTO/PowerPC/pragma-comment-copyright-lto.ll
+39-0llvm/test/Analysis/ModuleSummaryAnalysis/implicit-ref-edges.ll
+32-0clang/docs/LanguageExtensions.rst
+24-0llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+236-345 files

LLVM/project c089860llvm/test/LTO/PowerPC pragma-comment-copyright-lto.ll

[LTO] [Test] Add full lto test llvm/test/LTO/PowerPC/pragma-comment-copyright-lto.ll.
DeltaFile
+67-0llvm/test/LTO/PowerPC/pragma-comment-copyright-lto.ll
+67-01 files

LLVM/project 953c539clang/lib/CodeGen CodeGenModule.h

[NFC] Make ProcessPragmaCommentCopyright() private and move EmitLoadTimeComment() to the end of the class.
DeltaFile
+7-7clang/lib/CodeGen/CodeGenModule.h
+7-71 files

LLVM/project a5f9a03clang/docs LanguageExtensions.rst, clang/lib/CodeGen CodeGenModule.cpp CodeGenModule.h

Apply suggestions from code review

Co-authored-by: Hubert Tong <hubert.reinterpretcast at gmail.com>
DeltaFile
+0-11clang/lib/CodeGen/CodeGenModule.cpp
+3-6clang/lib/CodeGen/CodeGenModule.h
+2-3clang/lib/Parse/ParsePragma.cpp
+2-2clang/docs/LanguageExtensions.rst
+2-2clang/test/Preprocessor/pragma-comment.c
+1-1llvm/lib/Transforms/Utils/LowerCommentStringPass.cpp
+10-256 files

LLVM/project 0cfab95clang/lib/CodeGen CodeGenModule.cpp, clang/lib/Parse ParsePragma.cpp

[PowerPC][AIX] Support #pragma comment copyright for AIX

- Emit !aix.copyright.comment from Clang for the pragma.
- Lower it in LLVM to a TU-local string + llvm.used + !implicit.ref.
- Add module-import and backend relocation tests.
DeltaFile
+150-0llvm/lib/Transforms/Utils/LowerCommentStringPass.cpp
+92-0clang/test/Preprocessor/pragma-comment.c
+42-11clang/lib/Parse/ParsePragma.cpp
+52-0clang/lib/CodeGen/CodeGenModule.cpp
+41-0llvm/test/Transforms/LowerCommentString/lower-comment-string.ll
+30-0clang/test/CodeGen/PowerPC/pragma-comment-copyright-modules.cpp
+407-1122 files not shown
+531-1428 files

LLVM/project 4f82841libcxx/test/libcxx/containers/views/mdspan/mdspan assert.at.pass.cpp, libcxx/test/std/containers/views/mdspan/mdspan at.pass.cpp

[libc++][test] Merge test files for `mdspan::at` (#199330)

`libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.at.pass.cpp`
caused build bot failures for
- sanitizer-aarch64-linux-bootstrap-asan
- sanitizer-aarch64-linux-bootstrap-hwasan
- sanitizer-aarch64-linux-bootstrap-msan

It's not yet clear why current mechanisms don't work for these builds.
`TEST_HAS_NO_EXCEPTIONS` should have been working.

Also remove one unnecessary `static` and use `std::string_view(e.what())
== "mdspan"`.
DeltaFile
+0-112libcxx/test/libcxx/containers/views/mdspan/mdspan/assert.at.pass.cpp
+73-1libcxx/test/std/containers/views/mdspan/mdspan/at.pass.cpp
+73-1132 files

LLVM/project 12e366allvm/lib/CodeGen/SelectionDAG SelectionDAG.cpp, llvm/test/CodeGen/X86 known-never-zero.ll

[DAG] UDIV/SDIV exact nodes support DemandedElts + add test (#198715)

Resolves #183047

This patch updates isKnownNeverZero to handle DemandedElts for UDIV and SDIV exact nodes.
DeltaFile
+6-12llvm/test/CodeGen/X86/known-never-zero.ll
+1-1llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+7-132 files

LLVM/project 017f352llvm/lib/Target/X86 X86ISelLowering.cpp, llvm/test/CodeGen/X86 vector-fshr-rot-128.ll vector-fshr-rot-256.ll

[X86] Lower vector 8-bit rotr(x, 1) to pavgb pattern (#198980)

Fixes #198060
DeltaFile
+14-17llvm/test/CodeGen/X86/vector-fshr-rot-128.ll
+14-16llvm/test/CodeGen/X86/vector-fshr-rot-256.ll
+10-0llvm/lib/Target/X86/X86ISelLowering.cpp
+38-333 files

LLVM/project 3106698clang-tools-extra/clang-doc BitcodeWriter.cpp

[clang-doc][nfc] Avoid combining constexpr with std::initializer_list as this seems to give MSVC trouble. (#199311)

Some Windows bots using MSVC 2019 and 2022 get assertion errors in the
clang-doc lit tests (see
[here](https://github.com/llvm/llvm-project/pull/198066). This seems to
be due to MSVC having trouble with a correctly initializing structures
using std::initializer_list when embedded in a struct declared with
constexpr.

This workaround changes constexpr to const in a struct definition to
avoid this issue.
DeltaFile
+1-1clang-tools-extra/clang-doc/BitcodeWriter.cpp
+1-11 files

LLVM/project 5e8be92llvm/lib/Target/X86 X86ISelLowering.cpp

[X86] combineVectorInsert - use generic zext/shift/or pattern for constant concatenation (#199344)

Generalised the code added in #198273 to make it easier to support other
combos in future patches.

Hopefully we can get load combining to work here soon.
DeltaFile
+8-5llvm/lib/Target/X86/X86ISelLowering.cpp
+8-51 files

LLVM/project ad72dfblibcxx/test/support copy_move_types.h

[libc++][test] Make `copy_move_types.h` usable in old modes (#199183)

This PR makes types in `copy_move_types.h` usable in C++03/11 modes.
Because it is discovered that some types in `copy_move_types.h` are
useful for testing uninitialized memory algorithms in pre-C++20 modes.
DeltaFile
+143-136libcxx/test/support/copy_move_types.h
+143-1361 files

LLVM/project 9863053llvm/include/llvm/IR IntrinsicsNVVM.td, llvm/lib/IR AutoUpgrade.cpp

[NVPTX] Auto-upgrade llvm.nvvm.abs with int-min poison (#198646)

Update the auto-upgrade for llvm.nvvm.abs.i and llvm.nvvm.abs.ll to use
the generic llvm.abs intrinsic with is_int_min_poison=true. The previous
expansion used neg/icmp/select which gives defined INT_MIN -> INT_MIN
behavior, but loses the poison/undefined signed-min semantics needed for
NVPTX to select PTX abs.s32 and abs.s64 instrucitons when the source
operation permits signed-min overflow to be undefined. This is a
followup to #183851 . Using llvm.abs(..., true) preserves intended IR
semantics and lowers through the new ABS_MIN_POISON. We also update the
tests and add NVPTX CodeGen coverage for the legacy nvvm abs intrinsics.
DeltaFile
+24-0llvm/test/CodeGen/NVPTX/nvvm-abs.ll
+2-6llvm/test/Assembler/auto_upgrade_nvvm_intrinsics.ll
+3-4llvm/lib/IR/AutoUpgrade.cpp
+2-2llvm/include/llvm/IR/IntrinsicsNVVM.td
+31-124 files

LLVM/project ec771f7llvm/test/Transforms/LoopVectorize/AArch64 transform-narrow-interleave-to-widen-memory-metadata.ll

[LV] Add narrowing interleave group test with preservable metadata (NFC) (#199335)

Drop stale fixme and add test showing missed metadata preservation.
DeltaFile
+47-8llvm/test/Transforms/LoopVectorize/AArch64/transform-narrow-interleave-to-widen-memory-metadata.ll
+47-81 files

LLVM/project 38e0a91clang/include/clang/CIR MissingFeatures.h, clang/lib/CIR/CodeGen CIRGenItaniumCXXABI.cpp

[CIR] Attach noreturn attribute to __cxa_bad_cast (#198727)

## Summary

  - Mark `__cxa_bad_cast` as `noreturn` in CIR, mirroring the existing
`__cxa_bad_typeid` handling. The attribute is now set on every `CallOp`
that targets it,
    covering both the CodeGen direct path (`emitCallToBadCast`) and the
    target-lowering path (`buildBadCastCall`).
  - Drop the now-fulfilled `MissingFeatures::opFuncNoReturn` entry and
    the corresponding TODO/assert at the lone caller in
    `LowerItaniumCXXABI.cpp`.
  - Update FileCheck expectations in `dynamic-cast.cpp`,
    `dynamic-cast-exact.cpp`, and `abi-lower-after-unreachable.cpp` to
    require the `{noreturn}` attribute on the lowered
    `cir.call @__cxa_bad_cast()`.
DeltaFile
+5-4clang/lib/CIR/Dialect/Transforms/TargetLowering/LowerItaniumCXXABI.cpp
+5-1clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp
+2-2clang/test/CIR/CodeGen/dynamic-cast-exact.cpp
+1-1clang/test/CIR/CodeGen/abi-lower-after-unreachable.cpp
+1-1clang/test/CIR/CodeGen/dynamic-cast.cpp
+0-1clang/include/clang/CIR/MissingFeatures.h
+14-106 files

LLVM/project 23c92delibcxx/test/std/utilities/memory/specialized.algorithms destroy.h

[libc++][test] Add backported `destroy({_at,_n})` for tests (#199185)

It would be convenient to use `destroy_at`, `destroy`, and `destroy_n`
in tests for pre-C++17 uninitialized memory algorithms. So this PR add
backported versions of them for tests.
DeltaFile
+47-0libcxx/test/std/utilities/memory/specialized.algorithms/destroy.h
+47-01 files

LLVM/project 85c3fd0libc/test/shared shared_math_test.cpp

[libc] Fix shared math tests for gcc-13. (#199318)
DeltaFile
+11-6libc/test/shared/shared_math_test.cpp
+11-61 files

LLVM/project 0d8ba1dclang/include/clang/CIR/Dialect/IR CIROps.td, clang/lib/CIR/Lowering/DirectToLLVM LowerToLLVM.cpp

[CIR] Extract CIR_ClassCastOp base class for BaseClassAddrOp and DerivedClassAddrOp

Both ops have identical structure (arguments, results, assembly format)
and differ only in mnemonic and description. Extract a shared TableGen
base class to eliminate the duplication. Also improve the assembly format
to print nonnull before the operand and place the type after the offset.
DeltaFile
+22-33clang/include/clang/CIR/Dialect/IR/CIROps.td
+8-8clang/test/CIR/CodeGen/vtt.cpp
+5-5clang/test/CIR/CodeGen/derived-to-base.cpp
+5-5clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+4-4clang/test/CIR/CodeGen/inherited-ctors.cpp
+3-3clang/test/CIR/IR/vtt-addrpoint.cir
+47-5814 files not shown
+77-8820 files

LLVM/project 7bcc8e6llvm/lib/Target/X86 X86TargetTransformInfo.cpp, llvm/test/Analysis/CostModel/X86 reduce-smax.ll reduce-umax.ll

[CostModel][X86] Update VECREDUCE MINMAX costs based off llvm-mca analysis (#199208)

Add full CostKinds, to improve a lot of reduction matching in
vectorcombine/slp passes

These are based off SMIN/UMIN numbers, and a few SMAX/UMAX numbers don't
always match, but are typically within +/-1
DeltaFile
+150-150llvm/test/Analysis/CostModel/X86/reduce-smax.ll
+150-150llvm/test/Analysis/CostModel/X86/reduce-umax.ll
+150-150llvm/test/Analysis/CostModel/X86/reduce-umin.ll
+150-150llvm/test/Analysis/CostModel/X86/reduce-smin.ll
+79-148llvm/test/Transforms/SLPVectorizer/X86/horizontal-minmax.ll
+128-41llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+807-7899 files not shown
+992-1,22715 files

LLVM/project 111464cclang/include/clang/CIR/Dialect/IR CIROps.td, clang/lib/CIR/Lowering/DirectToLLVM LowerToLLVM.cpp

[CIR] Extract CIR_ClassCastOp base class for BaseClassAddrOp and DerivedClassAddrOp

Both ops have identical structure (arguments, results, assembly format)
and differ only in mnemonic and description. Extract a shared TableGen
base class to eliminate the duplication. Also improve the assembly format
to print nonnull before the operand and place the type after the offset.
DeltaFile
+22-33clang/include/clang/CIR/Dialect/IR/CIROps.td
+18-18clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp
+8-8clang/test/CIR/CodeGen/vtt.cpp
+5-5clang/test/CIR/CodeGen/derived-to-base.cpp
+4-4clang/test/CIR/CodeGen/inherited-ctors.cpp
+3-3clang/test/CIR/Lowering/vtt-addrpoint.cir
+60-7114 files not shown
+90-10120 files