Changes

Summary

  1. [LoongArch] Support lowering br_jt (details)
  2. [TTI] Improve description of TargetCostKind enums to aid targets in choosing cost values (details)
  3. [LoongArch][test] Replace bashism `|&` to `2>&1 |` (NFC) (details)
  4. [SPIRV] Add tests to improve test coverage (details)
  5. [JumpThreading] Process range comparisions with non-local cmp instructions (details)
  6. [GlobalOpt] Fix debug variance problem in hasOnlyColdCalls (details)
  7. [clang] Skip re-building lambda expressions in parameters to consteval fns. (details)
  8. [GlobalOpt] Add test case for #56762. (details)
  9. [CostModel][X86] Add CostKinds handling for fadd/fsub/fneg ops (details)
  10. [bazel] additional build fixes for libc (details)
  11. Revert "[InstCombine] Treat passing undef to noundef params as UB" (details)
  12. [Clang][Comments] Fix `Index/comment-lots-of-unknown-commands.c` (details)
  13. [TypePromotionPass] Rename variable to avoid name conflict. NFC (details)
  14. [LoopLoadElim] Add stores with matching sizes as load-store candidates (details)
Commit 2dd434c3ee1709b981f7c29744f3e17cf40f42d1 by luweining
[LoongArch] Support lowering br_jt

Jump tables cannot be generated yet, due to missing support for emitting
local addresses.

Differential Revision: https://reviews.llvm.org/D132653
The file was addedllvm/test/CodeGen/LoongArch/jump-table.ll
The file was modifiedllvm/lib/Target/LoongArch/LoongArchISelLowering.cpp (diff)
Commit 7338f9709bba25d23960dfea475efa2e49608c1c by llvm-dev
[TTI] Improve description of TargetCostKind enums to aid targets in choosing cost values

I'm not sure how much to add to the description as we've tried to allow targets to interpret the TargetCostKind enums in their own way. But we need to make it clear that certain cost kinds need to match threshold numbers used by various passes (and vice-versa when passes are determining a cost-benefit threshold).

I'm not keen on the "The weighted sum of size and latency" description, but its very difficult to come up with anything else that's suitably generic (e.g. X86 will use uop counts here to easily work with LoopMicroOpBufferSize thresholds, even though high latency fdiv/fsqrt instructions still often have low uop counts).

Differential Revision: https://reviews.llvm.org/D132288
The file was modifiedllvm/include/llvm/Analysis/TargetTransformInfo.h (diff)
Commit 14e8741f32783ec94227330904dd7a1d3bc7422a by luweining
[LoongArch][test] Replace bashism `|&` to `2>&1 |` (NFC)

The bash syntax `|&` is unsupported on other shells.

Differential Revision: https://reviews.llvm.org/D133187
The file was modifiedllvm/test/MC/LoongArch/Relocations/reloc-directive-err.s (diff)
Commit f20c9c42d2ca13354c8aebc093a61ce692903eed by andrey.tretyakov
[SPIRV] Add tests to improve test coverage

Differential Revision: https://reviews.llvm.org/D132903
The file was addedllvm/test/CodeGen/SPIRV/image-unoptimized.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/cl-types.ll
The file was addedllvm/test/CodeGen/SPIRV/instructions/scalar-floating-point-arithmetic.ll
The file was addedllvm/test/CodeGen/SPIRV/spirv.Queue.ll
The file was addedllvm/test/CodeGen/SPIRV/instructions/float-fast-flags.ll
The file was addedllvm/test/CodeGen/SPIRV/llvm-intrinsics/nearbyint.ll
The file was addedllvm/test/CodeGen/SPIRV/llvm-intrinsics/ceil.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/spirv-types.ll
The file was addedllvm/test/CodeGen/SPIRV/read_image.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/OpImageReadMS.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/SampledImage.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/explicit-conversions.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/OpImageWrite.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/OpImageSampleExplicitLod.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/clk_event_t.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/image_get_size_with_access_qualifiers.ll
The file was addedllvm/test/CodeGen/SPIRV/llvm-intrinsics/cttz.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/image_with_access_qualifiers.ll
The file was addedllvm/test/CodeGen/SPIRV/no_capability_shader.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/OpConstantSampler.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/OpSwitchUnreachable.ll
The file was addedllvm/test/CodeGen/SPIRV/image_decl_func_arg.ll
The file was addedllvm/test/CodeGen/SPIRV/link-attribute.ll
The file was addedllvm/test/CodeGen/SPIRV/SampledImageRetType.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/OpGroupAsyncCopy.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/optional-core-features-multiple.ll
The file was addedllvm/test/CodeGen/SPIRV/llvm-intrinsics/sqrt.ll
The file was addedllvm/test/CodeGen/SPIRV/image_dim.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/OpImageQuerySize.ll
The file was addedllvm/test/CodeGen/SPIRV/transcoding/check_ro_qualifier.ll
The file was addedllvm/test/CodeGen/SPIRV/llvm-intrinsics/fabs.ll
The file was addedllvm/test/CodeGen/SPIRV/mangled_function.ll
The file was addedllvm/test/CodeGen/SPIRV/llvm-intrinsics/ctlz.ll
The file was addedllvm/test/CodeGen/SPIRV/opencl.queue_t.ll
The file was addedllvm/test/CodeGen/SPIRV/llvm-intrinsics/abs.ll
The file was addedllvm/test/CodeGen/SPIRV/image_store.ll
The file was addedllvm/test/CodeGen/SPIRV/event_no_group_cap.ll
The file was addedllvm/test/CodeGen/SPIRV/image.ll
Commit be37caca0055df77c9e3ca0a63d4b2ccefe94f7d by npopov
[JumpThreading] Process range comparisions with non-local cmp instructions

Use getPredicateOnEdge method if value is a non-local
compare-with-a-constant instruction, that can give more precise
results than getConstantOnEdge.

Differential Revision: https://reviews.llvm.org/D131956
The file was modifiedllvm/lib/Transforms/Scalar/JumpThreading.cpp (diff)
The file was modifiedllvm/test/Transforms/JumpThreading/range-compare.ll (diff)
Commit 51d4c7ceea61b5d83ba52398b5ca6d58d7551044 by mikael.holmen
[GlobalOpt] Fix debug variance problem in hasOnlyColdCalls

hasOnlyColdCalls skipped over calls to intrinsics, but it did so after
checking the linkage of the called function. This meant that the presence
of a call to a debug intrinsic could affect the outcome of the
optimization.

In my original reproducer (for an out of tree target) it was particularly
interesting, because the actual IR after GlobalOpt was not different with
debug instrinsics present, so -print-after-all printouts didn't show
anything there.

However, without debuginfo, GlobalOpt went further and ran
BlockFrequencyAnalysis and (more importanly) LoopAnalysis, and later on in
the pipeline, instcombine behaved in different ways when LoopInfo was
present.

So a call to a dbg.declare prevented running LoopAnalysis in
GlobalOpt, which later prevented InstCombine from doing an optimization.

The dbg-intrinsic-loopanalysis.ll testcase tries to expose this.

Then I also noted that adding a dbg.declare actually made the existing
testcase colccc_coldsites.ll generate different code, so I modified that
to now test it behaves the same way with and without the dbg.declare.

Reviewed By: nikic, fhahn

Differential Revision: https://reviews.llvm.org/D133193
The file was addedllvm/test/Transforms/GlobalOpt/dbg-intrinsic-loopanalysis.ll
The file was modifiedllvm/test/Transforms/GlobalOpt/PowerPC/coldcc_coldsites.ll (diff)
The file was modifiedllvm/lib/Transforms/IPO/GlobalOpt.cpp (diff)
Commit e7eec38246560781e0a4020b19c7eb038a8c5655 by usx
[clang] Skip re-building lambda expressions in parameters to consteval fns.

As discussed in this [comment](https://github.com/llvm/llvm-project/issues/56183#issuecomment-1224331699),
we end up building the lambda twice: once while parsing the function calls and then again while handling the immediate invocation.

This happens specially during removing nested immediate invocation.
Eg: When we have another consteval function as the parameter along with this lambda expression. Eg: `foo(bar([]{}))`, `foo(bar(), []{})`

While removing such nested immediate invocations, we should not rebuild this lambda. (IIUC, rebuilding a lambda would always generate a new type which will never match the original type from parsing)

Fixes: https://github.com/llvm/llvm-project/issues/56183
Fixes: https://github.com/llvm/llvm-project/issues/51695
Fixes: https://github.com/llvm/llvm-project/issues/50455
Fixes: https://github.com/llvm/llvm-project/issues/54872
Fixes: https://github.com/llvm/llvm-project/issues/54587

Differential Revision: https://reviews.llvm.org/D132945
The file was modifiedclang/lib/Sema/SemaExpr.cpp (diff)
The file was modifiedclang/test/SemaCXX/cxx2a-consteval.cpp (diff)
The file was modifiedclang/docs/ReleaseNotes.rst (diff)
Commit 91e67c074922cc667fa1c43fc1f01acb96faa0f9 by flo
[GlobalOpt] Add test case for #56762.

Add test case where GlobalOpt fails to remove loads to global fields
with struct types.
The file was modifiedllvm/test/Transforms/GlobalOpt/sra-many-stores.ll (diff)
Commit ad16f3e413545fa87a31f2ae9680b96fd8dd0507 by llvm-dev
[CostModel][X86] Add CostKinds handling for fadd/fsub/fneg ops

This was achieved with an updated version of the 'cost-tables vs llvm-mca' script D103695 which I'll update shortly

As we're using 'typical' worst case values, not all cost entries come from a single CPU - e.g. the latency/throughput from haswell but the size-latency(uops) from zen1/alderlake-e due to 'double pumping'
The file was modifiedllvm/lib/Target/X86/X86TargetTransformInfo.cpp (diff)
The file was modifiedllvm/test/Analysis/CostModel/X86/arith-fp-latency.ll (diff)
The file was modifiedllvm/test/Analysis/CostModel/X86/intrinsic-cost-kinds.ll (diff)
The file was modifiedllvm/test/Analysis/CostModel/X86/arith-fp-sizelatency.ll (diff)
Commit 8a4d6133deefc9ef63bc11481323608faff8f13c by goncharov.mikhail
[bazel] additional build fixes for libc

after fe41529755df946521df64ca9932b58c8eecb52b
The file was modifiedutils/bazel/llvm-project-overlay/libc/BUILD.bazel (diff)
Commit 18de7c6a3b3689bf69215429bde1fb2330a3e69d by omair.javaid
Revert "[InstCombine] Treat passing undef to noundef params as UB"

This reverts commit c911befaec494c52a63e3b957e28d449262656fb.

It has broken LLDB Arm/AArch64 Linux buildbots. I dont really understand
the underlying reason. Reverting for now make buildbot green.

https://reviews.llvm.org/D133036
The file was modifiedclang/test/CodeGenOpenCL/overload.cl (diff)
The file was modifiedllvm/test/Transforms/InstCombine/out-of-bounds-indexes.ll (diff)
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCalls.cpp (diff)
The file was modifiedllvm/test/Transforms/InstCombine/call-undef.ll (diff)
Commit 7c232b0867209a8f487bbcabca9289e9ef313bef by Egor Zhdan
[Clang][Comments] Fix `Index/comment-lots-of-unknown-commands.c`

This re-enables a test after it was disabled in https://reviews.llvm.org/D133009.

Fixes #57484.

Differential Revision: https://reviews.llvm.org/D133105
The file was modifiedclang/test/Index/comment-lots-of-unknown-commands.c (diff)
Commit 5073499b693d29195a707683bab6e0ebf97320eb by david.green
[TypePromotionPass] Rename variable to avoid name conflict. NFC
The file was modifiedllvm/lib/CodeGen/TypePromotion.cpp (diff)
Commit 958abe864ab777302d1e7aee7b6c5ea4b0fe9be6 by jolanta.jensen
[LoopLoadElim] Add stores with matching sizes as load-store candidates

We are not building up a proper list of load-store candidates because
we are throwing away stores where the type don't match the load.
This patch adds stores with matching store sizes as candidates.
Author of the original patch: David Sherwood.

Differential Revision: https://reviews.llvm.org/D130233
The file was modifiedllvm/lib/Transforms/Scalar/LoopLoadElimination.cpp (diff)
The file was modifiedllvm/test/Transforms/LoopLoadElim/type-mismatch-opaque-ptr.ll (diff)
The file was modifiedllvm/test/Transforms/LoopLoadElim/type-mismatch.ll (diff)