Changes

Summary

  1. [RISCV] Support simple fractional steps in matching VID sequences (details)
  2. [MLIR][OpenMP] Add support for critical construct (details)
  3. [clang] Make member var invalid when static initializer is invalid. (details)
  4. tsan: use Tid/StackID types in MBlock (details)
  5. [libc] Allow benchmarking several implementations at the same time. (details)
  6. [llvm-objcopy] IHexELFBuilder::addDataSections - fix evaluation ordering static analyzer warning (details)
  7. Make simple requirements starting with requires ill-formed in in requirement body (details)
  8. tsan: use semaphores for thread creation synchronization (details)
  9. [X86] Add title comment to separate the "CPU Families" features from the other subtarget features. NFCI. (details)
  10. This feature is not in Clang 13 and only has partial support (details)
  11. [InstCombine] Remove nnan requirement for transformation to fabs from select (details)
  12. [InstCombine] Fold phi ( inttoptr/ptrtoint x ) to phi (x) (details)
  13. Revert "[InstCombine] Remove nnan requirement for transformation to fabs from select" (details)
  14. [OpenMP] libomp: taskwait depend implementation fixed. (details)
  15. [DAG] Cleanup DAGCombiner::CombineConsecutiveLoads early-outs. NFCI. (details)
  16. [mlir][CPURunner] Avoid a crash in memrefCopy when called with empty shapes. (details)
Commit cba6aab9715988b522c21b0e04a7d9b888a81394 by fraser
[RISCV] Support simple fractional steps in matching VID sequences

This patch extends the optimization of VID-sequence BUILD_VECTORs
introduced in D104921 to include simple fractional steps composed of a
separated integer numerator and denominator.

A notable limitation in this sequence detection is that only sequences
with steps N/1 or 1/D are found, meaning that the step between elements
and the frequency with which it changes is consistent across the whole
sequence. Fractional steps such as 2/3 won't be matched as those would
involve more complex tracking of state or some level of backtracking.

As is stands, however, this patch is sufficient to match common
interleave-type shuffle indices, for example matching `<0,0,1,1>` (or
commonly `<0,u,1,u>` or `<u,0,u,1>`) to an index sequence divided by 2.

While the optimization is relatively `undef`-tolerant, due to greedy
pattern-matching there even are some simple patterns which confuse the
sequence detection into identifying either a suboptimal sequence or no
sequence at all.

Currently only fractional-step sequences identified as having a
power-of-two denominator are actually lowered to RVV instructions. This
is to avoid introducing divisions into the generated code.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D106533
The file was modifiedllvm/lib/Target/RISCV/RISCVISelLowering.cpp
The file was modifiedllvm/test/CodeGen/RISCV/rvv/common-shuffle-patterns.ll
The file was modifiedllvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-buildvec.ll
The file was modifiedllvm/test/CodeGen/RISCV/rvv/fixed-vectors-int.ll
The file was modifiedllvm/test/CodeGen/RISCV/rvv/fixed-vectors-int-shuffles.ll
The file was modifiedllvm/test/CodeGen/RISCV/rvv/interleave-crash.ll
Commit 59989d68ba065b8dc1909d525dfd135d9e3c0206 by kiran.chandramohan
[MLIR][OpenMP] Add support for critical construct

This patch adds the critical construct to the OpenMP dialect. The
implementation models the definition in 2.17.1 of the OpenMP 5 standard.
A name and hint can be specified. The name is a global entity or has
external linkage, it is modelled as a FlatSymbolRefAttr. Hint is
modelled as an integer enum attribute.
Also lowering to LLVM IR using the OpenMP IRBuilder.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D107135
The file was modifiedmlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
The file was modifiedmlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
The file was modifiedmlir/include/mlir/Dialect/OpenMP/OpenMPOps.td
The file was modifiedmlir/test/Dialect/OpenMP/ops.mlir
The file was modifiedmlir/test/Target/LLVMIR/openmp-llvm.mlir
The file was modifiedmlir/test/Dialect/OpenMP/invalid.mlir
Commit 08128fe7059e20b3f97ae5abbdeff2e6f6c711ed by adamcz
[clang] Make member var invalid when static initializer is invalid.

Previously we would show an error, but keep the member, and also the
CXXRrecordDecl, valid. This could lead to crashes when attempting to
access the record layout or size.

Differential Revision: https://reviews.llvm.org/D105478
The file was modifiedclang/test/SemaCXX/crash-auto-36064.cpp
The file was modifiedclang/test/SemaCXX/cxx11-crashes.cpp
The file was addedclang/test/AST/ast-dump-undeduced-expr.cpp
The file was modifiedclang/lib/Parse/ParseDeclCXX.cpp
Commit 559426ae7695321a4609ae6799455f86cbfc2257 by dvyukov
tsan: use Tid/StackID types in MBlock

Replace more raw types with Tid/StackID typedefs.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107335
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_defs.h
Commit e4dee762245d1fefc6bcae643ecc55063aef2e9c by gchatelet
[libc] Allow benchmarking several implementations at the same time.

Next step is to generate an archive with all implementations and a header listing them all.

Differential Revision: https://reviews.llvm.org/D107336
The file was modifiedlibc/benchmarks/LibcMemoryBenchmark.cpp
The file was modifiedlibc/benchmarks/LibcMemoryBenchmark.h
The file was modifiedlibc/benchmarks/LibcMemoryGoogleBenchmarkMain.cpp
Commit 43ff058e78d9e4fa47080b61fc3811da80db1b3f by llvm-dev
[llvm-objcopy] IHexELFBuilder::addDataSections - fix evaluation ordering static analyzer warning

As detailed on https://pvs-studio.com/en/blog/posts/cpp/0771/ and raised on D62583, the SecNo++ increment is not guaranteed to occur before the second use of SecNo in the same addSection() call.

This patch pulls out the increment (just for clarity) and replaces the second use of SecNo with a constant zero value (we're using stable_sort so the value isn't critical).

Differential Revision: https://reviews.llvm.org/D107273
The file was modifiedllvm/tools/llvm-objcopy/ELF/Object.cpp
Commit 977bdf6f44edabb857bdff9ca249aa6eccb98e96 by aaron
Make simple requirements starting with requires ill-formed in in requirement body

This patch implements P2092

Simple requirements in requirement body shall not start with requires.
A warning was already in place so we just turn this warning into an error.

In addition, we add tests to make sure typename is optional in
requirement-parameter-list as per the same paper.
The file was modifiedclang/www/cxx_status.html
The file was modifiedclang/test/Parser/cxx2a-concepts-requires-expr.cpp
The file was modifiedclang/lib/Parse/ParseExprCXX.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticParseKinds.td
Commit e72ad3c19a15a5716617f8c1d273ca506dc68276 by dvyukov
tsan: use semaphores for thread creation synchronization

We currently use ad-hoc spin waiting to synchronize thread creation
and thread start both ways. But spinning tend to degrade ungracefully
under high contention (lots of threads are created at the same time).
Use semaphores for synchronization instead.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107337
The file was modifiedcompiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp
Commit d3917bbfc6bdd0a599a4d3350a4f215a7b33cf94 by llvm-dev
[X86] Add title comment to separate the "CPU Families" features from the other subtarget features. NFCI.

Hopefully we can get rid of these some day...
The file was modifiedllvm/lib/Target/X86/X86.td
Commit 80c17bb29838bee0d67a7bc2c775a8a91d69ac2d by aaron
This feature is not in Clang 13 and only has partial support
The file was modifiedclang/www/cxx_status.html
Commit 6180ce2e2abeb6f1f1b57852773ea07b8be290fa by krishna17060
[InstCombine] Remove nnan requirement for transformation to fabs from select

In this patch, the "nnan" requirement is removed for the canonicalization of select with fcmp to fabs.
(i) FSub logic: Remove check for nnan flag presence in fsub. Example: https://alive2.llvm.org/ce/z/751svg (fsub).
(ii) FNeg logic: Remove check for the presence of nnan and nsz flag in fneg. Example: https://alive2.llvm.org/ce/z/a_fsdp (fneg).

Differential Revision: https://reviews.llvm.org/D106872
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
The file was modifiedllvm/test/Transforms/InstCombine/fabs.ll
Commit d99260641b30b0638c6a1e60bcb971ec09fa5368 by krishna17060
[InstCombine] Fold phi ( inttoptr/ptrtoint x ) to phi (x)

The inttoptr/ptrtoint roundtrip optimization is not always correct.
We are working towards removing this optimization and adding support to specific cases where this optimization works.

In this patch, we focus on phi-node operands with inttoptr casts.
We know that ptrtoint( inttoptr( ptrtoint x) ) is same as ptrtoint (x).
So, we want to remove this roundtrip cast which goes through phi-node.

Reviewed By: aqjune

Differential Revision: https://reviews.llvm.org/D106289
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
The file was modifiedllvm/lib/Transforms/InstCombine/InstructionCombining.cpp
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineInternal.h
The file was addedllvm/test/Transforms/InstCombine/phi-int2ptr-fold.ll
Commit 946fd4ea65bdd0a97f426c4fa4731f1620a9aa68 by krishna17060
Revert "[InstCombine] Remove nnan requirement for transformation to fabs from select"

This reverts commit 6180ce2e2abeb6f1f1b57852773ea07b8be290fa.
The file was modifiedllvm/test/Transforms/InstCombine/fabs.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
Commit 8e29b4b323b87f3855dc71abf1e3f3d48952a4e4 by Andrey.Churbanov
[OpenMP] libomp: taskwait depend implementation fixed.

Fix for https://bugs.llvm.org/show_bug.cgi?id=49723.
Eliminated references from task dependency hash to node allocated on stack,
thus eliminated accesses to stale memory. So the node now never freed.
Uncommented assertion which triggered when stale memory accessed.
Removed unneeded ref count increment for stack allocated node.

Differential Revision: https://reviews.llvm.org/D106705
The file was modifiedopenmp/runtime/src/kmp_taskdeps.cpp
The file was addedopenmp/runtime/test/tasking/kmp_taskwait_depend_in.c
The file was modifiedopenmp/runtime/src/kmp_taskdeps.h
Commit 11396641e46c22fe8fede7c2b49d6f055641a220 by llvm-dev
[DAG] Cleanup DAGCombiner::CombineConsecutiveLoads early-outs. NFCI.

We had some similar hasOneUse/isNON_EXTLoad early-outs spread out over different parts of the method - we should pull them all together.

Noticed while triaging PR45116
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Commit 76fd3d4410c1dc637944a930a3ce760836b4d765 by akuegel
[mlir][CPURunner] Avoid a crash in memrefCopy when called with empty shapes.

Differential Revision: https://reviews.llvm.org/D107346
The file was modifiedmlir/test/mlir-cpu-runner/copy.mlir
The file was modifiedmlir/lib/ExecutionEngine/CRunnerUtils.cpp