platform/upstream/llvm.git
16 months ago[LogicCombine 1/?] Implement a general way to simplify logical operations.
chenglin.bi [Thu, 2 Mar 2023 12:45:54 +0000 (20:45 +0800)]
[LogicCombine 1/?] Implement a general way to simplify logical operations.

This patch involves boolean ring to simplify logical operations. We can treat `&` as ring multiplication and `^` as ring addition.
So we need to canonicalize all other operations to `*` `+`. Like:
```
a & b -> a * b
a ^ b -> a + b
~a -> a + 1
a | b -> a * b + a + b
c ? a : b -> c * a + (c + 1) * b
```
In the code, we use a mask set to represent an expression. Every value that is not comes from logical operations could be a bit in the mask.
The mask itself is a multiplication chain. The mask set is an addiction chain.
We can calculate two expressions based on boolean algebras.

For now, the initial patch only enabled on and/or/xor,  Later we can enhance the code step by step.

Reference: https://en.wikipedia.org/wiki/Boolean_ring

Reviewed By: spatel

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

16 months ago[MCA] Fix crash in `EntryStage::cycleEnd` when there are no instructions.
Clement Courbet [Thu, 2 Mar 2023 12:34:43 +0000 (13:34 +0100)]
[MCA] Fix crash in `EntryStage::cycleEnd` when there are no instructions.

16 months ago[AArch64] NFC: Add missing CHECK lines for sme-aarch64-svcount.ll test
Sander de Smalen [Thu, 2 Mar 2023 12:20:53 +0000 (12:20 +0000)]
[AArch64] NFC: Add missing CHECK lines for sme-aarch64-svcount.ll test

16 months ago[clangd] Use the normalized file path to do the filtering.
Haojian Wu [Thu, 2 Mar 2023 12:31:04 +0000 (13:31 +0100)]
[clangd] Use the normalized file path to do the filtering.

This is an oversight, where we normalized the path, but we didn't use it
in the filtering.

16 months agoAMDGPU: Add more flat scratch load and store tests for 8 and 16-bit types
Petar Avramovic [Wed, 1 Mar 2023 18:00:04 +0000 (19:00 +0100)]
AMDGPU: Add more flat scratch load and store tests for 8 and 16-bit types

Add tests for more complicated scratch load and store patterns.
Includes:
- sign and zero extending loads of i8 and i16 to i32 into 32-bit register
- D16 instructions that affect only high or low 16 bits of 32-bit register
 - D16 sign and zero extending loads of i8 to i16 into high or low 16 bits
   of 32-bit register
 - D16 loads of i16 to high or low 16 bits of 32-bit register
 - D16 stores of i8 and i16 from high 16 bits of 32-bit register

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

16 months ago[AArch64][SME2] Add CodeGen support for target("aarch64.svcount").
Sander de Smalen [Thu, 2 Mar 2023 11:46:10 +0000 (11:46 +0000)]
[AArch64][SME2] Add CodeGen support for target("aarch64.svcount").

This patch adds AArch64 CodeGen support such that the type can be passed
and returned to/from functions, and also adds support to use this type in
load/store operations and PHI nodes.

Reviewed By: paulwalker-arm

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

16 months ago[C++20][ClangTidy] Update the ClangTidy tests to also test in C++20 mode
Utkarsh Saxena [Tue, 21 Feb 2023 14:24:11 +0000 (15:24 +0100)]
[C++20][ClangTidy] Update the ClangTidy tests to also test in C++20 mode

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

16 months ago[mlir][llvm] Use interfaces in the translation to LLVMIR.
Tobias Gysi [Thu, 2 Mar 2023 11:55:57 +0000 (12:55 +0100)]
[mlir][llvm] Use interfaces in the translation to LLVMIR.

The revision consistently uses the AliasAnalysisOp and AccessGroupOp
interfaces in the translation from MLIR to LLVMIR. It thus drops the
last string based lookups of alias scope and access group attributes.

Depends on D144851

Reviewed By: Dinistro

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

16 months agoRevert "[SCEV] Add SCEVType to represent `vscale`."
Paul Walker [Thu, 2 Mar 2023 11:59:50 +0000 (11:59 +0000)]
Revert "[SCEV] Add SCEVType to represent `vscale`."

This reverts commit 7912f5cc92f65ad0d3c705f3683a0b69dbedcc57.

16 months ago[SCEV] Add SCEVType to represent `vscale`.
Paul Walker [Mon, 27 Feb 2023 14:49:32 +0000 (14:49 +0000)]
[SCEV] Add SCEVType to represent `vscale`.

This is part of an effort to remove ConstantExpr based
representations of `vscale` so that its LangRef definiton can
be relaxed to accommodate a less strict definition of constant.

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

16 months ago[Support] Implement findModulesAndOffsets on Apple 64-bit platforms
Luís Marques [Thu, 2 Mar 2023 10:39:56 +0000 (10:39 +0000)]
[Support] Implement findModulesAndOffsets on Apple 64-bit platforms

To have line number information in stack traces (per stack frame) it's
necessary to implement findModulesAndOffsets.

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

16 months ago[GlobalOpt] Use more specific type (NFC)
Nikita Popov [Thu, 2 Mar 2023 10:45:27 +0000 (11:45 +0100)]
[GlobalOpt] Use more specific type (NFC)

SRA always works on GlobalVariables.

16 months ago[llvm-exegesis] Include more specific header (NFC)
Nikita Popov [Thu, 2 Mar 2023 10:23:42 +0000 (11:23 +0100)]
[llvm-exegesis] Include more specific header (NFC)

16 months agoRevert "[clang][Interp] Implement C++ Range-for loops"
Timm Bäder [Thu, 2 Mar 2023 09:23:48 +0000 (10:23 +0100)]
Revert "[clang][Interp] Implement C++ Range-for loops"

This reverts commit bce8b3c1830434c10b8a30380db522d7c6a8658d.

This commit breaks memory-sanitizer builds:
https://lab.llvm.org/buildbot/#/builders/5/builds/31899

16 months ago[bazel] Add missing dep for llvm-c-test
Haojian Wu [Thu, 2 Mar 2023 10:01:54 +0000 (11:01 +0100)]
[bazel] Add missing dep for llvm-c-test

16 months ago[bazel] Port for f7ca01333214f934c580c162afdee933e7430b6c
Haojian Wu [Thu, 2 Mar 2023 09:38:41 +0000 (10:38 +0100)]
[bazel] Port for f7ca01333214f934c580c162afdee933e7430b6c

16 months ago[mlir][nfc] Clean-up ConvertToDestinationStyle.cpp.
Alexander Belyaev [Thu, 2 Mar 2023 09:26:31 +0000 (10:26 +0100)]
[mlir][nfc] Clean-up ConvertToDestinationStyle.cpp.

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

16 months ago[DebugInfo] Remove `dbg.addr` from IR
J. Ryan Stinnett [Sat, 25 Feb 2023 22:44:04 +0000 (22:44 +0000)]
[DebugInfo] Remove `dbg.addr` from IR

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo] Remove `dbg.addr` from CodeGen
J. Ryan Stinnett [Sat, 25 Feb 2023 22:17:28 +0000 (22:17 +0000)]
[DebugInfo] Remove `dbg.addr` from CodeGen

As part of this work, removing `SDDbgValue::clearIsEmitted` originally added for
`dbg.addr` in 045c67769d7fe577fc38cccb6fb40fd814437447 was attempted, but it
appears some tests for `DBG_INSTR_REF` now depend on that behaviour as well, so
it was kept and comments were updated instead.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo] Remove `dbg.addr` from Analysis
J. Ryan Stinnett [Sat, 25 Feb 2023 21:29:44 +0000 (21:29 +0000)]
[DebugInfo] Remove `dbg.addr` from Analysis

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo] Remove `dbg.addr` from llvm-reduce
J. Ryan Stinnett [Sat, 25 Feb 2023 21:04:49 +0000 (21:04 +0000)]
[DebugInfo] Remove `dbg.addr` from llvm-reduce

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo] Remove `dbg.addr` from Transforms
J. Ryan Stinnett [Sat, 25 Feb 2023 20:59:04 +0000 (20:59 +0000)]
[DebugInfo] Remove `dbg.addr` from Transforms

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo] Remove `dbg.addr` from MLIR
J. Ryan Stinnett [Sat, 18 Feb 2023 22:59:35 +0000 (22:59 +0000)]
[DebugInfo] Remove `dbg.addr` from MLIR

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo] Remove `dbg.addr` from Coroutines
J. Ryan Stinnett [Sat, 18 Feb 2023 22:48:03 +0000 (22:48 +0000)]
[DebugInfo] Remove `dbg.addr` from Coroutines

This removes `dbg.addr` support from the Coroutines transform. This effectively
reverts the `dbg.addr`-only portions of 19279ffc77b8d224c447d4eb0ee0c727ab64babf
and 0b647fc5299156bf83c46aa539d6c9c39647bb36.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo][NFC] Remove `FuncArgumentDbgValueKind::Addr` from SelectionDAG
J. Ryan Stinnett [Sat, 18 Feb 2023 22:16:42 +0000 (22:16 +0000)]
[DebugInfo][NFC] Remove `FuncArgumentDbgValueKind::Addr` from SelectionDAG

This removes the unused `FuncArgumentDbgValueKind::Addr` value originally added
by e24f5348798605a799c63ff09169d177d262cd37. The intent was to signal the
original intrinsic that marked a function argument, but the `Addr` part was
never used.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo] Upgrade `dbg.addr` to `dbg.value`
J. Ryan Stinnett [Sun, 29 Jan 2023 00:59:33 +0000 (00:59 +0000)]
[DebugInfo] Upgrade `dbg.addr` to `dbg.value`

As part of removing `dbg.addr`, this upgrades any calls to `dbg.value` with
`DW_OP_deref` prepended onto the value expression.

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[DebugInfo][Docs] Remove `dbg.addr` from docs
J. Ryan Stinnett [Sat, 18 Feb 2023 23:13:44 +0000 (23:13 +0000)]
[DebugInfo][Docs] Remove `dbg.addr` from docs

Part of `dbg.addr` removal
Discussed in https://discourse.llvm.org/t/what-is-the-status-of-dbg-addr/62898

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

16 months ago[mlir][llvm] Add AliasAnalysis and AccessGroup interfaces to intrinsics.
Tobias Gysi [Thu, 2 Mar 2023 09:12:43 +0000 (10:12 +0100)]
[mlir][llvm] Add AliasAnalysis and AccessGroup interfaces to intrinsics.

This revision updates the memcpy, memove, and memset intrinsics to
implement the AliasAnalysis and AccessGroup interfaces. The changes
will enable the import and export of alias scope, tbaa, and
access group metadata attached to these intrinsics. It also
renames the requiresAliasScope flag to requiresAliasAnalysis since
the intrinsics also support tbaa and not only access scope metadata.

The revision still maintains the string based attribute lookup
in the translation from MLIR to LLVMIR. Using the interfaces
instead of the string based lookup is left to a followup revision.

Depends on D144851

Reviewed By: Dinistro

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

16 months ago[mlir][linalg] Vectorize tensor.extract using contiguous loads
Andrzej Warzynski [Wed, 1 Mar 2023 15:44:01 +0000 (15:44 +0000)]
[mlir][linalg] Vectorize tensor.extract using contiguous loads

This patch implements vectorization of tensor.extract for n-D tensor (n
>= 2) using contiguous load operations, i.e. `vector.transfer_read`. This
is a follow-up of https://reviews.llvm.org/D137660 in which gather loads
were used, i.e. `vector.gather`.

It is always safe to use gather load operations when the underlying
memory pattern is contiguous, but not vice-verse. At the moment, the
following conditions have to be met for contiguous loads to be
generated:
  1. The _output tensor_ must be a 1-D vector with the trailing dim > 1,
     e.g. `tensor<1x1x4xi32`,
  2. The trailing dim in the _input tensor_ must be > 1, e.g.
     `tensor<1x1x4i32>` would be fine, but not `tensor<1x4x1xi32>`.
If these conditions are not satisfied, gather loads are generated
instead.

Condition 1 guarantees that the iteration space of the corresponding
`linalg.generic` Op is relatively simple. That makes analysing the
indices for `tensor.extract` rather straightforward.

Condition 2 is mostly there to avoid weird vectorisation patterns
resulting in vectors like: `vector<1x1x1xi32>`. In practice, tensors
like `tensor<1x4x1xi32>` should be collapsed to `tensor<1x4xi32>` before
vectorisation, but that's beyond the scope of this patch.

If needed, both conditions can be relaxed. I've not been able to find a
good motivating example for these, hence skipping. For reference,
`tosa.resize` (lowered to Linalg) was the driving example used here.

As a bonus, the test from "vectorization-unsupported.mlir" is moved to
"vectorization.mlir" with proper CHECK lines added.

NOTE: This relands 89b144ece330b363713bec369d2d89dc85f715f5 (added extra
test, refined comments and variable names).

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

Co-authored-by: Diego Caballero <diegocaballero@google.com>
16 months ago[Coverage] Fix an issue: a statement after calling 'assert()' function is wrongly
Ying Yi [Fri, 17 Feb 2023 11:42:20 +0000 (11:42 +0000)]
[Coverage] Fix an issue: a statement after calling 'assert()' function is wrongly
marked as 'not executed'.

In the current coverage mapping implementation, we terminate the current region
and start a zero region when we hit a nonreturn function. However, for logical OR,
the second operand is not executed if the first operand evaluates to true. If the
nonreturn function is called in the right side of logical OR and the left side of
logical OR is TRUE, we should not start a zero `GapRegionCounter`. This will also
apply to `VisitAbstractConditionalOperator`.

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

Reviewed By: zequanwu

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

16 months ago[GlobalOpt] Extend CleanupPointerRootUsers to handle CE users.
Florian Hahn [Thu, 2 Mar 2023 09:12:23 +0000 (10:12 +0100)]
[GlobalOpt] Extend CleanupPointerRootUsers to handle CE users.

Extend CleanupPointerRootUsers to iterate over a worklist, add users of
constant expressions to the worklist to enable additional cleanups.

Reviewed By: nikic

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

16 months ago[mlir][Transform] Fix transform::SequenceOp builder
Nicolas Vasilache [Thu, 2 Mar 2023 09:06:18 +0000 (01:06 -0800)]
[mlir][Transform] Fix transform::SequenceOp builder

Previously, the wrond type would be used and would not matche the number of locations triggering
an assertion failures in `createBlock`.

16 months ago[clang][Interp] Handle record initialization via CastExpr
Timm Bäder [Sat, 31 Dec 2022 17:26:15 +0000 (18:26 +0100)]
[clang][Interp] Handle record initialization via CastExpr

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

16 months ago[Clang] Implement Change scope of lambda trailing-return-type
Corentin Jabot [Sun, 6 Feb 2022 21:58:43 +0000 (22:58 +0100)]
[Clang] Implement Change scope of lambda trailing-return-type

This implements P2036R3 and P2579R0.
That is, explicit, int, and implicit capture become visible
at the start of the parameter head.

Reviewed By: aaron.ballman, rupprecht, shafik

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

16 months ago[UTC] Include return type/attributes under --version 2
Nikita Popov [Tue, 24 Jan 2023 14:32:31 +0000 (15:32 +0100)]
[UTC] Include return type/attributes under --version 2

If --function-signature is used with --version 2, then also include
the return type/attributes in the check lines. This is the
implementation of D133943 rebased on the --version mechanism from
D142473.

This doesn't bump the default version yet, because I'd like to do
that together with D140212 (which enables --function-signature by
default), as these changes seem closely related. For now this
functionality can be accessed by explicitly passing --version 2
to UTC.

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

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

16 months ago[llvm-c] Remove bindings for creating legacy passes
Nikita Popov [Tue, 28 Feb 2023 15:38:45 +0000 (16:38 +0100)]
[llvm-c] Remove bindings for creating legacy passes

Legacy passes are only supported for codegen, and I don't believe
it's possible to write backends using the C API, so we should drop
all of those. Reduces the number of places that need to be modified
when removing legacy passes.

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

16 months agoRecommit "[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable to...
Noah Goldstein [Thu, 2 Mar 2023 08:34:41 +0000 (02:34 -0600)]
Recommit "[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable to shuffles." (2nd Try)

Move the opcode checks to after we have already verified we found a
valid shift instruction (`0 < ShiftAmt`) in `matchUnaryPermuteShuffle`
and `lowerShuffleAsShift`.

Reviewed By: pengfei, RKSimon

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

16 months ago[clang][Interp] Add ArrayElemPtr{,Pop} opcode
Timm Bäder [Sat, 31 Dec 2022 16:06:52 +0000 (17:06 +0100)]
[clang][Interp] Add ArrayElemPtr{,Pop} opcode

We usually access array elements in the same pattern, which uses
narrow(). Add an extra opcode for this. This saves us quite some
instructions and makes the bytecode easier to read.

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

16 months agoRevert "[SelectionDAG] Transitively copy NodeExtraInfo on RAUW"
Marco Elver [Thu, 2 Mar 2023 08:24:25 +0000 (09:24 +0100)]
Revert "[SelectionDAG] Transitively copy NodeExtraInfo on RAUW"

This reverts commit 7f635b90e7bdf1378fd9a65fc62b99e8e07d4aaf.

The current implementation causes pathological slowdowns in certain
cases: https://github.com/llvm/llvm-project/issues/61108

16 months ago[clang][Interp] Only check constructors for global variables
Timm Bäder [Wed, 28 Dec 2022 10:43:26 +0000 (11:43 +0100)]
[clang][Interp] Only check constructors for global variables

Local variables may be partially initialized.

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

16 months ago[clang][Interp] Implement C++ Range-for loops
Timm Bäder [Sat, 31 Dec 2022 15:14:33 +0000 (16:14 +0100)]
[clang][Interp] Implement C++ Range-for loops

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

16 months ago[mlir][Linalg] NFC - Improve debug messages for padding
Nicolas Vasilache [Thu, 2 Mar 2023 07:54:21 +0000 (23:54 -0800)]
[mlir][Linalg] NFC - Improve debug messages for padding

16 months ago[LLDB] XFAIL TestRunLocker.py for windows
Muhammad Omair Javaid [Thu, 2 Mar 2023 07:51:30 +0000 (11:51 +0400)]
[LLDB] XFAIL TestRunLocker.py for windows

TestRunLocker.py is failing on windows x64 and AArch64 buildbots.
Buildbot log suggests that test needs some minor modification for
windows which I will do later.

https://lab.llvm.org/buildbot/#/builders/83/builds/29680
https://lab.llvm.org/buildbot/#/builders/219/builds/942

16 months ago[flang] Use the newly introduced AliasAnalysisOpInterface.
Tobias Gysi [Thu, 2 Mar 2023 07:32:30 +0000 (08:32 +0100)]
[flang] Use the newly introduced AliasAnalysisOpInterface.

This revision uses the AliasAnalysisOpInterface introduced in
https://reviews.llvm.org/D144851 to set the tbaa attributes
of load and store ops. With the attribute it is also possible to
set the attribute on atomics as well as on memcopy and
memove intrinsics as soon as https://reviews.llvm.org/D144965
lands.

Reviewed By: vzakhari

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

16 months agoRevert "[LLDB] XFAIL TestRunLocker.py on Windows"
Muhammad Omair Javaid [Thu, 2 Mar 2023 07:22:08 +0000 (11:22 +0400)]
Revert "[LLDB] XFAIL TestRunLocker.py on Windows"

This reverts commit 9d28e00e741cb19684111656803434aceef4c2a0.

16 months ago[clang][Interp] Handle defined functions without a body
Timm Bäder [Fri, 30 Dec 2022 10:50:48 +0000 (11:50 +0100)]
[clang][Interp] Handle defined functions without a body

This happens when explicitly defaulting a constructor, for example.

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

16 months ago[llvm][GenericUniformity] Prevent assert while calculating temporal divergence
Yashwant Singh [Thu, 2 Mar 2023 07:08:52 +0000 (12:38 +0530)]
[llvm][GenericUniformity] Prevent assert while calculating temporal divergence

analyzeTemporalDivergence() was missing the check for always-uniform before
evaluating weather an instruction depends on a value defined in the cycle.
Fix for #60638
https://github.com/llvm/llvm-project/issues/60638

Reviewed By: sameerds, foad, #amdgpu

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

16 months ago[LLDB] XFAIL TestRunLocker.py on Windows
Muhammad Omair Javaid [Thu, 2 Mar 2023 07:05:11 +0000 (11:05 +0400)]
[LLDB] XFAIL TestRunLocker.py on Windows

16 months ago[x86] Precommit a test
Kazu Hirata [Thu, 2 Mar 2023 07:03:39 +0000 (23:03 -0800)]
[x86] Precommit a test

This patch precommits a test for:

https://github.com/llvm/llvm-project/issues/60802

16 months ago[clang][Interp] Implement remaining MaterializeTemporaryExpr bits
Timm Bäder [Mon, 26 Dec 2022 08:18:56 +0000 (09:18 +0100)]
[clang][Interp] Implement remaining MaterializeTemporaryExpr bits

As well as support for CompoundLiteralExprs.

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

16 months agoELF: Respect MEMORY command when specified without a SECTIONS command.
Peter Collingbourne [Thu, 2 Mar 2023 00:54:24 +0000 (16:54 -0800)]
ELF: Respect MEMORY command when specified without a SECTIONS command.

We were previously ignoring the MEMORY command unless SECTIONS was also
specified. Fix it.

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

16 months ago[llvm-lib] 'llvm-lib' currently cannot generate an import library from a Windows
Vadim Paretsky (Intel Americas Inc) [Thu, 2 Mar 2023 04:32:35 +0000 (20:32 -0800)]
[llvm-lib] 'llvm-lib' currently cannot generate an import library from a Windows
.def file, functionality supported by 'lib'. This incompatibility is
breaking clang based Windows openmp builds. This revision adds
basic support for this feature to llvm-lib by cloning the corresponding
code from 'dlltool'.

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

16 months agoRevert D143786 "[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable...
Fangrui Song [Thu, 2 Mar 2023 03:08:55 +0000 (19:08 -0800)]
Revert D143786 "[X86] Add `TuningPreferShiftShuffle` for when Shifts are preferable to shuffles."

This reverts commit a98ee27416916c3f8af4cd229e0a633423d6d9a3.
It caused MemorySanitizer use-of-uninitialized-value in matchUnaryPermuteShuffle.

16 months ago[libcxx][NFC] Added a note about the P2520R0
Shivam kunwar [Thu, 2 Mar 2023 02:28:15 +0000 (07:58 +0530)]
[libcxx][NFC] Added a note about the P2520R0

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

16 months ago[libc++] [FreeBSD] correct 64-bit test
Ed Maste [Wed, 1 Mar 2023 23:39:29 +0000 (18:39 -0500)]
[libc++] [FreeBSD] correct 64-bit test

Using __SIZEOF_LONG__ == 8 rather than __LP64__ is needed so we use umtx
on CHERI.  I accidentally landed an older diff.

Fixes: 17ecbb3ea6ff0ae716dd524c0e2bf75a4815c95b

16 months ago[memprof] Avoid meaningless pod copy
Wu, Yingcong [Thu, 2 Mar 2023 01:36:37 +0000 (01:36 +0000)]
[memprof] Avoid meaningless pod copy

The pointer `Buffer` is not changed, so there is no need to use reference, and the `Pod` here should use reference to avoid meaningless copy.

Reviewed By: snehasish

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

16 months ago[WebAssembly] Skip implied bitmask operation in LowerShift
Jun Ma [Thu, 23 Feb 2023 07:45:48 +0000 (15:45 +0800)]
[WebAssembly] Skip implied bitmask operation in LowerShift

This patch skips redundant explicit masks of the shift count since
it is implied inside wasm shift instruction.

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

16 months agoRevert "[MergeICmps] Adapt to non-eq comparisons, retry"
Zhongyunde [Thu, 2 Mar 2023 01:07:44 +0000 (09:07 +0800)]
Revert "[MergeICmps] Adapt to non-eq comparisons, retry"

This reverts commit 74ad19c25d7217d8f580a21d12fd4c784a1a0094.

test unittests/ProfileData/ProfileDataTests fails when built with
optimisations level -O1 with clang including this patch.

16 months ago[SPIR-V] Remove redundant check and fix typos
Michal Paszkowski [Wed, 1 Mar 2023 23:51:18 +0000 (00:51 +0100)]
[SPIR-V] Remove redundant check and fix typos

16 months ago[ExecutionEngine] Silence warnings about sprintf use in interpreter.
Lang Hames [Wed, 1 Mar 2023 23:34:23 +0000 (15:34 -0800)]
[ExecutionEngine] Silence warnings about sprintf use in interpreter.

We should review memory safety in the interpreter
(https://github.com/llvm/llvm-project/issues/58086), but for now just silence
the warnings to reduce noise.

rdar://100555195

16 months ago[ORC] Drop StaticLibraryDefinitionGenerator Load/Create overloads with triples.
Lang Hames [Wed, 22 Feb 2023 05:22:28 +0000 (21:22 -0800)]
[ORC] Drop StaticLibraryDefinitionGenerator Load/Create overloads with triples.

We can get the triple from the ExecutionSession, so clients shouldn't have to
provide it.

16 months ago[libc] add basic Intel MacOS configuration
Michael Jones [Wed, 1 Mar 2023 19:35:40 +0000 (11:35 -0800)]
[libc] add basic Intel MacOS configuration

The config is based on the ARM MacOS config, but with fenv and math
functions disabled.

This should unblock this bug: https://github.com/llvm/llvm-project/issues/60910

Reviewed By: sivachandra

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

16 months ago[RegAllocFast] insert additional spills along indirect edges of INLINEASM_BR
Nick Desaulniers [Wed, 1 Mar 2023 23:20:55 +0000 (15:20 -0800)]
[RegAllocFast] insert additional spills along indirect edges of INLINEASM_BR

When generating spills (stores) for values produced by INLINEASM_BR
instructions, make sure to insert one spill per indirect target.
Otherwise the reload generated may load from a stack slot that has not
yet been stored to (resulting in a load of an uninitialized stack slot).

Link: https://github.com/llvm/llvm-project/issues/53562
Fixes: https://github.com/llvm/llvm-project/issues/60855

Reviewed By: MatzeB

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

16 months agoprecommit test for pr60855
Nick Desaulniers [Mon, 27 Feb 2023 19:22:42 +0000 (11:22 -0800)]
precommit test for pr60855

This test demonstrates an issue with callbr outputs being used along
indirect edges when using regallocfast.

Link: https://github.com/llvm/llvm-project/issues/60855
Differential Revision: https://reviews.llvm.org/D144906

16 months ago[mlir][python] Remove "Raw" OpView classes
Rahul Kayaith [Mon, 23 Jan 2023 04:31:18 +0000 (23:31 -0500)]
[mlir][python] Remove "Raw" OpView classes

The raw `OpView` classes are used to bypass the constructors of `OpView`
subclasses, but having a separate class can create some confusing
behaviour, e.g.:
```
op = MyOp(...)
# fails, lhs is 'MyOp', rhs is '_MyOp'
assert type(op) == type(op.operation.opview)
```

Instead we can use `__new__` to achieve the same thing without a
separate class:
```
my_op = MyOp.__new__(MyOp)
OpView.__init__(my_op, op)
```

Reviewed By: stellaraccident

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

16 months ago[mlir][python] Allow running pass manager on any operation
rkayaith [Wed, 9 Nov 2022 03:48:26 +0000 (22:48 -0500)]
[mlir][python] Allow running pass manager on any operation

`PassManager.run` is currently restricted to running on `builtin.module`
ops, but this restriction doesn't exist on the C++ side. This updates it
to take `ir.Operation/OpView` instead of `ir.Module`.

Depends on D143354

Reviewed By: mehdi_amini

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

16 months ago[mlir][CAPI] Allow running pass manager on any operation
rkayaith [Wed, 9 Nov 2022 03:39:18 +0000 (22:39 -0500)]
[mlir][CAPI] Allow running pass manager on any operation

`mlirPassManagerRun` is currently restricted to running on
`builtin.module` ops, but this restriction doesn't exist on the C++
side. This renames it to `mlirPassManagerRunOnOp` and updates it to take
`MlirOperation` instead of `MlirModule`.

Depends on D143352

Reviewed By: mehdi_amini

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

16 months ago[mlir][python] Add generic operation parse APIs
rkayaith [Tue, 8 Nov 2022 21:55:06 +0000 (16:55 -0500)]
[mlir][python] Add generic operation parse APIs

Currently the bindings only allow for parsing IR with a top-level
`builtin.module` op, since the parse APIs insert an implicit module op.
This change adds `Operation.parse`, which returns whatever top-level op
is actually in the source.

To simplify parsing of specific operations, `OpView.parse` is also
added, which handles the error checking for `OpView` subclasses.

Reviewed By: ftynse, stellaraccident

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

16 months ago[mlir][AsmParser] Improve parse{Attribute,Type} error handling
Rahul Kayaith [Sat, 25 Feb 2023 07:30:46 +0000 (02:30 -0500)]
[mlir][AsmParser] Improve parse{Attribute,Type} error handling

Currently these functions report errors directly to stderr, this updates
them to use diagnostics instead. This also makes partially-consumed
strings an error if the `numRead` parameter isn't provided (the
docstrings already claimed this happened, but it didn't.)

While here I also tried to reduce the number of overloads by switching
to using default parameters.

Reviewed By: rriddle

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

16 months ago[NFC][Pipeline] Move PromotePass into GlobalCleanupPM
Arthur Eubanks [Wed, 1 Mar 2023 21:21:04 +0000 (13:21 -0800)]
[NFC][Pipeline] Move PromotePass into GlobalCleanupPM

16 months ago[OpenMP][NFC] Clean up Twines and other issues in plugins
Joseph Huber [Wed, 1 Mar 2023 21:02:00 +0000 (15:02 -0600)]
[OpenMP][NFC] Clean up Twines and other issues in plugins

Summary:
Tihs patch is mostly NFC to fix some warning currently present in OpenMP
offloading plugins. Specifically this mostly removes the use of Twine
variables in favor of LLVM's small string. Twine variables are prone to
use-after-free and this is a cleaner way to concatenate a string.

16 months ago[llvm][LowerConstantIntrinsics] add debug statements
Nick Desaulniers [Wed, 1 Mar 2023 20:58:13 +0000 (12:58 -0800)]
[llvm][LowerConstantIntrinsics] add debug statements

These can help us better understand what __builtin_constant_p and
__builtin_object_size get folded to.

$ clang -mllvm -debug-only=lower-is-constant-intrinsic ...

Reviewed By: void

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

16 months ago[libc] Fix mismatch in exception decl
Jeff Bailey [Wed, 1 Mar 2023 20:55:59 +0000 (20:55 +0000)]
[libc] Fix mismatch in exception decl

When running the libc tests under vscode, I got an error about a
mismatches exception declaration for strerror.  Since string.h
seems to be getting included transitively anyway, just include
it and rely on its definition.

Reviewed By: michaelrj

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

16 months ago[mlir][sparse] support coiteration with fused reshape tensor
Peiming Liu [Wed, 1 Mar 2023 19:03:02 +0000 (19:03 +0000)]
[mlir][sparse] support coiteration with fused reshape tensor

Reviewed By: aartbik

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

16 months ago[libc++] [FreeBSD] only use _umtx_op(2) on 64bit arches
Konstantin Belousov [Fri, 20 Jan 2023 23:32:11 +0000 (18:32 -0500)]
[libc++] [FreeBSD] only use _umtx_op(2) on 64bit arches

Only 64bit architectures can be supported this way, because libcxx
defines __cxx_contention_t to be int64_t for FreeBSD, and 32bit
arches do not have a kind of UMTX_OP_WAIT_INT64_PRIVATE operation.

Fixes: 83387dbc18e7998f87aa4a2d35320bcb2ed5c392

Reviewed by: arichardson, ldionne, emaste, Mordante
Differential Revision: https://reviews.llvm.org/D142422

16 months ago[Flang][Tool][bbc] Emit module wrapper in addition to body
Andrew Gozillon [Wed, 1 Mar 2023 20:32:54 +0000 (14:32 -0600)]
[Flang][Tool][bbc] Emit module wrapper in addition to body

This change seeks to emit the full module from the bbc tool and
not just the body. This change currently does not break existing tests
when running check-(mlir, flang, all). This stops the discarding of
any attributes that may be applied to the Module during
compilation.

Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D144869

16 months ago[libc++] Use generic-cxx20 instead of apple-cxx20 on Apple CI
Louis Dionne [Wed, 1 Mar 2023 20:25:29 +0000 (15:25 -0500)]
[libc++] Use generic-cxx20 instead of apple-cxx20 on Apple CI

apple-cxx20 is equivalent to generic-cxx20, so we don't need it anymore.
It had been introduced when clang-tidy was enabled explicitly from
run-buildbot, but that's not needed anymore since clang-tidy is
enabled from the buildkite pipeline definition.

16 months ago[libc++][NFC] Remove trailing whitespace on line and clang-format
Louis Dionne [Wed, 1 Mar 2023 20:11:44 +0000 (15:11 -0500)]
[libc++][NFC] Remove trailing whitespace on line and clang-format

This broke the CI after 813e1da974 was checked in.

16 months ago[Libomptarget] Fix block and thread limit environment variables not being respected
Joseph Huber [Wed, 1 Mar 2023 20:02:40 +0000 (14:02 -0600)]
[Libomptarget] Fix block and thread limit environment variables not being respected

The next-gen plugins did not properly set the values from
`OMP_NUM_TEAMS` and `OMP_TEAMS_THREAD_LIMIT`. This is because these
maximum values are set by each plugin to its hardware maximum. This
happens *after* the previous initialization. Move it to the correct
place and then add a test.

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

Reviewed By: tianshilei1992

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

16 months ago[AArch64] Precommit some more LD1R splat tests for scalar int/fp loads
Sjoerd Meijer [Wed, 1 Mar 2023 14:43:35 +0000 (14:43 +0000)]
[AArch64] Precommit some more LD1R splat tests for scalar int/fp loads

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

16 months ago[flang] Check for BIND(C) through use association.
Slava Zakharin [Wed, 1 Mar 2023 16:42:22 +0000 (08:42 -0800)]
[flang] Check for BIND(C) through use association.

If the interface specifies BIND(C), then the declarations using
this interface inherit BIND(C), and if they are referenced via use
association they must be classified as BIND(C) subprograms.

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

16 months ago[libc++] Refactor the std/depr C headers tests
Louis Dionne [Wed, 1 Mar 2023 19:45:17 +0000 (14:45 -0500)]
[libc++] Refactor the std/depr C headers tests

Move multiple tests to .compile.pass.cpp when they were not running
anything and reindent a bit more consistently.

16 months ago[llvm] Prevent building for riscv32-unknown-fuchsia
Leonard Chan [Wed, 1 Mar 2023 19:42:15 +0000 (19:42 +0000)]
[llvm] Prevent building for riscv32-unknown-fuchsia

Fuchsia is exclusively 64-bit so this throw an error when using this
triple.

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

16 months ago[MLIR] Add `print-ir` pass for debugging purposes
Frederik Gossen [Wed, 1 Mar 2023 19:33:49 +0000 (14:33 -0500)]
[MLIR] Add `print-ir` pass for debugging purposes

Add pass to print the entire IR on the debug stream.
This is meant for debugging purposes to inspect the IR at a specific point in the pipeline.

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

16 months ago[flang] Move fir.select_type into the PolymorphicOpConversion pass
Renaud-K [Mon, 27 Feb 2023 22:39:18 +0000 (14:39 -0800)]
[flang] Move fir.select_type into the PolymorphicOpConversion pass
https://reviews.llvm.org/D144921

16 months ago[DivRemPairs] Remove legacy pass
Fangrui Song [Wed, 1 Mar 2023 19:16:18 +0000 (11:16 -0800)]
[DivRemPairs] Remove legacy pass

Following recent changes to remove non-core legacy passes.

16 months ago[LLDB] Expose several methods in SBWatchpoint
Dan Liew [Tue, 28 Feb 2023 01:05:19 +0000 (17:05 -0800)]
[LLDB] Expose several methods in SBWatchpoint

This patch adds the following methods:

* `GetType()`
* `GetWatchValueKind()`
* `GetWatchSpec()`
* `IsWatchingReads()`
* `IsWatchingWrites()`

These mostly expose methods that `lldb_private::Watchpoint` already
had. Tests are included that exercise these new methods.

The motivation for exposing these are as follows:

* `GetType()` - With this information and the address from a watchpoint
  it is now possible to construct an SBValue from an SBWatchpoint.
  Previously this wasn't possible. The included test case illustrates
  doing this.
* `GetWatchValueKind()` - This allows the caller to determine whether the
  watchpoint is a variable watchpoint or an expression watchpoint. A new
  enum (`WatchpointValueKind`) has been introduced to represent the
  return values. Unfortunately the name `WatchpointKind` was already
  taken.
* `GetWatchSpec()` - This allows (at least for variable watchpoints)
  to use a sensible name for SBValues created from an SBWatchpoint.
* `IsWatchingReads()` - This allow checking if a watchpoint is
  monitoring read accesses.
* `IsWatchingWRites()` - This allow checking if a watchpoint is
  monitoring write accesses.

rdar://105606978

Reviewers: jingham, mib, bulbazord, jasonmolenda, JDevlieghere

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

16 months ago[lld] [MTE] Add DT_AARCH64_MEMTAG_* dynamic entries, and small cleanup
Mitch Phillips [Wed, 1 Mar 2023 19:00:49 +0000 (11:00 -0800)]
[lld] [MTE] Add DT_AARCH64_MEMTAG_* dynamic entries, and small cleanup

Adds the new AArch64-ABI dynamic entry generation to LLD. This will
allow Android to move from the Android-specific ELF note onto the
dynamic entries.

Change the behaviour of an unspecified --android-memtag-mode. Now, when
unspecified, this will print a warning that you're doing a no-op, rather
than implicitly turning on sync mode. This is important for MTE globals
later, where a binary containing static tagged global descriptors
shouldn't have MTE turned on without specific intent being passed to the
linker.

For now, continue to emit the Android ELF note by default. In future, we
can probably make it only emit the note when provided a flag.

Do a quick NFC-cleanup of the ELF note while we're here. It doesn't
change anything about the ELF note itself, but makes it more clear to
the reader of the code what alignment requirements are being (previously
implicitly) met.

Reviewed By: fmayer, MaskRay

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

16 months ago[Sanitizers] Error out for -static-libsan on darwin
usama hameed [Wed, 1 Mar 2023 19:07:03 +0000 (00:07 +0500)]
[Sanitizers] Error out for -static-libsan on darwin
since it is not supported

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

16 months ago[mlir][sparse] fuse collapse_shape on sparse tensor with GenericOp.
Peiming Liu [Mon, 27 Feb 2023 22:40:34 +0000 (22:40 +0000)]
[mlir][sparse] fuse collapse_shape on sparse tensor with GenericOp.

Instead of always materializing a new sparse tensor after reshape, this patch tries to fuses the reshape (currently only on COO) with GenericOp and coiterates with the reshaped tensors without allocating a new sparse tensor.

Reviewed By: aartbik

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

16 months ago[mlir][spirv] Support shaped types with index element
Jakub Kuderski [Wed, 1 Mar 2023 19:03:17 +0000 (14:03 -0500)]
[mlir][spirv] Support shaped types with index element

This makes the SPIR-V type converter first convert `index` element types
to the right integer type.

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

Reviewed By: antiagainst

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

16 months ago[DAG] expandIntMINMAX - attempt to match existing SETCC node
Simon Pilgrim [Wed, 1 Mar 2023 19:03:56 +0000 (19:03 +0000)]
[DAG] expandIntMINMAX - attempt to match existing SETCC node

As noticed on D144789, when we have pairs of min/max nodes we often end up with multiple comparisons which we could reuse with commuted select ops, so check to see if a suitable SETCC already exists. This also allowed us to remove a similar X86 peephole.

There are other getSETCC cases where we could safely reuse other CondCodes as well - I've been trying to think of how we could reuse this logic in SelectionDAG but haven't found anything that always works well.

An alternative would be to have a TLI callback that returns a preferred CondCode from a list of options, I've noticed this helped fpclamptosat tests on some other targets (MVE + WebAssembly), but other tests suffered.

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

16 months ago[llvm-readobj] Add --memtag
Mitch Phillips [Wed, 1 Mar 2023 18:49:39 +0000 (10:49 -0800)]
[llvm-readobj] Add --memtag

This adds functionality to readelf/readobj to specifically handle
MTE-related bits, like the AARCH64_MEMTAG_* dynamic entries, and a
decoder for the Android-specific ELF note.

Reviewed By: jhenderson, MaskRay

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

16 months ago[libc] Fix strcspn
Alex Brachet [Wed, 1 Mar 2023 18:57:07 +0000 (18:57 +0000)]
[libc] Fix strcspn

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

16 months ago[libc] Fix printf %f rounding condition
Michael Jones [Tue, 28 Feb 2023 23:10:08 +0000 (15:10 -0800)]
[libc] Fix printf %f rounding condition

When running the tbin2dec tests I found a rounding error in my code.
Upon inspection I realized it was due to a lack of parenthesis when
calculating the number of trailing digits. This patch fixes that mistake
and adds unit tests to catch regressions in future.

Reviewed By: lntue

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

16 months ago[GWP-ASan][Fuchsia] Use more modern zxtest testing macros
Alex Brachet [Wed, 1 Mar 2023 18:54:05 +0000 (18:54 +0000)]
[GWP-ASan][Fuchsia] Use more modern zxtest testing macros

16 months ago[GWP-ASan] Stop using type aliases for ::testing:: types
Alex Brachet [Wed, 1 Mar 2023 18:49:18 +0000 (18:49 +0000)]
[GWP-ASan] Stop using type aliases for ::testing:: types

16 months ago[libc++][NFC] Move test to .compile.pass.cpp since it doesn't run anything
Louis Dionne [Wed, 1 Mar 2023 18:21:01 +0000 (13:21 -0500)]
[libc++][NFC] Move test to .compile.pass.cpp since it doesn't run anything

16 months ago[libc++] implement move_iterator<T*> should be a random access iterator \n Differntia...
Shivam kunwar [Wed, 1 Mar 2023 18:11:36 +0000 (23:41 +0530)]
[libc++] implement move_iterator<T*> should be a random access iterator \n Differntial Revision- https://reviews.llvm.org/D135248

16 months ago[PhaseOrdering] add test for vector load and cast transforms; NFC
Sanjay Patel [Wed, 1 Mar 2023 17:18:44 +0000 (12:18 -0500)]
[PhaseOrdering] add test for vector load and cast transforms; NFC

issue #51397