platform/upstream/llvm.git
15 months ago[RISCV] Fix canonical ordering of s* vs z* extensions in RISCVISAInfo
Alex Bradbury [Wed, 19 Apr 2023 06:03:57 +0000 (07:03 +0100)]
[RISCV] Fix canonical ordering of s* vs z* extensions in RISCVISAInfo

As noted in https://reviews.llvm.org/D148315, the ordering logic for
OrderedExtensionMap currently puts s* before z* extensions, but per the
ISA manual the correct order should be z* and then s* (with the
exception of zxm*, which are ordered after s*).

This patch fixes the ordering and adds a TODO for zxm*. The changes are
visible in the test case added in
a35e67fc5be654a7efdfa6125343b90f8960a487 which also demonstrates an
issue with the ordering of single letter extensions (which isn't
addressed in this patch).

This ordering matches the one used by GCC/binutils as well.

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

15 months ago[clang][Bazel] Add missing dependency after 310ee08d5d4
Adrian Kuegel [Wed, 19 Apr 2023 05:56:28 +0000 (07:56 +0200)]
[clang][Bazel] Add missing dependency after 310ee08d5d4

15 months ago[docs][RISCV] Use anonymous references in RISCVUsage to avoid warnings
Alex Bradbury [Wed, 19 Apr 2023 05:43:40 +0000 (06:43 +0100)]
[docs][RISCV] Use anonymous references in RISCVUsage to avoid warnings

2a5661c8415876be3fbd56ce90c2031e89ba0ef3 added a new external link with
the link text "0.2 draft specification". Surprisingly, as multiple links
have this same text but different targets this causes a warning, which
causes a failure on the llvm-sphinx-docs builder (which treats warnings
as errors). As suggested in
<https://github.com/sphinx-doc/sphinx/issues/3921>, this commit moves to
using anonymous references for the links in the experimental extensions
section.

15 months ago[RISCV][NFC] Consistently use Opcode local variable in RISCVAsmParser::validateInstru...
Alex Bradbury [Wed, 19 Apr 2023 05:31:10 +0000 (06:31 +0100)]
[RISCV][NFC] Consistently use Opcode local variable in RISCVAsmParser::validateInstruction

As we already do `unsigned Opcode = Inst.getOpcode();`, we may as well
use that variable.

15 months ago[RISCV] Bump Zfa version to 0.2 and correct RISCVUsage description
Alex Bradbury [Wed, 19 Apr 2023 05:24:53 +0000 (06:24 +0100)]
[RISCV] Bump Zfa version to 0.2 and correct RISCVUsage description

As of
https://github.com/riscv/riscv-isa-manual/commit/1f038182810727f5feca311072e630d6baac51da
in the riscv-isa-manual, Zfa is at version 0.2. Reviewing the commit
history for
zfa.tex
<https://github.com/riscv/riscv-isa-manual/commits/master/src/zfa.tex>
there are no relevant changes since 0.1. As such, we can simply
increment the version number.

This change also removes the claim in RISCVUsage that we implement a
"subset of" Zfa, as I believe this is no longer true. That sentence
previously incorrectly claimed we didn't implement fli.{h,s,d} (I
[corrected this a couple of weeks
ago](https://reviews.llvm.org/rG3d969191b277)) but I think should have
removed the "subset of" wording too.

As was noted during the review, we never added Zfa to the release notes.
This is corrected in this patch.

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

15 months ago[InstSimplify] Update tests for max(min,max) to cover more types.
Serguei Katkov [Wed, 19 Apr 2023 05:05:29 +0000 (12:05 +0700)]
[InstSimplify] Update tests for max(min,max) to cover more types.

15 months agoRevert "[AMDGPU] Ressociate patterns with sub to use SALU"
chenglin.bi [Wed, 19 Apr 2023 03:15:14 +0000 (11:15 +0800)]
Revert "[AMDGPU] Ressociate patterns with sub to use SALU"

The patch will caused dead loop because of DAGCombiner's canonicalization:
  // (x + C) - y  ->  (x - y) + C
  // y - (x + C)  ->  (y - x) - C
  // (x - C) - y  ->  (x - y) - C
  // (C - x) - y  ->  C - (x + y)

This reverts commit b3529b5bf3ba2cd7f38665de16450afefb263c9b.

15 months ago[RISCV] Customed lower vector nearbyint and rint in RISC-V.
Yeting Kuo [Tue, 18 Apr 2023 08:47:33 +0000 (16:47 +0800)]
[RISCV] Customed lower vector nearbyint and rint in RISC-V.

The patch lowers vector rint/nearbyint like vp.rint/nearbyint.

Reviewed By: craig.topper

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

15 months ago[RISCV] Remove SEW=8 case for floating-point
wangpc [Wed, 19 Apr 2023 02:45:10 +0000 (10:45 +0800)]
[RISCV] Remove SEW=8 case for floating-point

For floating-point instructions, SEW won't be 8. So we don't need
to generate scheduling resources for it.

Reviewed By: michaelmaitland

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

15 months ago[mlir][NFC] Minor cleanups around ShapedType
Matthias Springer [Wed, 19 Apr 2023 02:28:53 +0000 (11:28 +0900)]
[mlir][NFC] Minor cleanups around ShapedType

* Remove unnecessary casts.
* Use concrete shaped types (e.g., `MemRefType`, `RankedTensorType`) instead of `ShapedType` when possible.
* Minor documentation cleanups.

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

15 months ago[mlir][IR] Remove ShapedType::getSizeInBits
Matthias Springer [Wed, 19 Apr 2023 02:00:48 +0000 (11:00 +0900)]
[mlir][IR] Remove ShapedType::getSizeInBits

This function returns incorrect values for memrefs and vectors due to "widening".

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

15 months agobazel patch for OpenACC changes
Aart Bik [Wed, 19 Apr 2023 01:18:34 +0000 (18:18 -0700)]
bazel patch for OpenACC changes

Reviewed By: razvanlupusoru, anlunx

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

15 months agoRevert "[ExecutionEngine] Allow JIT tests to run on PowerPC."
Lang Hames [Wed, 19 Apr 2023 01:02:19 +0000 (18:02 -0700)]
Revert "[ExecutionEngine] Allow JIT tests to run on PowerPC."

This reverts commit d771f54107c4889cde449d2bf5ba13d193017716 due to builder
failures, e.g. https://lab.llvm.org/buildbot#builders/93/builds/14488.

15 months ago[libc] Add fuchsia/io.h for TestLogger
Alex Brachet [Wed, 19 Apr 2023 00:54:32 +0000 (00:54 +0000)]
[libc] Add fuchsia/io.h for TestLogger

b3c696fb86 started using TestLogger in tests. This class depends on
write_to_stderr which was previously only provided for Linux and
GPU's. Note, this function is used on those platforms in the libc
proper, though for Fuchsia we only ever want to provide this for
TestLogger.

No CMake files are changed because this fuchsia/ directory isn't
useful in any CMake build.

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

15 months ago[libc] move strerror and strsignal to OS msg maps
Michael Jones [Mon, 10 Apr 2023 20:10:27 +0000 (13:10 -0700)]
[libc] move strerror and strsignal to OS msg maps

Other OSes may have different mappings from error number to message.
This creates a system to allow new platforms to define their own
mappings.

Reviewed By: sivachandra

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

15 months ago[mlir][openacc] Fix build after D148389
Razvan Lupusoru [Tue, 18 Apr 2023 23:28:18 +0000 (16:28 -0700)]
[mlir][openacc] Fix build after D148389

Buildbot reported undefined references to LLVM dialect and Memref
dialect. The issue is that OpenACC dialect now depends on those
(since it attaches interface to the types) but the cmake file
did not explicitly add those dependencies.

Reviewed By: clementval, vzakhari

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

15 months ago[mlir][sparse] introduce a new compressed(hi) dimension level type
Peiming Liu [Tue, 18 Apr 2023 21:38:49 +0000 (21:38 +0000)]
[mlir][sparse] introduce a new compressed(hi) dimension level type

`compressed(hi)` is similar to `compressed`, but instead of reusing the previous position high as the current position low, it uses a pair of positions for each sparse index.

The patch only introduces the definition (syntax) but does not provide codegen implementation.

Reviewed By: aartbik

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

15 months ago[mlir][openacc] Add separate acc data operations for OpenACC data clauses
Razvan Lupusoru [Tue, 18 Apr 2023 00:01:51 +0000 (17:01 -0700)]
[mlir][openacc] Add separate acc data operations for OpenACC data clauses

As outlined in [1], data clauses are now implemented as separate operations
from the constructs that they belong to. Some of the highlighted benefits:
- Correctly represent dataflow of data operations
- Easier to track debugging information
- Friendlier to add attributes and to optimize operations

For now, all of the other operand lists are being kept until all references
to them in LLVM can be removed (such as those in flang lowering)

[1] https://discourse.llvm.org/t/rfc-openacc-dialect-data-operation-improvements/69825

Reviewed By: clementval, vzakhari

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

15 months ago[TableGen] Reduce the amount of storage space used for AddrSpaces in TypeSetByHwMode...
Craig Topper [Tue, 18 Apr 2023 22:13:54 +0000 (15:13 -0700)]
[TableGen] Reduce the amount of storage space used for AddrSpaces in TypeSetByHwMode. NFC

We reserved 16 AddrSpaces in every TypeSetByHwMode. But we only ever
use the first one on targets that make use of the AddrSpace feature.

The vector was populated by pushing for each entry in the ArrayRef
passed to the TypeSetByHwMode constructor. Each entry is a
ValueTypeByHwMode that stores one VT for each HwMode.

The vector is accessed by a loop in TypeSetByHwMode::getValueTypeByHwMode.
That loop is over HwModes with in the TypeSetByHwMode. This is
unrelated to how the vector was created. The entries in the vector
don't represent HwModes.

The targets that use AddrSpace don't make use of HwModes so the
loop in getValueTypeByHwMode will only run 1 iteration. So we only
the first entry in the vector is meaningful used.

This patch simplifies things by storing only 1 AddrSpace in
TypeSetByMode. Reducing the memory used by TypeSetByHwMode.
More work will be needed to support HwModes with AddrSpace if we
need a different AddrSpace for each HwMode.

Reviewed By: arsenm

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

15 months ago[gn build] Port c2114bd8e1f0
LLVM GN Syncbot [Tue, 18 Apr 2023 22:24:22 +0000 (22:24 +0000)]
[gn build] Port c2114bd8e1f0

15 months agoRevert "Non-debuginfo JITLink perf jitdump support"
Valentin Churavy [Tue, 18 Apr 2023 22:21:48 +0000 (18:21 -0400)]
Revert "Non-debuginfo JITLink perf jitdump support"

This reverts commit 76e1521b0acff739c0425d0fcbb9360fc17f1af8.

15 months ago[ELF] hash fn return type
Nathan Sidwell [Fri, 14 Apr 2023 21:12:05 +0000 (17:12 -0400)]
[ELF] hash fn return type

Be explicit about the 32bitness of the return type.

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

15 months ago[BOLT] Don't enable runtime when not building X86
Nathan Sidwell [Fri, 14 Apr 2023 12:51:05 +0000 (08:51 -0400)]
[BOLT] Don't enable runtime when not building X86

15 months agoRecommit "[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to...
Noah Goldstein [Tue, 18 Apr 2023 21:34:56 +0000 (16:34 -0500)]
Recommit "[ValueTracking] Apply the isKnownNonZero techniques in `ashr`/`lshl` to `shl` and vice-versa" (2nd Try)

Wasn't related to the bug it was original thought to be causing.

15 months agoRecommit "[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`" (2nd...
Noah Goldstein [Tue, 18 Apr 2023 21:34:17 +0000 (16:34 -0500)]
Recommit "[InstCombine] Add transforms for `(icmp {u|s}ge/le (xor X, Y), X)`" (2nd Try)

Wasn't related to the bug it was original thought to be causing.

15 months ago[InstCombine] Fix buggy `(mul X, Y)` -> `(shl X, Log2(Y))` transform PR62175
Noah Goldstein [Tue, 18 Apr 2023 21:34:02 +0000 (16:34 -0500)]
[InstCombine] Fix buggy `(mul X, Y)` -> `(shl X, Log2(Y))` transform PR62175

Bug was because we recognized patterns like `(shl 4, Z)` as a power of
2 we could take Log2 of (`2 + Z`), but doing `(shl X, (2 + Z))` can
cause a poison shift.
    https://alive2.llvm.org/ce/z/yuJm_k

The fix is to verify that `Log2(Y)` will be a non-poisonous shift
amount. We can do this with:
    `nsw` flag:
        - https://alive2.llvm.org/ce/z/yyyJBr
        - https://alive2.llvm.org/ce/z/YgubD_
    `nuw` flag:
        - https://alive2.llvm.org/ce/z/-4mpyV
        - https://alive2.llvm.org/ce/z/a6ik6r
    Prove `Y != 0`:
        - https://alive2.llvm.org/ce/z/ced4su
        - https://alive2.llvm.org/ce/z/X-JJHb

Reviewed By: nikic

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

15 months ago[ExecutionEngine] Allow JIT tests to run on PowerPC.
Lang Hames [Tue, 18 Apr 2023 22:11:58 +0000 (15:11 -0700)]
[ExecutionEngine] Allow JIT tests to run on PowerPC.

These tests passed on my ppc64le test machine. If they survive testing by the
buildbots then we can leave them enabled, and this will allow us to land the
new ppc64 JITLink backend (https://reviews.llvm.org/D148192).

15 months ago[AsmPrinter] Fix placement of function entry comments
Fangrui Song [Tue, 18 Apr 2023 22:01:36 +0000 (15:01 -0700)]
[AsmPrinter] Fix placement of function entry comments

The placement is currently wrong in the presence of function entry related
instrumentations (prefixdata, -fpatchable-function-entry=, -fsanitize=kcfi,
etc).

15 months ago[gwp_asan] Employ EXPECT_DEATH for zxtest compatibility
Caslyn Tonelli [Thu, 30 Mar 2023 00:03:05 +0000 (00:03 +0000)]
[gwp_asan] Employ EXPECT_DEATH for zxtest compatibility

Employ a similar tactic introduced by https://reviews.llvm.org/D94362
for gwp_asan tests. zxtest `ASSERT_DEATH` syntax differs from gtest in
that it expects a lambda.

zxtest does not have `EXPECT_DEATH`, so it introduced for Fuchsia builds
and wraps the expression with a lambda to create a compatible syntax
between zxtest and gtest for death tests.

An example of where this compatiblity is needed is in
`never_allocated.cpp`.

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

15 months agoRefactor BasicBlockSectionsProfileReader::getBBClusterInfoForFunction.
Rahman Lavaee [Tue, 18 Apr 2023 21:19:28 +0000 (21:19 +0000)]
Refactor BasicBlockSectionsProfileReader::getBBClusterInfoForFunction.

15 months ago[gn build] Port 76e1521b0acf
LLVM GN Syncbot [Tue, 18 Apr 2023 21:16:29 +0000 (21:16 +0000)]
[gn build] Port 76e1521b0acf

15 months agoNon-debuginfo JITLink perf jitdump support
Prem Chintalapudi [Tue, 18 Apr 2023 21:15:32 +0000 (17:15 -0400)]
Non-debuginfo JITLink perf jitdump support

This patch ports PerfJITEventListener to a JITLink plugin, but adds unwind record support and drops debuginfo support temporarily. Debuginfo can be enabled in the future by providing a way to obtain a DWARFContext from a LinkGraph.

See D146060 for an experimental implementation that adds debuginfo parsing.

Reviewed By: lhames

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

15 months ago[mlir][spirv][vector] Enable vector3 when converting to dot product
Lei Zhang [Tue, 18 Apr 2023 20:57:35 +0000 (13:57 -0700)]
[mlir][spirv][vector] Enable vector3 when converting to dot product

It's common to see such cases for contraction from convolution with
input channel as 3. Although we aren't utilizing all 4 lanes for
dot product, it should still be better than performing the multiply
and reduction separately.

Reviewed By: kuhar

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

15 months ago[Clang][NFC] Rename methods/vars to reflect their real usage
Bill Wendling [Mon, 17 Apr 2023 23:31:42 +0000 (16:31 -0700)]
[Clang][NFC] Rename methods/vars to reflect their real usage

The "getField" method is a bit confusing considering we also have a
"getFieldName" method. Instead, use "getFieldDecl" rather than
"getField".

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

15 months agoRemove hardcoded address bits in ABIMacOS_arm64
Jason Molenda [Tue, 18 Apr 2023 20:01:49 +0000 (13:01 -0700)]
Remove hardcoded address bits in ABIMacOS_arm64

A default number of addressing bits was hardcoded in
ABIMacOSX_arm64::FixAddress while we updated different
environments to fetch the value dynamically.  Remove
the old hardcoded value.

Differential Revision: https://reviews.llvm.org/D148603
rdar://108068497

15 months ago[NFC][lsan] Rename test function
Vitaly Buka [Tue, 18 Apr 2023 19:43:13 +0000 (12:43 -0700)]
[NFC][lsan] Rename test function

15 months ago[lsan] Disabled D148281 test on Darwin
Vitaly Buka [Tue, 18 Apr 2023 19:41:43 +0000 (12:41 -0700)]
[lsan] Disabled D148281 test on Darwin

For unknown reason it fails to link.

15 months ago[libc] Add two more recipes to do a cross build.
Siva Chandra Reddy [Fri, 31 Mar 2023 19:19:58 +0000 (12:19 -0700)]
[libc] Add two more recipes to do a cross build.

Reviewed By: jeffbailey

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

15 months ago[SLP]Add final resize to ShuffleCostEstimator::finalize member function and basic...
Alexey Bataev [Thu, 13 Apr 2023 18:28:54 +0000 (11:28 -0700)]
[SLP]Add final resize to ShuffleCostEstimator::finalize member function and basic add member functions.

Implemented the reshuffling in finalize member function + add basic
support for add member functions, used during vector build.

Part of D110978

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

15 months ago[libc][NFC] Move RoundingModeUtils to LibcFPTestHelpers.
Siva Chandra Reddy [Tue, 18 Apr 2023 00:35:28 +0000 (00:35 +0000)]
[libc][NFC] Move RoundingModeUtils to LibcFPTestHelpers.

Reviewed By: lntue

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

15 months agoReland "[clang-repl] Enable debugging of JIT-ed code."
Vassil Vassilev [Tue, 18 Apr 2023 16:22:04 +0000 (16:22 +0000)]
Reland "[clang-repl] Enable debugging of JIT-ed code."

Original commit message: "
[clang-repl] Enable debugging of JIT-ed code.

    This change follows llvm/llvm-project@21b5ebd and makes use of the jitlink
    infrastructure. In order to use this feature inside lldb one needs to run the
    lldb command: settings set plugin.jit-loader.gdb.enable on

    This works currently only on Darwin since jitlink is not a default ELF/x86-64
    backend yet.

    Differential revision: https://reviews.llvm.org/D148481
"

This patch reverts commit e64fbf2cca8c4763a058ba59a48ab8e4b8193028 and adds
the missing library dependencies which caused the initial failure.

15 months ago[mlir][sparse] remove redundate integration tests.
Peiming Liu [Tue, 18 Apr 2023 17:19:30 +0000 (17:19 +0000)]
[mlir][sparse] remove redundate integration tests.

The removed tests evaluate the same kernels in existing tests, namely `sparse_conv2d.mlir` and `spares_conv3d.mlir`.

Reviewed By: aartbik

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

15 months ago"Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"
Leonard Chan [Tue, 18 Apr 2023 18:26:01 +0000 (18:26 +0000)]
"Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia"

This reverts commit cdf71d2ccd84ed7b8891924b04d1603f344038e9.

Relanding this because this only affects fuchsia builders and we moved
our hwasan builders to a non-blocking pool in the meantime.

15 months ago[PowerPC][LLD] Update DataLayout in tests
David Tenty [Tue, 18 Apr 2023 18:19:45 +0000 (14:19 -0400)]
[PowerPC][LLD] Update DataLayout in tests

Missed by the original commit of D147016 which updated the DataLayout for Power.

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

15 months ago[libc][Obvious] Fix the performance table in math function documentation.
Tue Ly [Tue, 18 Apr 2023 18:09:42 +0000 (14:09 -0400)]
[libc][Obvious] Fix the performance table in math function documentation.

15 months agoRevert "[SLP]Add final resize to ShuffleCostEstimator::finalize member function and...
Alexey Bataev [Tue, 18 Apr 2023 17:40:20 +0000 (10:40 -0700)]
Revert "[SLP]Add final resize to ShuffleCostEstimator::finalize member function and basic add member functions."

This reverts commit cd341f3f4878137d1c9e7a05c4c3a7bd8ff216dc to fix
a crash revealed by buildbot https://lab.llvm.org/buildbot#builders/124/builds/7108.

15 months ago[DAG] Restrict (fp_round (copysign X, Y)) -> (copysign (fp_round X), Y) combine
Philip Reames [Mon, 17 Apr 2023 21:36:27 +0000 (14:36 -0700)]
[DAG] Restrict (fp_round (copysign X, Y)) -> (copysign (fp_round X), Y) combine

This transformation creates an copysign node whose argument types do not match. RISCV does not handle such a case which results in a crash today. Looking at the relevant code in DAG, it looks like the process of enabling the non-matching types case was never completed for vectors at all. The transformation which triggered the RISCV crash is a specialization of another transform (specifically due to one use for profitability) which isn't enabled by default. Given that, I chose to match the preconditions for that other transform.

Other options here include:
* Updating RISCV codegen to handle the mismatched argument type case for vectors. This is slightly tricky as I don't see an obvious profitable lowering for this case which doesn't involve simply adding back in the round/trunc.
* Disabling the transform via a target hook.

This patch does involve two changes for AArch64 codegen. These could be called regressions, but well, the code after actually looks better than the code before.

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

15 months ago[ClangFE] Handle statement expressions properly with CheckAtomicAlignment().
Jonas Paulsson [Fri, 14 Apr 2023 10:12:29 +0000 (12:12 +0200)]
[ClangFE] Handle statement expressions properly with CheckAtomicAlignment().

Make CheckAtomicAlignment() return the computed pointer for reuse to avoid
emitting it twice.

Reviewed By: efriedma

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

15 months ago[X86] Create all-one vector(v8i32) for TESTC(X,~X) == TESTC(X,-1) if X is v8f32
Bing1 Yu [Tue, 18 Apr 2023 17:27:05 +0000 (01:27 +0800)]
[X86] Create all-one vector(v8i32) for TESTC(X,~X) == TESTC(X,-1) if X is v8f32

getAllOnesConstant can only take v8i32 instead of v8f32

Reviewed By: RKSimon

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

15 months ago[PowerPC] Add function pointer alignment to DataLayout
David Tenty [Tue, 18 Apr 2023 15:36:10 +0000 (11:36 -0400)]
[PowerPC] Add function pointer alignment to DataLayout

The alignment of function pointers was added to the Datalayout by
D57335 but currently is unset for the Power target. This will cause us
to compute a conservative minimum alignment of one if places like
Value::getPointerAlignment.

This patch implements the function pointer alignment in the Datalayout
for the Power backend and Power targets in clang, so we can query the
value for a particular Power target.

We come up with the correct value one of two ways:

- If the target uses function descriptor objects (i.e. ELFv1 & AIX ABIs),
  then a function pointer points to the descriptor, so use the alignment
  we would emit the descriptor with.
- If the target doesn't use function descriptor objects (i.e. ELFv2), a
  function pointer points to the global entry point, so use the minimum
  alignment for code on Power (i.e. 4-bytes).

Reviewed By: nemanjai

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

15 months ago[OpenMP][libomptarget][NFC] Remove error data member from AsyncInfoWrapperTy
Kevin Sala [Tue, 11 Apr 2023 16:41:39 +0000 (18:41 +0200)]
[OpenMP][libomptarget][NFC] Remove error data member from AsyncInfoWrapperTy

This patch removes the Err data member from the AsyncInfoWrapperTy class. Now the error
is stored externally, in the caller side, and it is explicitly passed to the
AsyncInfoWrapperTy::finalize() function as a reference.

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

15 months ago[vector] When trimming leading insertion dimensions, base the final result on the...
Benjamin Kramer [Tue, 18 Apr 2023 14:53:17 +0000 (16:53 +0200)]
[vector] When trimming leading insertion dimensions, base the final result on the ranks

This was incorrect when the number of dropped source dims was smaller
than the number of dropped dst dims. We still need to insert zeros if
there is anything dropped from the src.

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

15 months ago[Headers][doc] Add FMA intrinsic descriptions
Paul Robinson [Tue, 18 Apr 2023 16:26:35 +0000 (09:26 -0700)]
[Headers][doc] Add FMA intrinsic descriptions

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

15 months ago[GlobalOpt] Don't evaluate large memset (PR62191)
Nikita Popov [Tue, 18 Apr 2023 16:22:37 +0000 (18:22 +0200)]
[GlobalOpt] Don't evaluate large memset (PR62191)

If the memset is large, checking every single byte of the global
may be very slow. Add an upper bound on the size of memset we
handle.

For the common special case of memset zeroinitializer to zero,
add a fastpath that checks just that and is not length limited.

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

15 months ago[libc][NFC] Move ExecuteFunction test util to test/UnitTest.
Siva Chandra Reddy [Tue, 18 Apr 2023 08:09:18 +0000 (08:09 +0000)]
[libc][NFC] Move ExecuteFunction test util to test/UnitTest.

Reviewed By: lntue

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

15 months ago[flang] Fixed substr access in embox/rebox CodeGen.
Slava Zakharin [Tue, 18 Apr 2023 00:06:14 +0000 (17:06 -0700)]
[flang] Fixed substr access in embox/rebox CodeGen.

The code was using the original operand of the operation, while
it should have been using the remapped operands via the adaptor.

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

15 months agoRevert "[libc] handle memset sequence as a separate struct"
Guillaume Chatelet [Tue, 18 Apr 2023 15:24:24 +0000 (15:24 +0000)]
Revert "[libc] handle memset sequence as a separate struct"

This patch broke the build bots.
This reverts commit 6fdc244e9f13d2ce20a26d05513f22a1e099f90a.

15 months ago[libc] handle memset sequence as a separate struct
Guillaume Chatelet [Tue, 18 Apr 2023 15:16:20 +0000 (15:16 +0000)]
[libc] handle memset sequence as a separate struct

These sequence of calls don't really make sense for head_tail and loop_and_tail.

15 months ago[CostModel][X86] Add BSWAP cost model estimations
Simon Pilgrim [Tue, 18 Apr 2023 15:04:59 +0000 (16:04 +0100)]
[CostModel][X86] Add BSWAP cost model estimations

Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates

15 months ago[clang-scan-deps] Add clang-scan-deps to llvm-driver build
Alex Brachet [Tue, 18 Apr 2023 15:02:23 +0000 (15:02 +0000)]
[clang-scan-deps] Add clang-scan-deps to llvm-driver build

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

15 months ago[AMDGPU][AsmParser] Refine parsing SDWA operands.
Ivan Kosarev [Tue, 18 Apr 2023 14:26:09 +0000 (15:26 +0100)]
[AMDGPU][AsmParser] Refine parsing SDWA operands.

Removes the need for the custom code in parseCustomOperand().

Reviewed By: foad

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

15 months agoRevert "[clang-repl] Enable debugging of JIT-ed code."
Vassil Vassilev [Tue, 18 Apr 2023 13:40:52 +0000 (13:40 +0000)]
Revert "[clang-repl] Enable debugging of JIT-ed code."

This reverts commit 1e4891e681c51f3e2a724b4ac4e42380ec4a9be1.

Some bots complain about undefined llvm_orc_registerJITLoaderGDBAllocAction.

15 months ago[libc] Add debug messages to bcmp and memcmp tests
Guillaume Chatelet [Tue, 18 Apr 2023 13:35:18 +0000 (13:35 +0000)]
[libc] Add debug messages to bcmp and memcmp tests

15 months ago[clang-repl] Enable debugging of JIT-ed code.
Vassil Vassilev [Sun, 16 Apr 2023 20:43:29 +0000 (20:43 +0000)]
[clang-repl] Enable debugging of JIT-ed code.

This change follows llvm/llvm-project@21b5ebd and makes use of the jitlink
infrastructure. In order to use this feature inside lldb one needs to run the
lldb command: settings set plugin.jit-loader.gdb.enable on

This works currently only on Darwin since jitlink is not a default ELF/x86-64
backend yet.

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

15 months ago[SCEV] Add additional tests for addrec nowrap flags (NFC)
Nikita Popov [Tue, 18 Apr 2023 13:14:59 +0000 (15:14 +0200)]
[SCEV] Add additional tests for addrec nowrap flags (NFC)

15 months ago[MC] Simplify uses of subregs/superregs. NFC.
Jay Foad [Tue, 18 Apr 2023 13:12:14 +0000 (14:12 +0100)]
[MC] Simplify uses of subregs/superregs. NFC.

15 months ago[libc] Add AVX detectionwq
Guillaume Chatelet [Tue, 18 Apr 2023 13:10:51 +0000 (13:10 +0000)]
[libc] Add AVX detectionwq

15 months ago[Test] Add IRCE tests with non-canonical range check
Max Kazantsev [Tue, 18 Apr 2023 13:06:46 +0000 (20:06 +0700)]
[Test] Add IRCE tests with non-canonical range check

Patch by Aleksandr Popov!

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

15 months ago[coro][nfc] Use Load/Store instruction APIs
Felipe de Azevedo Piovezan [Mon, 17 Apr 2023 21:17:04 +0000 (17:17 -0400)]
[coro][nfc] Use Load/Store instruction APIs

Instead of hard-coding operand indices, it is cleaner to use the APIs
provided by the Load/Store Inst classes.

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

15 months ago[CodeGen] Enable processing of interconnected complex number operations
Igor Kirillov [Mon, 27 Mar 2023 16:32:40 +0000 (16:32 +0000)]
[CodeGen] Enable processing of interconnected complex number operations

With this patch, ComplexDeinterleavingPass now has the ability to handle
any number of interconnected operations involving complex numbers.
For example, the patch enables the processing of code like the following:

for (int i = 0; i < 1000; ++i) {
    a[i] =  w[i] * v[i];
    b[i] =  w[i] * u[i];
}

This code has multiple arrays containing complex numbers and a common
subexpression `w` that appears in two expressions.

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

15 months ago[BPI] Add method to swap outgoing edges probabilities
Max Kazantsev [Tue, 18 Apr 2023 12:35:49 +0000 (19:35 +0700)]
[BPI] Add method to swap outgoing edges probabilities

The motivation is need to update branch probability info after
swapping successors of branch instruction.

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

15 months ago[MC] Fix M68k build after D148613
Jay Foad [Tue, 18 Apr 2023 12:58:35 +0000 (13:58 +0100)]
[MC] Fix M68k build after D148613

15 months ago[SLP]Add final resize to ShuffleCostEstimator::finalize member function and basic...
Alexey Bataev [Thu, 13 Apr 2023 18:28:54 +0000 (11:28 -0700)]
[SLP]Add final resize to ShuffleCostEstimator::finalize member function and basic add member functions.

Implemented the reshuffling in finalize member function + add basic
support for add member functions, used during vector build.

Part of D110978

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

15 months ago[llvm-remarkutil] Add an option to display DebugLoc when collecting counts for remarks.
Zain Jaffal [Tue, 18 Apr 2023 12:48:41 +0000 (13:48 +0100)]
[llvm-remarkutil] Add an option to display DebugLoc when collecting counts for remarks.

Reviewed By: paquette

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

15 months ago[AMDGPU] Remove unnecessary assert
David Stuttard [Tue, 18 Apr 2023 10:38:49 +0000 (11:38 +0100)]
[AMDGPU] Remove unnecessary assert

Also remove the function attributes from the test. For PAL based shaders this isn't required.

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

15 months ago[BPI][Test] Check the probabilities after swapping branch successors
Max Kazantsev [Tue, 18 Apr 2023 12:31:08 +0000 (19:31 +0700)]
[BPI][Test] Check the probabilities after swapping branch successors

Patch by Aleksandr Popov!

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

15 months ago[gn] port 1ae57fed880688 and fix mistake from 1203a24764bfa
Nico Weber [Tue, 18 Apr 2023 12:29:50 +0000 (08:29 -0400)]
[gn] port 1ae57fed880688 and fix mistake from 1203a24764bfa

15 months ago[MC] Use subregs/superregs instead of MCSubRegIterator/MCSuperRegIterator. NFC.
Jay Foad [Mon, 17 Apr 2023 20:09:19 +0000 (21:09 +0100)]
[MC] Use subregs/superregs instead of MCSubRegIterator/MCSuperRegIterator. NFC.

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

15 months ago[AMDGPU] Refactor PromoteAlloca implementation
pvanhout [Mon, 17 Apr 2023 13:26:24 +0000 (15:26 +0200)]
[AMDGPU] Refactor PromoteAlloca implementation

We're getting a lot of mileage out of PromoteAlloca, and the pass had grown somewhat organically over the year.
This patch attempts to clean up the implementation and restructure it. For instance,
the exact same code path is now used for both promote alloca to LDS and
promote alloca to vector - just with different parameters.
This removes some redundancy here and there.
I also reordered functions in a way that hopefully makes more sense (e.g. all of the pass API is in the same place)

No functionality change is intended in the patch, but some checks were movved around so I'm not using the NFC tag.

Reviewed By: arsenm

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

15 months ago[Assignment Tracking][SelectionDAG] Downgrade dbg.assigns to dbg.values if assignment...
OCHyams [Tue, 18 Apr 2023 11:41:37 +0000 (12:41 +0100)]
[Assignment Tracking][SelectionDAG] Downgrade dbg.assigns to dbg.values if assignment tracking is not enabled

We shouldn't be able to reach this code path from source code but this provides
a better fail-safe than asserting. The result of the downgrade is a degraded
debugging experience, but it is better than nothing.

Reviewed By: jmorse

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

15 months ago[libunwind] Remove the legacy Unwind_AppleExtras.cpp
Louis Dionne [Sat, 15 Apr 2023 23:36:23 +0000 (00:36 +0100)]
[libunwind] Remove the legacy Unwind_AppleExtras.cpp

Unwind_AppleExtras.cpp contained annotations telling the linker that
some symbols are not available on some very old platforms. However,
those platforms are not supported anymore, so the annotations are not
used.

Why remove this? In addition to cleaning up the code base, this also
removes the possibility of implementing those annotations incorrectly
(which was the case previously), which could lead to important symbols
being hidden when they should have been visible.

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

15 months ago[mlir][NVGPU] Support cache all (.ca) in nvgpu.device_async_copy
Nicolas Vasilache [Tue, 18 Apr 2023 11:28:45 +0000 (04:28 -0700)]
[mlir][NVGPU] Support cache all (.ca) in nvgpu.device_async_copy

This patch adds support for cache all (.ca) in conversion from nvgpu-to-nvvm for inline asm `cp.async`.

For sizes other than 16 bytes cp.async cache global is not allowed and cache all is required to generate a valid ptx.

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

Authored-by: Manish Gupta <manigupta@google.com>
15 months ago[mlir][Linalg] NFC - Add builder for MatchOp
Nicolas Vasilache [Tue, 18 Apr 2023 09:45:35 +0000 (02:45 -0700)]
[mlir][Linalg] NFC - Add builder for MatchOp

15 months ago[mlir][Linalg] NFC - Pass TrackingListeners to all transforms
Nicolas Vasilache [Mon, 17 Apr 2023 14:36:52 +0000 (07:36 -0700)]
[mlir][Linalg] NFC - Pass TrackingListeners to all transforms

This commit properly passes tracking listeners to all Linalg transform operations.
It has no visible API or behavioral change but it helps downstream clients make better use of tracking facilities.

15 months ago[mlir][Linalg] NFC - Add builder for TileToScfForOp
Nicolas Vasilache [Mon, 17 Apr 2023 14:16:04 +0000 (07:16 -0700)]
[mlir][Linalg] NFC - Add builder for TileToScfForOp

15 months ago[AMDGPU] Do not crash on agpr_hi16 in AMDGPUResourceUsageAnalysis
pvanhout [Mon, 17 Apr 2023 12:19:11 +0000 (14:19 +0200)]
[AMDGPU] Do not crash on agpr_hi16 in AMDGPUResourceUsageAnalysis

Reviewed By: #amdgpu, arsenm

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

15 months agoFix uninitialized pointer members
Akshay Khadse [Tue, 18 Apr 2023 11:07:28 +0000 (19:07 +0800)]
Fix uninitialized pointer members

Reviewed By: LuoYuanke

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

15 months agoRevert "[Flang] Change fir.divc to perform library call rather than generate inline...
Kiran Chandramohan [Tue, 18 Apr 2023 11:08:16 +0000 (11:08 +0000)]
Revert "[Flang] Change fir.divc to perform library call rather than generate inline operations."

This reverts commit a7bb8e273f433cceeb547e87d04114178573496a.

Revertin since this runs into an ABI issue.

15 months ago[X86] Fix checks for illegal physreg COPY instructions
Jay Foad [Mon, 17 Apr 2023 14:44:07 +0000 (15:44 +0100)]
[X86] Fix checks for illegal physreg COPY instructions

D105263 changed this test to not expect a MachineVerifier error on this
instruction:

    ; FP16 reg is sub_reg of xmm
    %0:_(s16) = COPY $xmm0

D107082 changed the behaviour back again so that this instruction did
cause an error, but the test was not updated to expect the error.

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

15 months agoFix uninitialized pointer members in TableGen
Akshay Khadse [Tue, 18 Apr 2023 09:47:00 +0000 (17:47 +0800)]
Fix uninitialized pointer members in TableGen

Fixes static code analysis errors

Reviewed By: LuoYuanke

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

15 months agoReland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter
Ilya Biryukov [Mon, 17 Apr 2023 11:50:59 +0000 (13:50 +0200)]
Reland [Modules] Remove unnecessary check when generating name lookup table in ASTWriter

Fixes #61065.

This reverts commit 363c98b2d67986b9766bb1426739970ce6d9a6f3 and relands
db987b9589be1eb604fcb74c85b410469e31485f with fixes from
bc95f27337c7ed77c28e713c855272848f01802a.

The module-related issues surfaced there are fixed in the
previous commit.

15 months ago[Modules] Do not rewrite existing decls when deserializing class fields
Ilya Biryukov [Mon, 17 Apr 2023 12:02:48 +0000 (14:02 +0200)]
[Modules] Do not rewrite existing decls when deserializing class fields

Classes can have implicit members that were added before fields were
deserialized. These members were previously silently removed from
`decls()` when fields were deserialized after them.

This was the root cause of a compilation error exposed in
bc95f27337c7ed77c28e713c855272848f01802a, added a test for it.

Reviewed By: ChuanqiXu

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

15 months ago[ValueTracking] Use SmallPtrSetImpl (NFC)
Nikita Popov [Tue, 18 Apr 2023 10:36:51 +0000 (12:36 +0200)]
[ValueTracking] Use SmallPtrSetImpl (NFC)

Don't hardcode set size in function signature.

15 months ago[CostModel][X86] Add more thorough BSWAP test coverage
Simon Pilgrim [Mon, 17 Apr 2023 22:05:07 +0000 (23:05 +0100)]
[CostModel][X86] Add more thorough BSWAP test coverage

Replace the existing tests with more complete coverage for all cost model kinds

15 months ago[CostModel][X86] Add BITREVERSE cost model estimations
Simon Pilgrim [Mon, 17 Apr 2023 21:23:29 +0000 (22:23 +0100)]
[CostModel][X86] Add BITREVERSE cost model estimations

Use a modified version of the D103695 script to determine more accurate throughput/latency/codesize/size-latency cost estimates

15 months ago[InstCombine] Don't reassociate GEPs for loop invariance
Nikita Popov [Tue, 11 Apr 2023 08:46:20 +0000 (10:46 +0200)]
[InstCombine] Don't reassociate GEPs for loop invariance

Since D146813, LICM will reassociate GEPs to expose hoisting
opportunities itself. Don't perform this transform in InstCombine,
where it is fragile because it depends on an optional LoopInfo
analysis.

15 months ago[clang] Return std::unique_ptr<TargetInfo> from AllocateTarget
Stoorx [Tue, 18 Apr 2023 09:54:40 +0000 (09:54 +0000)]
[clang] Return std::unique_ptr<TargetInfo> from AllocateTarget

In file 'clang/lib/Basic/Targets.cpp' the function 'AllocateTarget' had a raw pointer as a return type, which have been wrapped in the 'std::unique_ptr' in all usages.
This commit changes the signature of the function to return an instance of 'std::unique_ptr' directly.

Reviewed By: DavidSpickett

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

15 months ago[mlir][llvm] Handle invoke op branching to block with its result as an argument
Victor Perez [Fri, 14 Apr 2023 08:54:38 +0000 (09:54 +0100)]
[mlir][llvm] Handle invoke op branching to block with its result as an argument

In LLVM, having an invoke instruction branching to a block with a phi
node receiving the invoke instruction result as an argument is
perfectly legal. However, the translation of this construct to MLIR
would result in an invoke with its result being used as a block
argument to a successor, i.e., the operation result would be used in
its definition.

In order to fix this issue due to different IR structures (phi nodes
vs block arguments), this construct is interpreted with an llvm.invoke
operation branching to a dummy block having a single llvm.br operation
passing the required block arguments (including the result of the
llvm.invoke operation) to the actual successor block.

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

15 months ago[LV] Regenerate test checks (NFC)
Nikita Popov [Tue, 18 Apr 2023 09:52:12 +0000 (11:52 +0200)]
[LV] Regenerate test checks (NFC)

15 months agoFix uninitialized pointer members in MC
Akshay Khadse [Tue, 18 Apr 2023 09:32:18 +0000 (17:32 +0800)]
Fix uninitialized pointer members in MC

Reviewed By: LuoYuanke

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