platform/upstream/llvm.git
20 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

20 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

20 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

20 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.

20 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

20 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.

20 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.

20 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

20 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.

20 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.

20 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

20 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

20 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.

20 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

20 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

20 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.

20 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

20 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

20 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

20 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

20 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

20 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

20 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

20 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.

20 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.

20 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

20 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

20 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

20 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

20 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.

20 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

20 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

20 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.

20 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.

20 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.

20 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.

20 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

20 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.

20 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

20 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.

20 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

20 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

20 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

20 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

20 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.

20 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

20 months ago[MLIR][OpenMP] Add support for depend clause
Prabhdeep Singh Soni [Fri, 27 Jan 2023 14:53:02 +0000 (09:53 -0500)]
[MLIR][OpenMP] Add support for depend clause

This patch adds support for the OpenMP 4.0 depend clause (in, out,
inout) of the task construct to the definition of the OpenMP MLIR
dialect and translation from MLIR to LLVM IR using OMPIRBuilder.

Reviewed By: kiranchandramohan

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

20 months ago[gn] port 4e3dac6f0a4c (ScudoHooksUnitTest)
Nico Weber [Tue, 14 Feb 2023 19:13:56 +0000 (14:13 -0500)]
[gn] port 4e3dac6f0a4c (ScudoHooksUnitTest)

20 months ago[mlir][linalg] Make Linalg vectorizer lower affine.apply
Andrzej Warzynski [Mon, 6 Feb 2023 18:53:00 +0000 (18:53 +0000)]
[mlir][linalg] Make Linalg vectorizer lower affine.apply

As discussed in [1], it is possible that the input to the Linalg
vectorizer contains `affine.apply` ops. Such operations are not
vectarizable at the moment, but this can be fixed by simply converting
them to arithmetic operations. This is basically what this patch
introduces.

The IR change enabled in this patch could be part of a larger set of
"linalgOp pre-processing" transformations that happens right before
vectorization starts but after we know we can vectorize the op. I am
leaving this as a TODO.

[1] https://github.com/iree-org/iree/issues/10876

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

Co-authored-by: Thomas Raoux <thomasraoux@google.com>
20 months ago[scudo] Call __scudo_deallocate_hook on reallocations.
Guillaume Chelfi [Tue, 14 Feb 2023 18:44:37 +0000 (18:44 +0000)]
[scudo] Call __scudo_deallocate_hook on reallocations.

Scudo is expected to call __scudo_allocate_hook on allocations, and
__scudo_deallocate_hook on deallocations, but it's behavior is not
clear on reallocations. Currently, non-trivial reallocations call
__scudo_allocate_hook but never __scudo_deallocate_hook. We should
prefer either calling both, none, or a dedicated
hook (__scudo_reallocate_hook, for instance).

This patch implements the former, and adds a unit test to enforce
those expectations.

Reviewed By: Chia-hungDuan

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

20 months ago[libc][doc] Move docs/math.rst to docs/math/index.rst
Tue Ly [Tue, 14 Feb 2023 17:36:07 +0000 (12:36 -0500)]
[libc][doc] Move docs/math.rst to docs/math/index.rst

Move docs/math.rst to docs/math/index.rst

Reviewed By: michaelrj

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

20 months ago[OpenMP]Fix PR55970: Miscompile of collapse(3) with non-rectangular loop nest.
Alexey Bataev [Tue, 14 Feb 2023 15:19:45 +0000 (07:19 -0800)]
[OpenMP]Fix PR55970: Miscompile of collapse(3) with non-rectangular loop nest.

Need to assign the calculated lower bound back to temp variable,
otherwise incorrect value (upper bound instead of lower bound) might be
used.

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

20 months ago[gn build] Port 7f5d130a428f
LLVM GN Syncbot [Tue, 14 Feb 2023 18:25:58 +0000 (18:25 +0000)]
[gn build] Port 7f5d130a428f

20 months agolibclc: add clspv to targets exempt from alwaysinline
Kévin Petit [Tue, 14 Feb 2023 18:26:42 +0000 (18:26 +0000)]
libclc: add clspv to targets exempt from alwaysinline

https://reviews.llvm.org/D132362

Patch by: Aaron Greig <aaron.greig@codeplay.com>

20 months agolibclc: add generated convert.cl to clspv/clspv64 targets
Kévin Petit [Tue, 14 Feb 2023 18:23:35 +0000 (18:23 +0000)]
libclc: add generated convert.cl to clspv/clspv64 targets

https://reviews.llvm.org/D136772

Patch by: Aaron Greig <aaron.greig@codeplay.com>

20 months ago[libc++][format] Fixes test failures.
Mark de Wever [Thu, 2 Feb 2023 18:41:01 +0000 (19:41 +0100)]
[libc++][format] Fixes test failures.

Using some builds the modular build fails due to missing exports
and includes. This fixes the build.

Reviewed By: #libc, ldionne

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

20 months ago[libc++][chrono] Add hh_mm_ss formatter.
Mark de Wever [Sun, 20 Mar 2022 12:40:02 +0000 (13:40 +0100)]
[libc++][chrono] Add hh_mm_ss formatter.

Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters
- P1466 Miscellaneous minor fixes for chrono

Depends on D137022

Reviewed By: ldionne, #libc

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

20 months ago[mlir][gpu] Add support for unsigned integer extend in vector to gpu.subgroup_mma...
Quinn Dawkins [Mon, 13 Feb 2023 01:33:10 +0000 (20:33 -0500)]
[mlir][gpu] Add support for unsigned integer extend in vector to gpu.subgroup_mma lowering

Unsigned integer types are supported in subgroup mma ops by matching
against arith.extui ops. This allows for subgroup_mma_compute ops with
mixed signedness which requires later conversions to handle this. SPIR-V
cooperative matrix ops support this while the lowering to WMMA does not.

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

20 months agolibclc: add more generic implementations to clspv SOURCES
Kévin Petit [Tue, 14 Feb 2023 18:10:44 +0000 (18:10 +0000)]
libclc: add more generic implementations to clspv SOURCES

https://reviews.llvm.org/D134887

Patch by: Aaron Greig <aaron.greig@codeplay.com>

20 months ago[libc++][doc] Adds Issaquah papers and issues.
Mark de Wever [Sun, 12 Feb 2023 12:07:49 +0000 (13:07 +0100)]
[libc++][doc] Adds Issaquah papers and issues.

Reviewed By: ldionne, #libc

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

20 months ago[AArch64] Remove dead isReflexive methods. NFC
David Green [Tue, 14 Feb 2023 17:58:28 +0000 (17:58 +0000)]
[AArch64] Remove dead isReflexive methods. NFC

These were added in 71f0ec242f348e7d2298 but never used.

20 months ago[libc++] Counter<T>'s assignment operator shouldn't ++gConstructed
Arthur O'Dwyer [Thu, 9 Feb 2023 18:06:52 +0000 (13:06 -0500)]
[libc++] Counter<T>'s assignment operator shouldn't ++gConstructed

This has been here since d5f461ca03e30, but assigning into an existing
Counter object definitely doesn't create a new object. This causes the
count to "leak" higher and higher, inside algorithms based on swapping.

20 months ago[flang][runtime] Handle aliasing in Assign()
Peter Klausler [Wed, 1 Feb 2023 23:25:54 +0000 (15:25 -0800)]
[flang][runtime] Handle aliasing in Assign()

Detect and handle LHS/RHS aliasing when effecting intrinsic
assignments via the Assign() runtime function.

Also: don't apply special handling for allocatable LHS when calling
a user-defined type-bound ASSIGNMENT(=) generic procedure for a
polymorphic type, and refactor some code into utility functions to
make Assign() more comprehensible.

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

20 months ago[llvm] Deprecate {Bits,Float,Double}To{Bits,Float,Double} (NFC)
Kazu Hirata [Tue, 14 Feb 2023 17:52:36 +0000 (09:52 -0800)]
[llvm] Deprecate {Bits,Float,Double}To{Bits,Float,Double} (NFC)

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

20 months ago[NFC][IR] Make Module::getIFuncList() private.
Vasileios Porpodas [Tue, 7 Feb 2023 03:43:13 +0000 (19:43 -0800)]
[NFC][IR] Make Module::getIFuncList() private.

This patch adds several missing IFuncList modifier functions, like
removeIFunc(), eraseIFunc() and insertIFunc().
There is no longer need to access the list directly so it also makes
getIFuncList() private.

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

20 months ago[flang] Strengthen conformance requirements for allocatable/pointer dummy arguments
Peter Klausler [Thu, 9 Feb 2023 23:23:52 +0000 (15:23 -0800)]
[flang] Strengthen conformance requirements for allocatable/pointer dummy arguments

There's several sets of circumstances in which a scalar actual argument can be
associated with a dummy argument array in Fortran, but they apply only to "ordinary"
dummy arguments, not those that are allocatables or pointers.

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

20 months ago[clang][test][RISCV] Check for __riscv_i in riscv-target-features.c
Alex Bradbury [Tue, 14 Feb 2023 17:02:32 +0000 (17:02 +0000)]
[clang][test][RISCV] Check for __riscv_i in riscv-target-features.c

This was overlooked, even though we have comprehensive tests for all the
other __riscv_fooext defines.

20 months ago[clang][test][RISCV] Fix precision of CHECK-NOT lines in riscv-target-features.c
Alex Bradbury [Tue, 14 Feb 2023 16:52:26 +0000 (16:52 +0000)]
[clang][test][RISCV] Fix precision of CHECK-NOT lines in riscv-target-features.c

`CHECK-NOT: __riscv_f 2000000{{$}}` was overly precise, in that it
wouldn't test what we want it to if the version of the F extension was
bumped. Meanwhile, lines like `CHECK-NOT: __riscv_d` were too imprecise,
as they would match any define with that prefix (e.g.
`__riscv_dsomethingelse`).

This patch just updates these lines to check for `__riscv_foo {{.*$}}`.

20 months ago[AMDGPU ASAN] Remove reference to asan bitcode library
Yaxun (Sam) Liu [Tue, 14 Feb 2023 15:37:46 +0000 (10:37 -0500)]
[AMDGPU ASAN] Remove reference to asan bitcode library

The asan functions are now attributed as used
in the device library, no need to keep the
declaration of asan device preserve function.

Patch by: Praveen Velliengiri

Reviewed by: Yaxun Liu

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

20 months ago[CodeGen] Trivial simplification of some getRegisterType calls. NFC.
Jay Foad [Tue, 14 Feb 2023 16:30:07 +0000 (16:30 +0000)]
[CodeGen] Trivial simplification of some getRegisterType calls. NFC.

20 months ago[libc++] Enforce formatting for already formatted and new files and ignore the format...
Nikolas Klauser [Fri, 20 Jan 2023 06:42:44 +0000 (07:42 +0100)]
[libc++] Enforce formatting for already formatted and new files and ignore the formatting of tests

It is quite confusing to newcomers that the formatting check gets mostly ignored. To fix that, enforce the formatting for new file and already formatted files, but ignore it for any files that aren't formatted already. We ignore the tests for now, since almost no test is formatted currently, and they are changed almost never.

Reviewed By: ldionne, Mordante, #libc

Spies: arichardson, fedor.sergeev, phosek, sstefan1, libcxx-commits, abrachet

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

20 months agoRevert "[extract_symbols.py] Adjust how the output of nm is interpreted"
Jake Egan [Tue, 14 Feb 2023 16:23:26 +0000 (11:23 -0500)]
Revert "[extract_symbols.py] Adjust how the output of nm is interpreted"

This commit was intended to fix some failures on AIX, but introduced some new failures instead. Commit e5d914672233cd055cda564eee2803a0a1c78c36 fixed the original failures. See D142989.

This reverts commit 78f13ea093afdebcaa3b5c5690530b9217bbdfac.

20 months agoRevert "[libc] Separate memcpy implementations per arch"
Guillaume Chatelet [Tue, 14 Feb 2023 16:14:51 +0000 (16:14 +0000)]
Revert "[libc] Separate memcpy implementations per arch"

Reverting as it broke downstream users.
This reverts commit 26541d4176346f8510302c74d6f3b958a4e523db.

20 months ago[AArch64][SME]: Custom lower select and fp_extend for streaming SVE
Hassnaa Hamdi [Tue, 14 Feb 2023 15:36:25 +0000 (15:36 +0000)]
[AArch64][SME]: Custom lower select and fp_extend for streaming SVE

Custom lower select/fp_extend and update related testing files

Reviewed By: sdesmalen

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

20 months ago[libc] Separate memcpy implementations per arch
Guillaume Chatelet [Tue, 14 Feb 2023 15:57:53 +0000 (15:57 +0000)]
[libc] Separate memcpy implementations per arch

As x86_64 implementations is likely to grow up to a point where it's no more manageable to have all implementations in the same file.

20 months ago[libc] refactor logic around embedded memcpy
Guillaume Chatelet [Tue, 14 Feb 2023 15:11:47 +0000 (15:11 +0000)]
[libc] refactor logic around embedded memcpy

20 months ago[flang] Associate entities are variables
Peter Klausler [Thu, 9 Feb 2023 18:00:12 +0000 (10:00 -0800)]
[flang] Associate entities are variables

A more precise reading of the standard for associate entities, like "x"
in ASSOCIATE(x => selector), shows that the utility predicates used for
determining their status as variables should treat them as variables
(not necessarily definable), whatever the selector is.  Currently
the cases where the selector is an expression or a designator with a
vector subscript are not properly considered to be variables.
(See Fortran 2018, 11.1.3.3 paragraph 5.)

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

20 months ago[AArch64][SME]: Custom-lower SIGN_EXTEND_INREG for streaming SVE
Hassnaa Hamdi [Tue, 14 Feb 2023 15:11:23 +0000 (15:11 +0000)]
[AArch64][SME]: Custom-lower SIGN_EXTEND_INREG for streaming SVE

Custom lower SIGN_EXTEND_INREG and udpate related tests.

Reviewed By: sdesmalen

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

20 months ago[MLIR][Presburger] Matrix: hide expensive consistency check behind EXPENSIVE_CHECKS...
Arjun P [Tue, 14 Feb 2023 15:26:22 +0000 (15:26 +0000)]
[MLIR][Presburger] Matrix: hide expensive consistency check behind EXPENSIVE_CHECKS macro

This significantly improves performance of Release assert builds.

Reviewed By: bondhugula

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

20 months ago[ConstraintElim] Add reproducer remarks.
Florian Hahn [Tue, 14 Feb 2023 15:15:14 +0000 (15:15 +0000)]
[ConstraintElim] Add reproducer remarks.

This patch adds an optimization remark for each performed optimization
containing a module that can be used to reproduce the transformation.

The reproducer function contains a series of @llvm.assume calls, one for
each condition currently in scope. For each condition, the operand
instruction are cloned until we reach operands that have an entry in the
constraint system. Those will then be added as function arguments.

The reproducer functions are minimal, that is, they only contain the
conditions required for a given simplification. The resulting IR is very
compact and can be used to verify each transformation individually.

It also provides a python script to extract the IR from the remarks and
create LLVM IR files from it.

Reviewed By: paquette

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

20 months ago[AArch64][SME]: Add missing Ops that need custom-lowering in streaming mode.
Hassnaa Hamdi [Tue, 14 Feb 2023 13:56:25 +0000 (13:56 +0000)]
[AArch64][SME]: Add missing Ops that need custom-lowering in streaming mode.

Add missing Ops and update related testing files.

Reviewed By: sdesmalen

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

20 months ago[LVI] Fix and re-enable at-use reasoning (PR60629)
Nikita Popov [Tue, 14 Feb 2023 14:48:25 +0000 (15:48 +0100)]
[LVI] Fix and re-enable at-use reasoning (PR60629)

This fixes the handling of phi nodes in getConstantRangeAtUse()
and re-enables it, reverting the workaround from
c77c186a647b385c291ddabecd70a2b4f84ae342.

For phi nodes, while we can make use of the edge condition for the
incoming value, we shouldn't look past the phi node to look for
further conditions, because we might be reasoning about values
from two different cycle iterations (which will have the same
SSA value).

To handle this more specifically we would have to detect cycles,
and there doesn't seem to be any motivating case for that at this
point.

20 months ago[LV] Synthesize all true masks for masked vector function variants
Graham Hunter [Fri, 9 Sep 2022 08:41:02 +0000 (09:41 +0100)]
[LV] Synthesize all true masks for masked vector function variants

When vectorizing code with function calls in it, if we encounter
a function which only has vectorized variants requiring a mask
we can synthesize an all-true mask to enable us to proceed.

Since we want the mask to be represented in vplan, the pointer
to the chosen Function is now stored as part of the
VPWidenCallRecipe, and mask arguments are added at the
appropriate index to the recipe operands.

Reviewed By: david-arm, fhahn, reames

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

20 months agoDAG: Remove hasBitPreservingFPLogic
Matt Arsenault [Tue, 24 Jan 2023 01:19:57 +0000 (21:19 -0400)]
DAG: Remove hasBitPreservingFPLogic

This doesn't make sense as an option. fneg and fabs are bit
preserving by definition. If a target has some fneg or fabs
instruction that are not bitpreserving it's incorrect to lower
fneg/fabs to use it.

20 months ago[mlir][llvm] Make LoopAnnotations non-discardable
Christian Ulmann [Tue, 14 Feb 2023 14:07:16 +0000 (15:07 +0100)]
[mlir][llvm] Make LoopAnnotations non-discardable

This commit adds the loop annotation attribute to LLVM::Br and
LLVM::CondBr to ensure it is non-discardable. Furthermore, the name is
changed from "llvm.loop" to "loop-annotation".

Reviewed By: gysit

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

20 months ago[clang][NFC] Adjust tests to not un/define predefined macros
John Brawn [Fri, 3 Feb 2023 13:31:40 +0000 (13:31 +0000)]
[clang][NFC] Adjust tests to not un/define predefined macros

An upcoming patch will be making all defining or undefining of
predefined macros to be warning (currently only some give a warning).
In preparation for this adjust some tests that would emit a warning:
 * In thread-specifier.c the undefine is done to avoid a different
   warning, but we get that warning just because __thread and
   __private_extern__ are the wrong way around so we can just swap
   them.
 * There are a couple of objective-c tests that redefine IBAction to
   what it's already defined as, so we can just remove the define.

20 months ago[flang] support fir.unreachable in stack arrays pass
Tom Eccles [Mon, 13 Feb 2023 15:45:47 +0000 (15:45 +0000)]
[flang] support fir.unreachable in stack arrays pass

Some functions (e.g. the main function) end with a call to the STOP
statement instead of a func.return. This is lowered as a call to the
stop runtime function followed by a fir.unreachable. fir.unreachable is
a terminator and so this can cause functions to have no func.return.

The stack arrays pass looks to see which heap allocations have always
been freed by the time a function returns. Without any returns, the pass
does not detect any freed allocations. This patch changes this behaviour
so that fir.unreachable is checked as well as func.return.

This allows 15 heap allocations for array temporaries in spec2017
exchange2's main function to be moved to the stack.

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

20 months ago[flang] automatically load FIR dialect with hlfir
Tom Eccles [Mon, 13 Feb 2023 18:03:44 +0000 (18:03 +0000)]
[flang] automatically load FIR dialect with hlfir

MLIR loads dialects lazily so if a hlfir type (or operation) is found
before any fir type (or operation), the fir dialect will not have been
loaded when the hlfir thing is verified. Verification of some hlfir
operations does depend on fir types (e.g. hlfir.sum needs
fir::SequenceType).

Tablegen change recommended by jeanPerier

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

20 months ago[libc] Conform memcpy tuning macro to the new naming scheme
Guillaume Chatelet [Tue, 14 Feb 2023 13:43:53 +0000 (13:43 +0000)]
[libc] Conform memcpy tuning macro to the new naming scheme

20 months ago[MachineTraceMetrics][NFC] Move Strategy enum out of the class
Anton Sidorenko [Tue, 14 Feb 2023 10:30:13 +0000 (13:30 +0300)]
[MachineTraceMetrics][NFC] Move Strategy enum out of the class

Make forward declaration possible to reduce amount of dependencies and reduce
re-compilation burden caused by further patches.

Reviewed By: spatel

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

20 months ago[mlir][LLVM] Properly wrap code examples in markdown code blocks
Markus Böck [Tue, 14 Feb 2023 13:20:11 +0000 (14:20 +0100)]
[mlir][LLVM] Properly wrap code examples in markdown code blocks

These are otherwise rendered and formatted as raw text on the website, making them completely unreadable

20 months ago[flang][hlfir] remove unnecessary header include
Jean Perier [Tue, 14 Feb 2023 13:12:47 +0000 (14:12 +0100)]
[flang][hlfir] remove unnecessary header include

Builder/HLFIRTools.h is not needed and is causing build
issues in some shared library builds because it belongs to another
library that depends on libHLFIRDialect (so libHLFIRDialect should
not depend on it).

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

20 months ago[flang] Fix USE rename
Leandro Lupori [Fri, 10 Feb 2023 20:50:45 +0000 (20:50 +0000)]
[flang] Fix USE rename

Fix USE rename when use-name and local-name are the same.
Previously, the associated symbol was being removed from scope.

Operator rename implementation needed no change, because, as it
doesn't call AddUseRename(), symbol erasure is skipped.

Fixes #60223

Reviewed By: klausler

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

20 months ago[SimpleLoopUnswitch] Re-enable simple-loop-unswitch-inject-invariant-conditions
Max Kazantsev [Tue, 14 Feb 2023 12:54:19 +0000 (19:54 +0700)]
[SimpleLoopUnswitch] Re-enable simple-loop-unswitch-inject-invariant-conditions

Underlying bug (taking a branch from inner loop as candidate) is now fixed.
We can return it.

20 months ago[SimpleLoopUnswitch] Ignore inner loops when injecting invariant conditions. PR60736
Max Kazantsev [Tue, 14 Feb 2023 12:26:15 +0000 (19:26 +0700)]
[SimpleLoopUnswitch] Ignore inner loops when injecting invariant conditions. PR60736

The transform and all related updates don't expect the situation when candidate
is from an inner loop. I think we *might* still do something in this case, but
the current implementation doesn't expect this and does incorrect loop info
updates in this situation.

Details: https://github.com/llvm/llvm-project/issues/60736

20 months agoDAG: Relax foldBitcastedFPLogic conditions
Matt Arsenault [Mon, 23 Jan 2023 20:49:41 +0000 (16:49 -0400)]
DAG: Relax foldBitcastedFPLogic conditions

Requiring a bitcast to exist was unhelpful. The most basic cases
are always going to be a CopyFromReg or load, so they would need
a new cast inserted. Don't require a bitcast if it's a free
operation. I don't think this logic makes particularly much sense
(it seems to be imparting special interpretation of bitcast), but
this needs to be in sync with foldSignChangeInBitcast.

We should also get rid of this hasBitPreservingFPLogic hook. fabs/fneg
are bitpreserving or incorrectly implemented, so this should just be a
regular legality check.

20 months ago[NFC] Move some asserts out of Expensive Checks
Max Kazantsev [Tue, 14 Feb 2023 11:42:06 +0000 (18:42 +0700)]
[NFC] Move some asserts out of Expensive Checks

This was done by reviewer's request, but in fact without them we
skip very nasty bugs. Unless it is a REAL problem, I'd keep them
in default setup.

20 months ago[llvm][AArch64] Fix an interaction of SLS and BTI after a returns twice call
David Spickett [Mon, 13 Feb 2023 14:48:02 +0000 (14:48 +0000)]
[llvm][AArch64] Fix an interaction of SLS and BTI after a returns twice call

This fixes the combination of two things:
* Placing a BTI after calls to a returns twice function like setjmp.
  This allows the setjmp to return with a br instead of a ret.
* Straight line speculation mitigations that replace BLR with a BL
  to a thunk that does the mitigation, and then goes to the original
  target.

Originally I marked AArch64call_bti as requiring that SLS mitigation
be disabled. This caused a crash when you tried to codegen with both.
Since CALL_BTI tried to match with AArch64call_bti but could not.

This change does 2 things:
* Follow the pattern set by AArch64call and add 2 patterns for
  AArch64call_bti. One with no IP (interprocedural) registers,
  and one with. For SLS mitigation on and off respectively.
* Modify the sls hardening pass to iterate through bundled
  instructions, as the AArch64 KCFI pass does.

Since there is a 1:1 replacement of the BLR with a BL,
the bundle remains intact. This is checked with an MIR test.

The ir -> asm testing is updated to add runs with the sls
mitigation enabled.

Reviewed By: kristof.beyls, pzheng

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

20 months ago[Test] Add test for PR60736
Max Kazantsev [Tue, 14 Feb 2023 11:04:44 +0000 (18:04 +0700)]
[Test] Add test for PR60736

Details at https://github.com/llvm/llvm-project/issues/60736

20 months ago[SimpleLoopUnswitch] Temorarily switch off simple-loop-unswitch-inject-invariant...
Max Kazantsev [Tue, 14 Feb 2023 10:54:58 +0000 (17:54 +0700)]
[SimpleLoopUnswitch] Temorarily switch off simple-loop-unswitch-inject-invariant-conditions. PR60736

It caused an assertion failure, not sure induced or introduced. Disabling
to investigate it. See details at https://github.com/llvm/llvm-project/issues/60736