platform/upstream/llvm.git
17 months agoInstCombine: Fold is.fpclass(x, fcZero) to fcmp oeq 0
Matt Arsenault [Fri, 11 Nov 2022 00:15:34 +0000 (16:15 -0800)]
InstCombine: Fold is.fpclass(x, fcZero) to fcmp oeq 0

This requires the denormal mode to definitively be IEEE handling.

17 months ago[mlir][bufferization] Add restrict and writable attrs to to_tensor
Matthias Springer [Wed, 15 Feb 2023 08:51:42 +0000 (09:51 +0100)]
[mlir][bufferization] Add restrict and writable attrs to to_tensor

`restrict` is similar to the C++ restrict keyword. Results of `to_tensor` that have the `restrict` attribute are guaranteed to not alias any other `to_tensor` result (after bufferization).

Note: Since `to_memref` ops are not supported by One-Shot Bufferize and all bufferizable ops follow DPS rules (i.e., the buffer of the result is the buffer of an operand or an alias thereof), the buffer of a `to_tensor` op that has the `restrict` attribute is always an entirely "new" buffer that is not aliasing with the future buffer of any tensor value in the entire program. This makes such `to_tensor` ops "safe" from a bufferization perspective; they cannot cause RaW conflicts.

Differential Revision: https://reviews.llvm.org/D144021

17 months ago[SROA] NFC: Look at TypeStoreSize scalable property, rather than at type directly.
Sander de Smalen [Tue, 14 Feb 2023 14:08:02 +0000 (14:08 +0000)]
[SROA] NFC: Look at TypeStoreSize scalable property, rather than at type directly.

Some places in the code have checks for isa<ScalableVectorType> and use
that to bail out of the code. It's also possible to look directly at the
allocated type-size and check if the size is scalable. This means it's
possible to also support other scalable types that are not vectors (i.e.
TargetExtType).

This is split out from D136861.

17 months ago[llvm-c] Add C API methods to match 64bit ArrayType C++ API signatures
Meghan Denny [Wed, 15 Feb 2023 08:47:32 +0000 (09:47 +0100)]
[llvm-c] Add C API methods to match 64bit ArrayType C++ API signatures

Fixes https://github.com/llvm/llvm-project/issues/56496.

As mentioned in the issue, new functions LLVMArrayType2 and
LLVMGetArrayLength2 are created so as to not break the old API.
The old methods are then marked as deprecated and callers are
updated.

Differential Revision: https://reviews.llvm.org/D143700

17 months ago[mlir] Add vectorize_nd_extract attribute to the masked_vectorize Op
Andrzej Warzynski [Thu, 26 Jan 2023 10:18:44 +0000 (10:18 +0000)]
[mlir] Add vectorize_nd_extract attribute to the masked_vectorize Op

This patch simply adds `vectorize_nd_extract` (that's currently only
used for the `vectorize` Op) to `masked_vectorize`. A test is added to
verify that it works as expected - it prevents the masked vectorisation
of `tensor.extract`, which is currently not supported.

Differential Revision: https://reviews.llvm.org/D142634

17 months ago[Metarenamer] Use 'inst' as default name for instructions
Max Kazantsev [Wed, 15 Feb 2023 08:34:24 +0000 (15:34 +0700)]
[Metarenamer] Use 'inst' as default name for instructions

Currently we use 'tmp', which is also a keyword for FileCheck. It leads to this
annoying warning whenever a script for auto-generation of checks is used.
It is especially annoying that it happens to every test affected by metarenamer.

Just use another prefix for metarenamed names to avoid this.

Differential Revision: https://reviews.llvm.org/D144001
Reviewed By: nikic

17 months ago[clang][analyzer] Make messages of StdCLibraryFunctionsChecker user-friendly
Balázs Kéri [Wed, 15 Feb 2023 07:54:20 +0000 (08:54 +0100)]
[clang][analyzer] Make messages of StdCLibraryFunctionsChecker user-friendly

Warnings and notes of checker alpha.unix.StdLibraryFunctionArgs are
improved. Previously one warning and one note was emitted for every
finding, now one warning is emitted only that contains a detailed
description of the found issue.

Reviewed By: Szelethus

Differential Revision: https://reviews.llvm.org/D143194

17 months ago[LoopFuse] Remove legacy pass
Fangrui Song [Wed, 15 Feb 2023 07:53:39 +0000 (23:53 -0800)]
[LoopFuse] Remove legacy pass

Following recent changes to remove non-core legacy passes.

17 months ago[MLIR][Tensor] Introduce a pattern to propagate through `tensor.pad`
Lorenzo Chelini [Mon, 13 Feb 2023 13:44:03 +0000 (14:44 +0100)]
[MLIR][Tensor] Introduce a pattern to propagate through `tensor.pad`

Introduce a pattern to 'push down' a `tensor.unpack` through a
`tensor.pad`. The propagation happens if the unpack does not touch the
padded dimensions.

Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D143907

17 months ago[InstCombine] Fix InstCombinerImpl::foldICmpMulConstant for nsw and nuw mul with...
Craig Topper [Wed, 15 Feb 2023 07:43:17 +0000 (23:43 -0800)]
[InstCombine] Fix InstCombinerImpl::foldICmpMulConstant for nsw and nuw mul with unsigned compare.

If we have both an nsw and nuw flag, we would see the nsw flag
first and only handle signed comparisons.

This patch ignores the nsw flag if the comparison isn't signed.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D143766

17 months ago[mlir][Bazel] Add missing dependencies for 72429a42ac33564fa82449d99dc234da32a05498
Adrian Kuegel [Wed, 15 Feb 2023 07:30:57 +0000 (08:30 +0100)]
[mlir][Bazel] Add missing dependencies for 72429a42ac33564fa82449d99dc234da32a05498

17 months ago[mlir] Add RewriterBase::replaceAllUsesWith for Blocks.
Ingo Müller [Tue, 24 Jan 2023 15:42:38 +0000 (15:42 +0000)]
[mlir] Add RewriterBase::replaceAllUsesWith for Blocks.

When changing IR in a RewriterPattern, all changes must go through the
rewriter. There are several convenience functions in RewriterBase that
help with high-level modifications, such as replaceAllUsesWith for
Values, but there is currently none to do the same task for Blocks.

Reviewed By: mehdi_amini, ingomueller-net

Differential Revision: https://reviews.llvm.org/D142525

17 months agoAdd a pass that builds a debug info scope for LLVMFuncOp (adding a DISubprogramAttr)
Mehdi Amini [Wed, 15 Feb 2023 05:15:30 +0000 (21:15 -0800)]
Add a pass that builds a debug info scope for LLVMFuncOp (adding a DISubprogramAttr)

This may be seen as a hack, but it allows for any piece of MLIR to be able
to end up with DWARF debug info through LLVM.
Assuming the operations in the function have location such as FileLineCol,
this provides backtraces with line tables and allows to step in a debugger.
That makes this pass a perfect companion to -snapshot-op-locations

It was also the default behavior of MLIR to LLVM IR translation until MLIR
got support for proper debug info attributes.

Differential Revision: https://reviews.llvm.org/D144069

17 months ago[mlir][Bazel] Add dependency needed for e9b82a5c
Adrian Kuegel [Wed, 15 Feb 2023 06:36:00 +0000 (07:36 +0100)]
[mlir][Bazel] Add dependency needed for e9b82a5c

17 months ago[mlir][Vector] Enable masking for static shapes
Diego Caballero [Wed, 15 Feb 2023 06:01:42 +0000 (06:01 +0000)]
[mlir][Vector] Enable masking for static shapes

Support for masking static shapes was already implemented in the past
but not enabled so this patch is just removing a pre-condition check and
adding some tests with static shapes.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D143937

17 months ago[mlir][Vector] Add support for masked vector gather ops
Diego Caballero [Wed, 15 Feb 2023 06:00:12 +0000 (06:00 +0000)]
[mlir][Vector] Add support for masked vector gather ops

This patch adds support for masked vector.gather ops using the
vector.mask representation. It includes the implementation of the
MaskableOpInterface, Linalg vectorizer support and lowering to LLVM.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D143939

17 months ago[mlir][Vector] Add support for masked vector.contract
Diego Caballero [Wed, 15 Feb 2023 05:46:15 +0000 (05:46 +0000)]
[mlir][Vector] Add support for masked vector.contract

This patch adds support for masking vector.contract ops with the
vector.mask approach. This also includes the lowering of vector.contract
through the vector.outerproduct path to LLVM. For now, this only adds
support for one of the many potential flavors of
vector.contract/vector.outerproduct but unsupported cases will fail
gratefully.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D143965

17 months ago[mlir][Vector] Add LLVM lowering for masked reductions
Diego Caballero [Mon, 13 Feb 2023 19:31:23 +0000 (19:31 +0000)]
[mlir][Vector] Add LLVM lowering for masked reductions

This patch adds the conversion patterns to lower masked reduction
operations to the corresponding vp intrinsics in LLVM.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D142177

17 months ago[LoopVersioningLICM] Remove legacy pass
Fangrui Song [Wed, 15 Feb 2023 05:40:45 +0000 (21:40 -0800)]
[LoopVersioningLICM] Remove legacy pass

Following recent changes to remove non-core features of the legacy PM/optimization pipeline.

17 months ago[mlir] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Wed, 15 Feb 2023 04:44:15 +0000 (20:44 -0800)]
[mlir] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

17 months ago[mlir] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Wed, 15 Feb 2023 04:33:36 +0000 (20:33 -0800)]
[mlir] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

17 months ago[llvm] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Wed, 15 Feb 2023 04:27:41 +0000 (20:27 -0800)]
[llvm] Use std::optional instead of llvm::Optional (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

17 months ago[mlir] Fix -Wsign-compare in SparseTensorRewriting.cpp and Sparsification.cpp (NFC)
Jie Fu [Wed, 15 Feb 2023 03:56:40 +0000 (11:56 +0800)]
[mlir] Fix -Wsign-compare in SparseTensorRewriting.cpp and Sparsification.cpp (NFC)

/home/jiefu/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/Sparsification.cpp:279:33: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'const mlir::sparse_tensor::Level' (aka 'const unsigned long') [-Werror,-Wsign-compare]
    assert(env.op().getRank(&t) == lvlRank);
           ~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^~~~
1 error generated.

/home/jiefu/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp:788:29: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'const mlir::sparse_tensor::Dimension' (aka 'const unsigned long') [-Werror,-Wsign-compare]
    assert(srcRTT.getRank() == dimRank);
           ~~~~~~~~~~~~~~~~ ^  ~~~~~~~
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^~~~
/home/jiefu/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorRewriting.cpp:810:31: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'const mlir::sparse_tensor::Dimension' (aka 'const unsigned long') [-Werror,-Wsign-compare]
      assert(srcRTT.getRank() == dimRank);
             ~~~~~~~~~~~~~~~~ ^  ~~~~~~~
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^~~~
2 errors generated.

17 months ago[gn build] Port f1c4241fb6e5
LLVM GN Syncbot [Wed, 15 Feb 2023 03:51:14 +0000 (03:51 +0000)]
[gn build] Port f1c4241fb6e5

17 months ago[RISCV] Add new pass to transform undef to pseudo for vector values.
Piyou Chen [Wed, 15 Feb 2023 03:42:26 +0000 (19:42 -0800)]
[RISCV] Add new pass to transform undef to pseudo for vector values.

RISC-V vector instruction has register overlapping constraint for certain
instructions, and will cause illegal instruction trap if violated, we use
early clobber to model this constraint, but it can't prevent register allocator
allocated same or overlapped if the input register is undef value, so convert
IMPLICIT_DEF to temporary pseudo could prevent that happen, it's not best way
to resolve this. Ideally we should model the constraint right, but before we
model the constraint right, it's the approach to prevent that happen.

See also: https://github.com/llvm/llvm-project/issues/50157

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D129735

17 months ago[RISCV] precommit test for D129735
Piyou Chen [Wed, 15 Feb 2023 03:29:59 +0000 (19:29 -0800)]
[RISCV] precommit test for D129735

Reviewed By: kito-cheng

Differential Revision: https://reviews.llvm.org/D137763

17 months ago[NFC] Refactor ModuleDeclStateTest to make it not dependent on Frontend
Chuanqi Xu [Wed, 15 Feb 2023 03:29:29 +0000 (11:29 +0800)]
[NFC] Refactor ModuleDeclStateTest to make it not dependent on Frontend

Required in https://reviews.llvm.org/D137526. And it is indeed odd that
LexTest depends on ClangFrontend.

17 months ago[ORC] Add ELFNixPlatform::Create overload -- Pass ORC runtime as def generator.
Lang Hames [Wed, 15 Feb 2023 03:13:41 +0000 (19:13 -0800)]
[ORC] Add ELFNixPlatform::Create overload -- Pass ORC runtime as def generator.

The existing Create method took a path to the ORC runtime and created a
StaticLibraryDefinitionGenerator for it. The new overload takes a
std::unique_ptr<DefinitionGenerator> directly instead. This provides more
flexibility when constructing MachOPlatforms. E.g. The runtime archive can be
embedded in a special section in the ORC controller executable or library,
rather than being on-disk.

This is the ELFNixPlatform equivalent of the MachOPlatform change in
be2fc577c38.

17 months ago[mlir][sparse] Factoring out SparseTensorType class
wren romano [Wed, 15 Feb 2023 02:20:45 +0000 (18:20 -0800)]
[mlir][sparse] Factoring out SparseTensorType class

This change adds a new `SparseTensorType` class for making the "dim" vs "lvl" distinction more overt, and for abstracting over the differences between sparse-tensors and dense-tensors.  In addition, this change also adds new type aliases `Dimension`, `Level`, and `FieldIndex` to make code more self-documenting.

Although the diff is very large, the majority of the changes are mechanical in nature (e.g., changing types to use the new aliases, updating variable names to match, etc).  Along the way I also made many variables `const` when they could be; the majority of which required only adding the keyword.  A few places had conditional definitions of these variables, requiring actual code changes; however, that was only done when the overall change was extremely local and easy to extract.  All these changes are included in the current patch only because it would be too onerous to split them off into a separate patch.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D143800

17 months ago[C++20] [Modules] [ClangScanDeps] Ensure that we can mix the use of and clang modules
Chuanqi Xu [Wed, 15 Feb 2023 02:59:07 +0000 (10:59 +0800)]
[C++20] [Modules] [ClangScanDeps] Ensure that we can mix the use of and clang modules

Add a test to ensure that the clang-scan-deps won't crash due to the
unexpected use of clang modules.

17 months ago[clang-format][NFC] Reformat clang/tools/clang-format/fuzzer/
Owen Pan [Wed, 15 Feb 2023 02:54:36 +0000 (18:54 -0800)]
[clang-format][NFC] Reformat clang/tools/clang-format/fuzzer/

17 months ago[mlir][sparse] fix a bug in UnpackOp converter.
Peiming Liu [Wed, 15 Feb 2023 02:18:54 +0000 (02:18 +0000)]
[mlir][sparse] fix a bug in UnpackOp converter.

UnpackOp Converter used to create reallocOp unconditionally, but it might cause issue when the requested memory size is smaller than the actually storage.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D144065

17 months ago[InstCombine] fold icmp of the sum of ext bool based on limited range
chenglin.bi [Wed, 15 Feb 2023 02:33:54 +0000 (10:33 +0800)]
[InstCombine] fold icmp of the sum of ext bool based on limited range

For the pattern `(zext i1 X) + (sext i1 Y)`, the constant range is [-1, 1].
We can simplify the pattern by logical operations. Like:

```
    (zext i1 X) + (sext i1 Y) == -1 -->  ~X & Y
    (zext i1 X) + (sext i1 Y) == 0  --> ~(X ^ Y)
    (zext i1 X) + (sext i1 Y) == 1 --> X & ~Y
```
And other predicates can the combination of these results:

```
    (zext i1 X) + (sext i1 Y)) != -1 --> X | ~Y
    (zext i1 X) + (sext i1 Y)) s> -1 --> X | ~Y
    (zext i1 X) + (sext i1 Y)) u< -1 --> X | ~Y
    (zext i1 X) + (sext i1 Y)) s> 0 --> X & ~Y
    (zext i1 X) + (sext i1 Y)) s< 0 --> ~X & Y
    (zext i1 X) + (sext i1 Y)) != 1 --> ~X | Y
    (zext i1 X) + (sext i1 Y)) s< 1 --> ~X | Y
    (zext i1 X) + (sext i1 Y)) u> 1 --> ~X & Y
```

All alive proofs:
https://alive2.llvm.org/ce/z/KmgDpF
https://alive2.llvm.org/ce/z/fLwWa9
https://alive2.llvm.org/ce/z/ZKQn2P

Fix: https://github.com/llvm/llvm-project/issues/59666

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D143373

17 months ago[SeparateConstOffsetFromGEP] Fix: `b - a` matched `a - b` during reuniteExts
Liren Peng [Wed, 15 Feb 2023 02:18:41 +0000 (02:18 +0000)]
[SeparateConstOffsetFromGEP] Fix: `b - a` matched `a - b` during reuniteExts

During the SeparateConstOffsetFromGEP pass, a - b and b - a will be
considered equivalent in some instances.

An example- the IR contains:

  BB1:
      %add = add %a, 511
      br label %BB2
  BB2:
      %sub2 = sub %b,  %a
      br label %BB3
  BB3:
      %sub1 = sub %add, %b
      %gep = getelementptr float, ptr %p, %sub1

Step 1 in the SeparateConstOffsetFromGEP pass, after split constant index:

  BB1:
      %add = add %a, 511
      br label %BB2
  BB2:
      %sub2 = sub %b,  %a
      br label %BB3
  BB3:
      %sub.t = sub %a, %b
      %gep.base = getelementptr float, ptr %p, %sub.t
      %gep = getelementptr float, ptr %gep.base, 511

Step 2, after reuniteExts:

  BB1:
      br label %BB2
  BB2:
      %sub2 = sub %b,  %a
      br label %BB3
  BB3:
      %gep.base = getelementptr float, ptr %p, %sub2
      %gep = getelementptr float, ptr %gep.base, 511

Obviously, reuniteExts treated a - b and b - a as equivalent.
This patch fixes that.

Reviewed By: nikic, spatel

Differential Revision: https://reviews.llvm.org/D143542

17 months ago[Instcombine] Precommit tests for icmp range; NFC
chenglin.bi [Wed, 15 Feb 2023 02:31:27 +0000 (10:31 +0800)]
[Instcombine] Precommit tests for icmp range; NFC

17 months ago[NFC][SeparateConstOffsetFromGEP] Added flag `lower-gep`
Liren Peng [Wed, 15 Feb 2023 01:22:31 +0000 (01:22 +0000)]
[NFC][SeparateConstOffsetFromGEP] Added flag `lower-gep`

We need such a flag to check whether the transformation is correct if
LowerGEP was enabled.

Reviewed By: nikic, arsenm, spatel

Differential Revision: https://reviews.llvm.org/D143980

17 months ago[bazel] Port 26662ac010ef50e65e2774eab84f325aa09360fe
Fangrui Song [Wed, 15 Feb 2023 01:42:48 +0000 (17:42 -0800)]
[bazel] Port 26662ac010ef50e65e2774eab84f325aa09360fe

17 months ago[Clang][RISCV] Guard vector int64, float32, float64 with semantic analysis
eopXD [Thu, 9 Feb 2023 18:14:59 +0000 (10:14 -0800)]
[Clang][RISCV] Guard vector int64, float32, float64 with semantic analysis

Depends on D143657

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D143665

17 months ago[mlir] Fix two build warnings in VectorToGPU (NFC)
Jie Fu [Wed, 15 Feb 2023 01:31:16 +0000 (09:31 +0800)]
[mlir] Fix two build warnings in VectorToGPU (NFC)

In file included from /data/llvm-project/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp:13:
/data/llvm-project/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h:15:1: error: class 'LogicalResult' was previously declared as a struct; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Werror,-Wmismatched-tags]
class LogicalResult;
^
/data/llvm-project/mlir/include/mlir/Support/LogicalResult.h:26:22: note: previous use is here
struct [[nodiscard]] LogicalResult {
                     ^
/data/llvm-project/mlir/include/mlir/Conversion/VectorToGPU/VectorToGPU.h:15:1: note: did you mean struct here?
class LogicalResult;
^~~~~
struct

/data/llvm-project/mlir/lib/Conversion/VectorToGPU/VectorToGPU.cpp:724:5: error: ignoring return value of function declared with 'nodiscard' attribute [-Werror,-Wunused-result]
    rewriter.notifyMatchFailure(
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

17 months ago[gn build] Add missing count dependency for check-asan
Arthur Eubanks [Wed, 15 Feb 2023 01:33:15 +0000 (17:33 -0800)]
[gn build] Add missing count dependency for check-asan

17 months ago[scudo] Update ring buffer test to make it accept zero size
Chia-hung Duan [Wed, 15 Feb 2023 01:23:13 +0000 (01:23 +0000)]
[scudo] Update ring buffer test to make it accept zero size

allocation ring buffer is allowed to be zero. Update the logic in the
test so that on the platform that disables it won't fail this case.

Reviewed By: fmayer

Differential Revision: https://reviews.llvm.org/D144055

17 months ago[LoopUnrollAndJam] Remove legacy pass
Fangrui Song [Wed, 15 Feb 2023 01:23:15 +0000 (17:23 -0800)]
[LoopUnrollAndJam] Remove legacy pass

Following recent changes to remove non-core features of the legacy PM/optimization pipeline.

17 months ago[scudo] Add the thread-safety annotations
Chia-hung Duan [Fri, 10 Feb 2023 21:54:03 +0000 (21:54 +0000)]
[scudo] Add the thread-safety annotations

This CL adds the proper thread-safety annotations for most of the
functions and variables. However, given the restriction of the current
architecture, in some cases, we may not be able to use the annotations
easily. The followings are two exceptions,

1. enable()/disable(): Many structures in scudo are enabled/disabled by
   acquiring the lock in each instance. This makes those structure act
   like a `lock`. We can't mark those functions with ACQUIRE()/RELEASE()
   because that makes the entire allocator become another `lock`. In the
   end, that implies we need to *acquire* the `allocator` before each
   malloc et al. request. Therefore, adding a variable to tell the
   status of those structures may be a better way to cooperate with
   thread-safety annotation.

2. TSD/TSD shared/TSD exclusive: These three have simiar restrictions as
   mentioned above. In addition, they don't always need to be released
   if it's a thread local instance. However, thread-safety analysis
   doesn't support conditional branch. Which means we can't mark the
   proper annotations around the uses of TSDs. We may consider to make
   it consistent and which makes the code structure simpler.

This CL is supposed to introduce the annotations with the least code
refactoring. So only trivial thread safety issues will be addressed
here. For example, lacking of acquiring certain lock before accessing
certain variables will have the ScopedLock inserted. Other than that,
they are supposed to be done in the later changes.

Reviewed By: cferris

Differential Revision: https://reviews.llvm.org/D140706

17 months ago[LoongArch] Make use of addu16i.d for adds with suitable immediates
WANG Xuerui [Tue, 14 Feb 2023 00:39:19 +0000 (08:39 +0800)]
[LoongArch] Make use of addu16i.d for adds with suitable immediates

Ideally `addu16i.d` could be paired with `{ld,st}ptr` for faster memory
accesses with 32-bit-aligned offsets (it was designed for this purpose),
but it would require more work and the original use case (GP-relative
accesses) does not exist any more with the current LoongArch psABI.

It could still be used for accelerating additions of certain constants
though, which is what this patch intends to do.

Reviewed By: SixWeining, gonglingqin

Differential Revision: https://reviews.llvm.org/D143710

17 months ago[LoongArch] Add baseline tests for `addu16i.d` codegen. NFC
WANG Xuerui [Tue, 14 Feb 2023 00:39:12 +0000 (08:39 +0800)]
[LoongArch] Add baseline tests for `addu16i.d` codegen. NFC

Reviewed By: gonglingqin

Differential Revision: https://reviews.llvm.org/D143846

17 months ago[Clang][Test] Add llvm-lto, llvm-lto2 and llvm-profdata to the tool substitutions...
Weining Lu [Tue, 14 Feb 2023 00:36:43 +0000 (08:36 +0800)]
[Clang][Test] Add llvm-lto, llvm-lto2 and llvm-profdata to the tool substitutions list

Similar to issue fixed in D107155, some lit tests invoke `llvm-lto`,
`llvm-lto2` and `llvm-profdata` without going through the substitution
system. While the test runner correctly picks up these binaries from
the build directory, it doesn't print its absolute path. When copying
the invocations when reproducing test failures, this can result in
`command not found: llvm-lto` or other errors (caused by using wrong
version of the tool).

This patch adds these tools to the `tools` variable in
`clang/test/lit.cfg.py` which will then call add_tool_substitutions.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D143806

17 months agoRemove trailing whitespace in `X86InstrAVX512.td`; NFC
Noah Goldstein [Wed, 15 Feb 2023 01:12:54 +0000 (19:12 -0600)]
Remove trailing whitespace in `X86InstrAVX512.td`; NFC

Summary:

Reviewers:

Subscribers:

17 months agoRemove incorrect comment around `truncateAVX512SetCCNoBWI`; NFC
Noah Goldstein [Wed, 15 Feb 2023 01:12:27 +0000 (19:12 -0600)]
Remove incorrect comment around `truncateAVX512SetCCNoBWI`; NFC

Differential Revision: https://reviews.llvm.org/D144060

17 months agoAdd transform (and/or (icmp eq/ne (A, C)), (icmp eq/ne (A, -C))) -> (icmp eq/ne ...
Noah Goldstein [Tue, 14 Feb 2023 01:39:42 +0000 (19:39 -0600)]
Add transform (and/or (icmp eq/ne (A, C)), (icmp eq/ne (A, -C))) -> (icmp eq/ne (ABS A), ABS(C))

This can be beneficial if there is a fast `ABS` (For example with X86
`vpabs`) or if there is a dominating ABS(A) in the `DAG`.

Note `C` is constant so `ABS(C)` is just a constant.

Alive2 Links:
EQ: https://alive2.llvm.org/ce/z/829F-c
NE: https://alive2.llvm.org/ce/z/tsS8bU

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D142601

17 months agoTests for (and/or (icmp eq/ne A, C), (icmp eq/ne A, -C)) <--> (icmp eq/ne (ABS A...
Noah Goldstein [Tue, 14 Feb 2023 01:40:02 +0000 (19:40 -0600)]
Tests for (and/or (icmp eq/ne A, C), (icmp eq/ne A, -C)) <--> (icmp eq/ne (ABS A), ABS(C)); NFC

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D142600

17 months agoTransform `(icmp eq/ne Abs(A), Pow2)` -> `(and/or (icmp eq/ne A,Pow2), (icmp eq/ne...
Noah Goldstein [Tue, 14 Feb 2023 01:40:18 +0000 (19:40 -0600)]
Transform `(icmp eq/ne Abs(A), Pow2)` -> `(and/or (icmp eq/ne A,Pow2), (icmp eq/ne A,-Pow2))`

Only if Abs(A) has one use, in which case the `(and/or (icmp eq/ne
A,Pow2), (icmp eq/ne A,-Pow2))` can be optimized in
`DAGCombiner::foldAndOrOfSETCC`.

Alive Links:
EQ: https://alive2.llvm.org/ce/z/gTxSgV
NE: https://alive2.llvm.org/ce/z/MUf57Y

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D142345

17 months agoAdd Transform for `(and/or (eq/ne A,Pow2),(eq/ne A,-Pow2))`->`(eq/ne (and (and A...
Noah Goldstein [Tue, 14 Feb 2023 01:40:35 +0000 (19:40 -0600)]
Add Transform for `(and/or (eq/ne A,Pow2),(eq/ne A,-Pow2))`->`(eq/ne (and (and A,Pow2),~(Pow2*2)), 0)`

In many instances this can be preferable if the `icmp` -> `i1` cannot be
done in one instruction (such as X86 for scalars).

At the moment guarded behind `TLI.isDesirableToCombineLogicOpOfSETCC`.

alive2 links:
https://alive2.llvm.org/ce/z/nLm5sN
https://alive2.llvm.org/ce/z/moEcyE

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D142344

17 months agoAdd tests for folding `(and/or (icmp eq/ne A, Pow2), (icmp eq/ne A, -Pow2))`; NFC
Noah Goldstein [Tue, 14 Feb 2023 01:40:50 +0000 (19:40 -0600)]
Add tests for folding `(and/or (icmp eq/ne A, Pow2), (icmp eq/ne A, -Pow2))`; NFC

Differential Revision: https://reviews.llvm.org/D142343

17 months agoTransform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT if possible
Noah Goldstein [Tue, 14 Feb 2023 01:39:05 +0000 (19:39 -0600)]
Transform vector SET{LE/ULT/ULE} -> SETLT and SET{GE/UGT/UGE} -> SETGT if possible

SETLT and SETGT can use `{v}pcmpgt` directly whereas the other SETCC
variants require some other instructions as well. On AVX512, which has
vector comparisons for all SETCC variants, this can still be
preferable if the destination is a vector. And if the destination is a
mask, its the same performance.

The transform for unsigned SETCC takes place if we know from
`KnownBits` that LHS/RHS have the same sign.

The transform for LE/GE -> LT/GT takes place if LHS/RHS is constant
and we can inc/dec all elements in the operand without overflowing
(both signed and unsigned).

Alive2 Links (on i8 so they don't timeout):
sge_s:   https://alive2.llvm.org/ce/z/rMPt9_
sge_s_2: https://alive2.llvm.org/ce/z/G74Mhs
sge_u:   https://alive2.llvm.org/ce/z/PTWARM
sge_u_2: https://alive2.llvm.org/ce/z/L9dsNn
sgt_s:   https://alive2.llvm.org/ce/z/q2CHEK
sgt_u:   https://alive2.llvm.org/ce/z/YPLnZ8
sle_s:   https://alive2.llvm.org/ce/z/HyYhQ_
sle_s_2: https://alive2.llvm.org/ce/z/ck6NkT
sle_u:   https://alive2.llvm.org/ce/z/tyF_wN
sle_u_2: https://alive2.llvm.org/ce/z/et8t98
slt_s:   https://alive2.llvm.org/ce/z/oCP43b
slt_u:   https://alive2.llvm.org/ce/z/EpLLPx
uge_s:   https://alive2.llvm.org/ce/z/rqSDwi
uge_s_2: https://alive2.llvm.org/ce/z/67UTXu
uge_u:   https://alive2.llvm.org/ce/z/yBNG9C
uge_u_2: https://alive2.llvm.org/ce/z/UhHYc_
ugt_s:   https://alive2.llvm.org/ce/z/tY9va4
ugt_u:   https://alive2.llvm.org/ce/z/F9zeAT
ule_s:   https://alive2.llvm.org/ce/z/1MNgka
ule_s_2: https://alive2.llvm.org/ce/z/oiS7Ls
ule_u:   https://alive2.llvm.org/ce/z/8DveC3
ule_u_2: https://alive2.llvm.org/ce/z/jGp2M7
ult_s:   https://alive2.llvm.org/ce/z/chzfwP
ult_u:   https://alive2.llvm.org/ce/z/Jj_JYu

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D142254

17 months ago[mlir][Vector] NFC - Fail gracefully on size mismatch instead of assert
Nicolas Vasilache [Wed, 15 Feb 2023 00:04:05 +0000 (16:04 -0800)]
[mlir][Vector] NFC - Fail gracefully on size mismatch instead of assert

17 months ago[mlir][Vector] Significantly improve VectorToGPU.cpp
Nicolas Vasilache [Fri, 10 Feb 2023 15:22:30 +0000 (07:22 -0800)]
[mlir][Vector] Significantly improve VectorToGPU.cpp

This revision performs a bunch of cleanups and tracks free-flowing IR mutations.
APIs are systematized around RewriterBase and relevant debug messages are added.
Deliberate use of OpBuilder::InsertionGuard is added where needed.

Differential Revision: https://reviews.llvm.org/D143738

17 months ago[Support/BLAKE3] Rename blake3_* -> llvm_blake3_* to avoid symbol collisions
Jeremy Maitin-Shepard [Wed, 15 Feb 2023 00:21:42 +0000 (16:21 -0800)]
[Support/BLAKE3] Rename blake3_* -> llvm_blake3_* to avoid symbol collisions

While some blake3 symbols are already prefixed, a number of symbols with hidden visibility have been left without an `llvm_` prefix.  This results in symbol collisions when statically linking llvm into a binary that also uses the external blake3 library.

Reviewed By: akyrtzi, MaskRay

Differential Revision: https://reviews.llvm.org/D143981

17 months ago[LoopVersioning] Remove legacy pass
Fangrui Song [Wed, 15 Feb 2023 00:12:00 +0000 (16:12 -0800)]
[LoopVersioning] Remove legacy pass

Following recent changes to remove non-core features of the legacy PM/optimization pipeline.

17 months ago[InstSimplify] fix/improve folding with an SNaN vector element operand
Sanjay Patel [Wed, 15 Feb 2023 00:09:51 +0000 (19:09 -0500)]
[InstSimplify] fix/improve folding with an SNaN vector element operand

Follow-up to the equivalent change for scalars:
D143505 / 83ba349ae0a8

17 months ago[InstSimplify] add tests for vectors with SNaN constants; NFC
Sanjay Patel [Tue, 14 Feb 2023 23:07:34 +0000 (18:07 -0500)]
[InstSimplify] add tests for vectors with SNaN constants; NFC

Coverage for extension of functionality from D143505.

17 months ago[LoopLoadElimination] Remove legacy pass
Fangrui Song [Wed, 15 Feb 2023 00:00:49 +0000 (16:00 -0800)]
[LoopLoadElimination] Remove legacy pass

Following recent changes to remove non-core features of the legacy PM/optimization pipeline.

17 months ago[Driver] Allow test to use lld-link.exe not just lld-link
Alex Brachet [Tue, 14 Feb 2023 23:54:25 +0000 (23:54 +0000)]
[Driver] Allow test to use lld-link.exe not just lld-link

17 months ago[LoopDistribute] Remove legacy pass
Fangrui Song [Tue, 14 Feb 2023 23:51:09 +0000 (15:51 -0800)]
[LoopDistribute] Remove legacy pass

Following recent changes to remove non-core features of the legacy PM/optimization pipeline.

17 months agoRecommit: [NFC][IR] Make Module::getGlobalList() private
Vasileios Porpodas [Tue, 14 Feb 2023 22:33:20 +0000 (14:33 -0800)]
Recommit: [NFC][IR] Make Module::getGlobalList() private

This reverts commit cb5f239363a3c94db5425c105fcd45e77d2a16a9.

17 months ago[libc++] `<algorithm>`: `ranges::minmax` should dereference iterators only once
Igor Zhukov [Tue, 14 Feb 2023 23:00:43 +0000 (06:00 +0700)]
[libc++] `<algorithm>`: `ranges::minmax` should dereference iterators only once

Reviewed By: philnik, #libc

Differential Revision: https://reviews.llvm.org/D142864

17 months ago[InstSimplify] fix/improve folding with an SNaN operand
Sanjay Patel [Tue, 14 Feb 2023 22:49:40 +0000 (17:49 -0500)]
[InstSimplify] fix/improve folding with an SNaN operand

There are 2 issues here:

1. In the default LLVM FP environment (regular FP math instructions),
   SNaN is some flavor of "don't care" which we will nail down in
   D143074, so this is just a quality-of-implementation improvement
   for default FP.
2. In the constrained FP environment (constrained intrinsics), SNaN
   must not propagate through a math operation; it has to be quieted
   according to IEEE-754 spec. That is independent of exception
   handling mode, so the current behavior is a miscompile.

Differential Revision: https://reviews.llvm.org/D143505

17 months ago[InstCombine] add test for loop-invariant fdiv; NFC
Sanjay Patel [Tue, 14 Feb 2023 19:15:15 +0000 (14:15 -0500)]
[InstCombine] add test for loop-invariant fdiv; NFC

Adding baseline test based on D87479, so we know
current state and limitations of a potential fix.

17 months ago[mlir][spirv] Validate float type bitwidths
Jakub Kuderski [Tue, 14 Feb 2023 22:48:43 +0000 (17:48 -0500)]
[mlir][spirv] Validate float type bitwidths

Not all float types are supported in SPIR-V.

Fixes: https://github.com/llvm/llvm-project/issues/60199

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D144043

17 months ago[openmp] Fix building for mingw targets after import library changes
Martin Storsjö [Tue, 14 Feb 2023 09:37:10 +0000 (11:37 +0200)]
[openmp] Fix building for mingw targets after import library changes

06d9bf5e64d472db5485815d9c3f70631064bb25 (https://reviews.llvm.org/D143431)
did a large restructuring of how the import library is created;
previously, a second step to tweak the import library was only
done for MSVC style targets, but after this commit, that logic
was applied for mingw targets too.

Since LIBOMP_GENERATED_IMP_LIB_FILENAME and LIBOMP_IMP_LIB_FILE
are equal on mingw targets (both are "libomp.dll.a", while they
are "libomp.dll.lib" and "libomp.lib" for MSVC targets), this caused
a conflict, with errors like this:

  ninja: error: build.ninja:875: multiple rules generate runtime/src/libomp.dll.a [-w dupbuild=err]

Skip the logic with a second step to recreate the import library
for mingw targets. The MSVC specific logic for this relies on
running the static archiver with CMAKE_LINK_DEF_FILE_FLAG, which
with MS lib.exe (and llvm-lib) ignore the input object files and
just generates an import library - but mingw style tools don't
support this mode of operation. (By attemptinig the same, mingw tools
would generate a static library with the def file as one member.)
With mingw tools, the same can be achieved by invoking the dlltool
executable instead.

Instead of adding alternative logic for invoking dlltool, just skip
the second import library step, since neither GNU nor LLVM mingw
tools actually generate import libraries that link by ordinal - so
there's no need for a second import library.

Differential Revision: https://reviews.llvm.org/D143992

17 months agoRevert "[NFC][IR] Make Module::getGlobalList() private"
Vasileios Porpodas [Tue, 14 Feb 2023 22:28:02 +0000 (14:28 -0800)]
Revert "[NFC][IR] Make Module::getGlobalList() private"

This reverts commit ed3e3ee9e30dfbffd2170a770a49b36a7f444916.

17 months ago[runtimes] Remove duplicate imports of libcxx.test.config
Louis Dionne [Tue, 14 Feb 2023 22:27:56 +0000 (17:27 -0500)]
[runtimes] Remove duplicate imports of libcxx.test.config

17 months ago[clang-format] Don't rewrite the input file if already formatted
Owen Pan [Sat, 11 Feb 2023 23:20:38 +0000 (15:20 -0800)]
[clang-format] Don't rewrite the input file if already formatted

If IntegerLiteralSeparator is set but the integer literals are
already formatted, don't rewrite the input file.

Fixes #60651.

Differential Revision: https://reviews.llvm.org/D143831

17 months ago[NFC][IR] Make Module::getGlobalList() private
Vasileios Porpodas [Wed, 8 Feb 2023 18:13:01 +0000 (10:13 -0800)]
[NFC][IR] Make Module::getGlobalList() private

This patch adds several missing GlobalList modifier functions, like
removeGlobalVariable(), eraseGlobalVariable() and insertGlobalVariable().
There is no longer need to access the list directly so it also makes
getGlobalList() private.

Differential Revision: https://reviews.llvm.org/D144027

17 months ago[runtimes] Rename newconfig.py to config.py -- it's not new anymore
Louis Dionne [Tue, 14 Feb 2023 18:01:18 +0000 (13:01 -0500)]
[runtimes] Rename newconfig.py to config.py -- it's not new anymore

Differential Revision: https://reviews.llvm.org/D144031

17 months ago[lldb] Disable macro redefinition warnings in expression wrapper
Raphael Isemann [Tue, 14 Feb 2023 21:55:46 +0000 (22:55 +0100)]
[lldb] Disable macro redefinition warnings in expression wrapper

GCC emits macro definitions into debug info when compiling with `-g3`. LLDB is
translating this information into `#define` directives which are injected into
the source code of user expressions. While this mechanism itself works fine,
it can lead to spurious "... macro redefined" warnings when the defined macro
is also a builtin Clang macro:

```
warning: <lldb wrapper prefix>:46:9: '__VERSION__' macro redefined
        ^
<built-in>:19:9: previous definition is here
[repeated about a 100 more times for every builtin macro]
```

This patch just disables the diagnostic when parsing LLDB's generated list of
macros definitions.

Reviewed By: Michael137

Differential Revision: https://reviews.llvm.org/D139740

17 months ago[InstCombine] Increase limit for max copied from constant fold
Brendon Cahoon [Tue, 14 Feb 2023 18:04:43 +0000 (12:04 -0600)]
[InstCombine] Increase limit for max copied from constant fold

Increasing the limits fixes several performance regressions.

Differential revision: https://reviews.llvm.org/D144032

17 months ago[OpenMP] Recover non-blocking target nowait disabled by D141232
Ye Luo [Tue, 14 Feb 2023 19:38:24 +0000 (13:38 -0600)]
[OpenMP] Recover non-blocking target nowait disabled by D141232

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D143871

17 months agoReport a useful error when someone passes an incorrect python class name.
Jim Ingham [Tue, 14 Feb 2023 21:09:16 +0000 (13:09 -0800)]
Report a useful error when someone passes an incorrect python class name.

17 months agoRevert "llvm-reduce: Run instruction reduction last"
Florian Mayer [Tue, 14 Feb 2023 21:45:39 +0000 (13:45 -0800)]
Revert "llvm-reduce: Run instruction reduction last"

This reverts commit 463ab1e07a0a15a9aa129639048e29e0f8ec4dc8.

17 months ago[llvm][test] convert one test to use opaque ptrs (NFC)
Nick Desaulniers [Tue, 14 Feb 2023 21:31:11 +0000 (13:31 -0800)]
[llvm][test] convert one test to use opaque ptrs (NFC)

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D143682

17 months ago[Fuchsia] Set /winsysroot in Windows runtimes linker flags
Haowei Wu [Mon, 13 Feb 2023 23:35:02 +0000 (15:35 -0800)]
[Fuchsia] Set /winsysroot in Windows runtimes linker flags

This patch sets '/winsysroot' flag when building Windows runtimes so we
don't have to explicitly set Windows library search paths.

Differential Revision: https://reviews.llvm.org/D143960

17 months ago[llvm][test] restrict 2 GVN tests to just test GVN (NFC)
Nick Desaulniers [Tue, 14 Feb 2023 21:27:24 +0000 (13:27 -0800)]
[llvm][test] restrict 2 GVN tests to just test GVN (NFC)

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D143681

17 months ago[libc++][NFC] update Range Status for the completion of C++20 ranges
Hui [Tue, 24 Jan 2023 19:06:07 +0000 (19:06 +0000)]
[libc++][NFC] update Range Status for the completion of C++20 ranges

Differential Revision: https://reviews.llvm.org/D142494

17 months ago[IPSCCP] Remove legacy pass
Arthur Eubanks [Tue, 14 Feb 2023 21:20:37 +0000 (13:20 -0800)]
[IPSCCP] Remove legacy pass

This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.

17 months ago[NFC] Replace -1U{LL} expressions with appropriate *_MAX macros in Support library.
Pavel Kopyl [Fri, 10 Feb 2023 22:36:24 +0000 (23:36 +0100)]
[NFC] Replace -1U{LL} expressions with appropriate *_MAX macros in Support library.

This makes a code a bit more clear and also gets rid of C4146 warning
on MSVC compiler:
 'unary minus operator applied to unsigned type, result still unsigned'.

In case uint64_t variable is initialized or compared against -1U expression,
which corresponds to 32-bit constant, UINT_MAX macro is used to preserve
NFC semantics; -1ULL is replaced with UINT64_MAX.

Reviewed By: dblaikie, craig.topper

Differential Revision: https://reviews.llvm.org/D143942

17 months ago[mlir][spirv] Fix crash when decorating physical storage buffer pointers
Jakub Kuderski [Tue, 14 Feb 2023 21:11:34 +0000 (16:11 -0500)]
[mlir][spirv] Fix crash when decorating physical storage buffer pointers

Add a comment explaining `PhysicalStorageBufferAddresses` are not
supported yet.

Fixes: https://github.com/llvm/llvm-project/issues/60196

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D144039

17 months agoReland "[compiler-rt][hwasan] Add unused attribute to GetRegisters"
Leonard Chan [Tue, 14 Feb 2023 19:59:15 +0000 (19:59 +0000)]
Reland "[compiler-rt][hwasan] Add unused attribute to GetRegisters"

This was reverted bc of breakage on Fuchsia, but we landed a local fix
for this.

17 months ago[clang][test][RISCV] Introduce separate RUN lines for __risv_i test in riscv-target...
Alex Bradbury [Tue, 14 Feb 2023 21:03:50 +0000 (21:03 +0000)]
[clang][test][RISCV] Introduce separate RUN lines for __risv_i test in riscv-target-features.c

Craig Topper pointed out in post-commit review of d05e1e99b1d that the
series of CHECK-NOT lines followed by CHECK would not work as intended
if __riscv_i came first in the input and was followed by the disallowed
lines.

The simplest solution is to just introduced separate RUN lines for the
__riscv_i check.

17 months ago[GlobalOpt] Remove legacy pass
Arthur Eubanks [Tue, 14 Feb 2023 20:51:15 +0000 (12:51 -0800)]
[GlobalOpt] Remove legacy pass

This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.

17 months agoReland "[gn] port f29cfab55d1f"
Nico Weber [Tue, 14 Feb 2023 20:42:31 +0000 (15:42 -0500)]
Reland "[gn] port f29cfab55d1f"

This reverts commit ff66d410fd87608db16a4ffb5caae1fd62374d5a.
f29cfab55d1f relanded in 5b455a8efbf5.

17 months ago[InlineAdvisor] Restructure advisor plugin unittest cmake
ibricchi [Tue, 14 Feb 2023 20:32:26 +0000 (15:32 -0500)]
[InlineAdvisor] Restructure advisor plugin unittest cmake

Move the plugin used in the unittest to test Inline Advisor Plugins
into a separate folder to clean up the cmake file for the analysis
tests.

Reviewed By: mtrofin, thakis

Differential Revision: https://reviews.llvm.org/D140559

17 months agoRevert "[CGP] Add generic TargetLowering::shouldAlignPointerArgs() implementation"
Jake Egan [Tue, 14 Feb 2023 20:13:28 +0000 (15:13 -0500)]
Revert "[CGP] Add generic TargetLowering::shouldAlignPointerArgs() implementation"

These commits are causing a test-suite build failure on AIX. Revert for now for time to investigate.
https://lab.llvm.org/buildbot/#/builders/214/builds/5779/steps/9/logs/stdio

This reverts commit bd87a2449da0c82e63cebdf9c131c54a5472e3a7 and 4c72266830ffa332ebb7cf1d3bbd6c56d001fa0f.

17 months ago[AMDGPU] Do not apply schedule metric for regions with spilling
Stanislav Mekhanoshin [Mon, 13 Feb 2023 19:36:12 +0000 (11:36 -0800)]
[AMDGPU] Do not apply schedule metric for regions with spilling

D139710 has added a metric to increase schedule's ILP while
staying within the same occupancy. Do not bother to apply this
metric to a region which is known to have spilling, it may result
in spilling to reappear after the previous stage and will do no
good if we already spilling anyway. It may also reduce compile
time a bit for such regions.

Fixes: SWDEV-377300

Differential Revision: https://reviews.llvm.org/D143934

17 months ago[libc++][doc] Sets the proper plenary date.
Mark de Wever [Tue, 14 Feb 2023 20:03:34 +0000 (21:03 +0100)]
[libc++][doc] Sets the proper plenary date.

17 months ago[loop unroll] Fix `branch-weights` for unrolled loop.
Mircea Trofin [Mon, 13 Feb 2023 21:39:21 +0000 (13:39 -0800)]
[loop unroll] Fix `branch-weights` for unrolled loop.

The branch weights of the unrolled loop need to be reduced by the
unroll factor.

Differential Revision: https://reviews.llvm.org/D143948

17 months ago[NFC][IR] Make Module::getNamedMDList() private
Vasileios Porpodas [Tue, 7 Feb 2023 17:47:03 +0000 (09:47 -0800)]
[NFC][IR] Make Module::getNamedMDList() private

This patch adds several missing NamedMDList modifier functions, like
removeNamedMDNode(), eraseNamedMDNode() and insertNamedMDNode().
There is no longer need to access the list directly so it also makes
getNamedMDList() private.

Differential Revision: https://reviews.llvm.org/D143969

17 months ago[LLDB] add arch-specific watchpoint behavior defaults to lldb
Jason Molenda [Tue, 14 Feb 2023 19:29:19 +0000 (11:29 -0800)]
[LLDB] add arch-specific watchpoint behavior defaults to lldb

lldb was originally designed to get the watchpoint exception behavior
from the gdb remote serial protocol stub -- exceptions are either
received before the instruction executes, or after the instruction
has executed.  This behavior was reported via two lldb extensions
to gdb RSP, so generic remote stubs like gdbserver or a JTAG stub,
would not tell lldb which behavior was correct, and it would default
to "exceptions are received after the instruction has executed".
Two architectures hard coded their correct "exceptions before
instruction" behavior, to work around this issue.

Most architectures have a fixed behavior of watchpoint exceptions,
and we can center that information in lldb.  We can allow a remote
stub to override the default behavior via our packet extensions
if it's needed on a specific target.

This patch also separates the fetching of the number of watchpoints
from whether exceptions are before/after the insn.  Currently if
lldb couldn't fetch the number of watchpoints (not really needed), it
also wouldn't get when exceptions are received, and watchpoint
handling would fail.  lldb doesn't actually use the number of
watchpoints for anything beyond printing it to the user.

Differential Revision: https://reviews.llvm.org/D143215
rdar://101426626

17 months ago[lld-macho] Account for alignment in thunk insertion algorithm
Jez Ng [Tue, 14 Feb 2023 19:34:19 +0000 (14:34 -0500)]
[lld-macho] Account for alignment in thunk insertion algorithm

We previously neglected this, leading us to underestimate the maximum
possible branch address offset.

Fixing this should allow us to reduce `slop` to more reasonable
levels. I've lowered it to 256 for now, though I suspect we could go
lower.

Fixes https://github.com/llvm/llvm-project/issues/59259.

Reviewed By: serge-sans-paille

Differential Revision: https://reviews.llvm.org/D144029

17 months ago[RISCV] Untabify THMulAccumulate_rr. NFC.
Philipp Tomsich [Tue, 14 Feb 2023 19:28:48 +0000 (20:28 +0100)]
[RISCV] Untabify THMulAccumulate_rr. NFC.

17 months ago[RISCV] Add vendor-defined XTheadMAC (multiply-accumulate) extension
Manolis Tsamis [Tue, 14 Feb 2023 18:43:00 +0000 (19:43 +0100)]
[RISCV] Add vendor-defined XTheadMAC (multiply-accumulate) extension

The vendor-defined XTHeadMAC (no comparable standard extension exists
at the time of writing) extension adds multiply accumulate instructions.

It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.

The current (as of this commit) public documentation for this
extension is available at:
  https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf

Support for these instructions has already landed in GNU Binutils:
  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4041e11db3ec3611921d10150572a92689aa3154

Co-authored-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D143847