platform/upstream/llvm.git
20 months ago[libc][NFC] Rename macros
Guillaume Chatelet [Tue, 7 Feb 2023 20:41:30 +0000 (20:41 +0000)]
[libc][NFC] Rename macros

20 months ago[libc][NFC] Move code to sanitizer.h + more consistent naming
Guillaume Chatelet [Tue, 7 Feb 2023 15:23:40 +0000 (15:23 +0000)]
[libc][NFC] Move code to sanitizer.h + more consistent naming

20 months ago[AArch64][GlobalISel] Legalize wide s8/s16 vectors G_ADD/G_MUL/G_OR/...
Vladislav Dzhidzhoev [Tue, 7 Feb 2023 16:48:58 +0000 (17:48 +0100)]
[AArch64][GlobalISel] Legalize wide s8/s16 vectors G_ADD/G_MUL/G_OR/...

Clamp the max number of elements of s8/s16 vectors when legalizing G_ADD,
G_SUB, G_MUL, G_AND, G_OR, G_XOR, in order to support some wide vectors.

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

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

20 months agoAdd codegen for llvm log2/log10 elementwise builtins
Joshua Batista [Tue, 7 Feb 2023 19:26:08 +0000 (11:26 -0800)]
Add codegen for llvm log2/log10 elementwise builtins

Add codegen for llvm log2 / log10 elementwise builtin
The log2/log10 elementwise builtin is necessary for HLSL codegen.
Tests were added to make sure that the expected errors are encountered when these functions are given inputs of incompatible types.
The new builtins are restricted to floating point types only.

Reviewed By: fhahn

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

20 months ago[BOLT][TEST] Fix is-strip test for NFC testing
Amir Ayupov [Tue, 7 Feb 2023 20:16:45 +0000 (12:16 -0800)]
[BOLT][TEST] Fix is-strip test for NFC testing

20 months ago[mlir][LLVMIR] Add lowering support for vp.muladd intrinsic
Diego Caballero [Tue, 7 Feb 2023 20:08:46 +0000 (20:08 +0000)]
[mlir][LLVMIR] Add lowering support for vp.muladd intrinsic

Reviewed By: gysit

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

20 months ago[OpenMP 5.2] Deprecate 'destroy' clause without argument for 'depobj' construct
Fazlay Rabbi [Tue, 7 Feb 2023 19:52:48 +0000 (11:52 -0800)]
[OpenMP 5.2] Deprecate 'destroy' clause without argument for 'depobj' construct

Deprecate and diagnose uses of the 'destroy' clauses without an argument
in 'omp depobj' directives.

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

20 months ago[mlir][Vector] Add lowering support for 1-D masked multi-reductions
Diego Caballero [Tue, 7 Feb 2023 19:25:19 +0000 (19:25 +0000)]
[mlir][Vector] Add lowering support for 1-D masked multi-reductions

1-D multi-reductions follow a different lowering path (they are
converted to 2-D multi-reductions) so masked variants need to be
supported explicitly.

Reviewed By: nicolasvasilache

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

20 months ago[flang] Add AMDGPU target in flang
Jan Sjodin [Wed, 1 Feb 2023 20:09:59 +0000 (15:09 -0500)]
[flang] Add AMDGPU target in flang

This is the first patch of several that will enable generating code for AMD
GPUs. It adds the AMDGPU target so it can be used with the --target and -mcpu
options.

Reviewed By: kiranchandramohan

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

20 months ago[libc][NFC] Move UnitTest and IntegrationTest to the 'test' directory.
Siva Chandra Reddy [Mon, 6 Feb 2023 07:07:23 +0000 (07:07 +0000)]
[libc][NFC] Move UnitTest and IntegrationTest to the 'test' directory.

This part of the effort to make all test related pieces into the `test`
directory. This helps is excluding test related pieces in a straight
forward manner if LLVM_INCLUDE_TESTS is OFF. Future patches will also move
the MPFR wrapper and testutils into the 'test' directory.

20 months ago[Serialization] Add support for (de)serializing #pragma pack
Dustin Howett [Tue, 7 Feb 2023 19:02:59 +0000 (11:02 -0800)]
[Serialization] Add support for (de)serializing #pragma pack

Serialization of tokens is required when PCH is used with late parsed
templates, including annotation tokens used for pragmas.

This patch implements the serialization for annot_pragma_pack.

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

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

20 months ago[CodeGen] Kill off a few more direct uses of EVT::getEVTString [nfc]
Philip Reames [Tue, 7 Feb 2023 19:22:13 +0000 (11:22 -0800)]
[CodeGen] Kill off a few more direct uses of EVT::getEVTString [nfc]

20 months ago[lit] don't skip test times when executions are instantaneous
Ashay Rane [Tue, 7 Feb 2023 19:27:23 +0000 (11:27 -0800)]
[lit] don't skip test times when executions are instantaneous

If a test executes quickly or if the timing resolution is too coarse,
the running time associated with a test could be zero. This happens
often for the //llvm/utils/lit/tests/reorder.py test on Windows, which
causes the test to fail non-deterministically.

This patch modifies the existing check, so that instead of skipping
zeros, lit now skips if the timing is None (presumably due to an error
in measurement). Recurring executions of the reorder.py test on Windows
seem to indicate that the test no longer exhibits occasional failure.

Reviewed By: stella.stamenova

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

20 months ago[AArch64] Recurse further into performUADDVCombine
David Green [Tue, 7 Feb 2023 19:14:06 +0000 (19:14 +0000)]
[AArch64] Recurse further into performUADDVCombine

This adjusts the performUADDVCombine to recurse further into adds from
reductions, which can help produce more UADDLP when the order of lanes is
unimportant. It also prevents some regressions from subsequent patches.

20 months ago[CodeGen] Add standard print/debug utilities to MVT
Philip Reames [Tue, 7 Feb 2023 18:41:18 +0000 (10:41 -0800)]
[CodeGen] Add standard print/debug utilities to MVT

Doing so makes it easier to do printf style debugging in idiomatic manner. I followed the code structure of Value with only the definition of dump being #ifdef out in non-debug builds. Not sure if this is the "right" option; we don't seem to have any single consistent scheme on how dump is handled.

Note: This is a follow up to D143454 which did the same for EVT.

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

20 months ago[llvm][IfConversion] update successor list when merging INLINEASM_BR
Nick Desaulniers [Tue, 7 Feb 2023 18:22:24 +0000 (10:22 -0800)]
[llvm][IfConversion] update successor list when merging INLINEASM_BR

If this successor list is not correct, then branch-folding may
incorrectly think that the indirect target is dead and remove it. This
results in a dangling reference to the removed block as an operand to
the INLINEASM_BR, which later will get AsmPrinted into code that doesn't
assemble.

This was made more obvious by, but is not a regression of
https://reviews.llvm.org/D130316.

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

Reviewed By: efriedma, void

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

20 months agoprecommit test for pr60346
Nick Desaulniers [Tue, 7 Feb 2023 18:19:12 +0000 (10:19 -0800)]
precommit test for pr60346

Link: https://github.com/llvm/llvm-project/issues/60346
Reviewed By: efriedma, void

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

20 months ago[NFC][Clang] Regenerate test output for SVE ACLE tests.
Paul Walker [Tue, 7 Feb 2023 18:17:51 +0000 (18:17 +0000)]
[NFC][Clang] Regenerate test output for SVE ACLE tests.

Just a rerun of update_cc_test_checks.py to capture some changes to
variable names after their reliance on instcombine was removed.

20 months ago[X86] combineX86ShufflesRecursively - peek through insert_subvector(undef, x, 0)...
Simon Pilgrim [Tue, 7 Feb 2023 18:24:50 +0000 (18:24 +0000)]
[X86] combineX86ShufflesRecursively - peek through insert_subvector(undef, x, 0) vector widening nodes

If the node is inert then just peek through it and canonicalize the shuffle mask to ensure any referenced upper elements are set to undef.

20 months agoRevert "[LegacyPM] Remove some legacy passes"
Arthur Eubanks [Tue, 7 Feb 2023 18:17:24 +0000 (10:17 -0800)]
Revert "[LegacyPM] Remove some legacy passes"

This reverts commit a4b4f62beb0bf40123181e5f5bdf32ef54f87166.

Ocaml bindings tests failing.

20 months ago[mlir][Linalg] NFC - Extract inferGemmDims - Amend forgotten changes
Nicolas Vasilache [Tue, 7 Feb 2023 18:16:46 +0000 (10:16 -0800)]
[mlir][Linalg] NFC - Extract inferGemmDims - Amend forgotten changes

20 months ago[mlir][Linalg] NFC - Extract inferGemmDims
Nicolas Vasilache [Tue, 7 Feb 2023 17:58:02 +0000 (09:58 -0800)]
[mlir][Linalg] NFC - Extract inferGemmDims

20 months ago[LegacyPM] Remove some legacy passes
Arthur Eubanks [Tue, 20 Dec 2022 21:36:20 +0000 (13:36 -0800)]
[LegacyPM] Remove some legacy passes

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

Namely
* Internalize
* StripSymbols
* StripNonDebugSymbols
* StripDeadDebugInfo
* StripDeadPrototypes
* VectorCombine
* WarnMissedTransformations

20 months ago[CostModel][X86] Update LV UTC_ARGS regexp filter to match ptr instead of i8* etc.
Simon Pilgrim [Tue, 7 Feb 2023 17:46:34 +0000 (17:46 +0000)]
[CostModel][X86] Update LV UTC_ARGS regexp filter to match ptr instead of i8* etc.

20 months ago[libc] Add startup code implementation for GPU targets
Joseph Huber [Thu, 2 Feb 2023 21:05:54 +0000 (15:05 -0600)]
[libc] Add startup code implementation for GPU targets

This patch introduces startup code for executing `main` on a device
compiled for the GPU. We will primarily use this to run standalone
integration tests on the GPU. The actual execution of this routine will
need to be provided by a `loader` utility to bootstrap execution on the
GPU.

Reviewed By: sivachandra

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

20 months ago[clang] NFC: Remove GCC 5.1 workaround in FileEntry
Jan Svoboda [Mon, 6 Feb 2023 19:39:40 +0000 (11:39 -0800)]
[clang] NFC: Remove GCC 5.1 workaround in FileEntry

We no longer support GCC 5.1 (D122976), so let's remove the workaround in FileEntry.

Reviewed By: benlangmuir

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

20 months ago[clang][deps] Fix race condition
Jan Svoboda [Mon, 6 Feb 2023 19:36:51 +0000 (11:36 -0800)]
[clang][deps] Fix race condition

D140176 introduced new `FullDeps` API that's not thread-safe, breaking the class invariant. This was causing race condition when `clang-scan-deps` was run with multiple threads.

Reviewed By: steven_wu, akyrtzi

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

20 months ago[Hexagon] Add release note for LLVM 16
Krzysztof Parzyszek [Tue, 7 Feb 2023 17:24:06 +0000 (09:24 -0800)]
[Hexagon] Add release note for LLVM 16

20 months ago[X86] combineX86ShuffleChainWithExtract - refactor to remove need to widen all vectors
Simon Pilgrim [Tue, 7 Feb 2023 13:03:16 +0000 (13:03 +0000)]
[X86] combineX86ShuffleChainWithExtract - refactor to remove need to widen all vectors

combineX86ShuffleChain no longer needs the candidate shuffle inputs to all have been widened to root size, but combineX86ShuffleChainWithExtract still assumes that they have.

This refactor peeks through all inputs' extract_subvector nodes to find the widest legal vector type and widens the shuffle mask accordingly - it no longer bails if any of the inputs can't be widened to the new width.

combineX86ShuffleChainWithExtract now follows a similar process to combineX86ShufflesRecursively, so I think we should eventually be able to get rid of it and just let combineX86ShufflesRecursively handle widening the shuffle width as well.

Another step toward removing subvector widening for Issue #45319

20 months ago[ARM][AArch64][RISCV] Add tests for various double reductions. NFC
David Green [Tue, 7 Feb 2023 16:39:20 +0000 (16:39 +0000)]
[ARM][AArch64][RISCV] Add tests for various double reductions. NFC

20 months ago[CodeGen] Add standard print/debug utilities to EVT
Philip Reames [Tue, 7 Feb 2023 16:02:43 +0000 (08:02 -0800)]
[CodeGen] Add standard print/debug utilities to EVT

Doing so makes it easier to do printf style debugging in idiomatic manner. I followed the code structure of Value with only the definition of dump being #ifdef out in non-debug builds. Not sure if this is the "right" option; we don't seem to have any single consistent scheme on how dump is handled.

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

20 months ago[libc] Cleanup the CMake infrastructure to add startup objects.
Siva Chandra Reddy [Tue, 7 Feb 2023 06:46:09 +0000 (06:46 +0000)]
[libc] Cleanup the CMake infrastructure to add startup objects.

Instead of using a custom target to copy the startup object file to a
file with the desired name, a normal object library with a special
property is used.

Follow up patches will do more cleanup wrt how the startup objects are
used in integration tests.

Reviewed By: jhuber6

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

20 months ago[llvm] Add tests for upcoming fixes to pointer/index type confusion.
Krzysztof Drewniak [Mon, 6 Feb 2023 21:45:44 +0000 (21:45 +0000)]
[llvm] Add tests for upcoming fixes to pointer/index type confusion.

Various parts of the codebase are using getIntPtrType() and its
relatives when getting the type of the offset argument to GEP. Most
such code has been updated to use the pointer index type field from
the data layout, but there is code that still assumes these two types
are the same in certain optimizaiton passes.

This commit adds regression tests to capture the old behavior.

Reviewed By: #amdgpu, arsenm

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

20 months ago[mlir][doc] Remove outdated section about a deprecated `OpBuilder` use
Markus Böck [Tue, 7 Feb 2023 16:04:28 +0000 (17:04 +0100)]
[mlir][doc] Remove outdated section about a deprecated `OpBuilder` use

This syntax has been removed two years ago in https://github.com/llvm/llvm-project/commit/2f5569f6f67a30f7774f7c2d2f3d726752a862ae yet the doc still had a section marking them as deprecated

20 months ago[Flang] [Semantics] More descript warning message for same named external statements...
Paul Scoropan [Mon, 6 Feb 2023 19:09:10 +0000 (19:09 +0000)]
[Flang] [Semantics] More descript warning message for same named external statements and interfaces

For issue: https://github.com/llvm/llvm-project/issues/56605. Previous error messages are not descriptive of problem. Issuing warnings instead that do not halt compilation but offer better description of problem.

Reviewed By: klausler

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

20 months ago[OpenMP][libomp] Remove false positive for memory sanitizer
Jonathan Peyton [Mon, 6 Feb 2023 19:32:35 +0000 (13:32 -0600)]
[OpenMP][libomp] Remove false positive for memory sanitizer

The memory sanitizer intercepts the memcpy() call but not the direct
assignment of last byte to 0. This leads the sanitizer to believe the
last byte of a string based on the kmp_str_buf_t type is uninitialized.
Hence, the eventual strlen() inside __kmp_env_dump() leads to an
use-of-uninitialized-value warning.

Using strncat() instead gives the sanitizer the information it needs.

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

Fixes #60501

20 months ago[WebAssembly][test][NFC] Add coverage of non-void funcref calls
Alex Bradbury [Tue, 7 Feb 2023 15:56:10 +0000 (15:56 +0000)]
[WebAssembly][test][NFC] Add coverage of non-void funcref calls

This is trickier to handle in some other representations of funcrefs
that are being explored, so it makes sense to ensure we have some
coverage of this requirement.

20 months ago[HWASAN] Remove GetRequestedSize check from Metadata::IsAllocated
Kirill Stoimenov [Tue, 7 Feb 2023 00:02:17 +0000 (00:02 +0000)]
[HWASAN] Remove GetRequestedSize check from Metadata::IsAllocated

After D143438 there is no point in this check as the size will never 0. Also this keeps it consistent with ASAN where there is not size check in LsanMetadata::allocated.

Reviewed By: MaskRay, vitalybuka

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

20 months ago[mlir][ods] add mechanism for deprecating an `OpBuilder` in ODS
Markus Böck [Thu, 2 Feb 2023 15:35:02 +0000 (16:35 +0100)]
[mlir][ods] add mechanism for deprecating an `OpBuilder` in ODS

This allows discouraging the use of specific build methods of an op by having TableGen generate C++ code, instructing the C++ compiler to warn on use of the `build` method.
The implementation uses the C++14 `[[deprecated(...)]]`` for this purpose. I considered using `LLVM_DEPRECATED`, but thought requiring a fix-it was not necassery, nor would the syntax in ODS have been very nice.

My motivation for this change is that in the future I'd like to deprecate the use `build` methods in the LLVM Dialect, not using explicit pointer types for ops such as `llvm.load` or `llvm.alloca`, which makes the code not future proof for opaque pointers. In-tree has to be clean first before I could commit such a change of course, but I thought the initial infrastructure change could already be submitted.

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

20 months ago[mlir] Switch default Fold API to using FoldAdaptors
Markus Böck [Tue, 7 Feb 2023 15:38:28 +0000 (16:38 +0100)]
[mlir] Switch default Fold API to using FoldAdaptors

As mentioned in https://discourse.llvm.org/t/psa-new-improved-fold-method-signature-has-landed-please-update-your-downstream-projects/67618, it has now been about one month since the new fold API has been introduced.

Any downstream users that have not yet switched, nor explicitly set useFoldAPI to kEmitRawAttributesFolder will experience a build break after this patch, requiring them to either switch to the new API or explicitly use the old one and live with the warning set by TableGen.

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

20 months ago[WebAssembly][test][NFC] Regenerate funcref-call.ll using update_llc_test_checks.py
Alex Bradbury [Tue, 7 Feb 2023 15:44:24 +0000 (15:44 +0000)]
[WebAssembly][test][NFC] Regenerate funcref-call.ll using update_llc_test_checks.py

In preparation for some slight expansion of the tests.

20 months ago[libc++] Remove #error about _LIBCPP_DEBUG
Louis Dionne [Tue, 7 Feb 2023 15:42:30 +0000 (07:42 -0800)]
[libc++] Remove #error about _LIBCPP_DEBUG

This doesn't require a release note since this used to be an error,
so nobody should have been using it anymore.

20 months ago[libc++] Use __builtin_FILE and __builtin_LINE in _LIBCPP_ASSERT
Louis Dionne [Tue, 7 Feb 2023 00:11:14 +0000 (16:11 -0800)]
[libc++] Use __builtin_FILE and __builtin_LINE in _LIBCPP_ASSERT

This avoids theoretical potential ODR violations since __LINE__ and
__FILE__ expand to different things depending on where they are.

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

20 months ago[libc++][NFC] Reformat __assert with clang-format
Louis Dionne [Tue, 7 Feb 2023 15:34:29 +0000 (07:34 -0800)]
[libc++][NFC] Reformat __assert with clang-format

20 months ago[Flang] Restrict emit-asm-from-mlir.mlir to be ran on specific targets using 'target...
Amy Kwan [Tue, 7 Feb 2023 15:03:24 +0000 (09:03 -0600)]
[Flang] Restrict emit-asm-from-mlir.mlir to be ran on specific targets using 'target=...'

This patch aims to restrict the emit-asm-from-mlir.mlir test to the targets that
the test cases expect using the 'target=...' LIT expression.

rG9067de2a43145411eff8b7782a404c5834249717 has previously attempted to resolve
the LIT failure on the ppc64le-flang-rhel-clang buildbot coming from the
emit-asm-from-mlir.mlir test by restricting the test case for AArch64, x86 and
ARM (as long as these targets are built). The original solution of adding
"*-registered-target" works on ppc64le-flang-rhel-clang because this bot only
builds PowerPC in LLVM_TARGETS_TO_BUILD.

When we build all targets and also build the flang project, this test case will
fail because despite being on PowerPC, we are still building the AArch64, x86
and ARM targets which will cause this test to run. These targets expect the ret
instruction to be produced in this test case, while PowerPC produces a blr instead.

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

20 months ago[libc++][format] Fixes constexpr validation.
Mark de Wever [Mon, 6 Feb 2023 15:29:30 +0000 (16:29 +0100)]
[libc++][format] Fixes constexpr validation.

The constexpr validation parsed parts of the format string that didn't
belong to the specific replacement field.

Fixes https://llvm.org/PR60536

Reviewed By: #libc, ldionne

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

20 months ago[flang][hlfir] Emit hlfir.declare inside internal procedures
Jean Perier [Tue, 7 Feb 2023 14:29:35 +0000 (15:29 +0100)]
[flang][hlfir] Emit hlfir.declare inside internal procedures

Captured variables inside internal procedure do not go though
Fortran::lower::instantiateVar because the specification expressions
should no be lowered again, and instead, all the information must be
taken from the host link argument.

There is nothing very special to do for HLFIR, but the hlfir.declare
should be emitted for the instantiated captured variable and mapped
to the symbol.

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

20 months ago[flang][hlfir] Lower evaluate::DescriptorInquiry
Jean Perier [Tue, 7 Feb 2023 14:27:19 +0000 (15:27 +0100)]
[flang][hlfir] Lower evaluate::DescriptorInquiry

Lower extents and lower bounds inquiries with a compile time
constant DIM that cannot be folded by the front-end.

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

20 months ago[ARM] Perform lane interleaving from reductions.
David Green [Tue, 7 Feb 2023 14:12:51 +0000 (14:12 +0000)]
[ARM] Perform lane interleaving from reductions.

We have a pass for MVE to perform lane interleaving to make use of top/bottom
instructions, that adds shuffles before extends and after truncates. This
extends it to also start from add reductions, where the order of lanes does not
matter so the shuffle is not needed. We need to be careful about not breaking
the form of existing reductions, but otherwise can save some instructions and
awkward extends.

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

20 months agoFix broken Bazel targets
Guillaume Chatelet [Tue, 7 Feb 2023 14:00:56 +0000 (14:00 +0000)]
Fix broken Bazel targets

20 months ago[clangd] Fix a crash in semantic highlighting.
Haojian Wu [Tue, 7 Feb 2023 11:40:00 +0000 (12:40 +0100)]
[clangd] Fix a crash in semantic highlighting.

We encounter a few internal reports that we're dereference a nullptr.
Unfortunately, no small reproduce testcase for this crash yet, but it makes the
clangd more robost on broken code.

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

20 months ago[include-mapping] Regenerate the StdSymbolMap.inc from the 20220730 html book.
Viktoriia Bakalova [Fri, 3 Feb 2023 09:02:01 +0000 (10:02 +0100)]
[include-mapping] Regenerate the StdSymbolMap.inc from the 20220730 html book.

Merge the zoombie names into the StdSymbols as well.

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

20 months ago[mlir][scf] Fix builder of WhileOp with region builder arguments.
Ingo Müller [Tue, 31 Jan 2023 06:39:31 +0000 (06:39 +0000)]
[mlir][scf] Fix builder of WhileOp with region builder arguments.

The overload of WhileOp::build with arguments for builder functions for
the regions of the op was broken: It did not compute correctly the types
(and locations) of the region arguments, which lead to failed assertions
when the result types were different from the operand types.
Specifically, it used the result types (and operand locations) for *both*
regions, instead of the operand types (and locations) for the 'before'
region and the result types (and loecations) for the 'after' region.

Reviewed By: Mogball, mehdi_amini

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

20 months ago[include-mapping] Better #includes support for std input/output symbols
Haojian Wu [Tue, 7 Feb 2023 09:37:44 +0000 (10:37 +0100)]
[include-mapping] Better #includes support for std input/output symbols

Reviewed By: kadircet

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

20 months ago[Tooling/Inclusion] Support multiple headers in the stdlib APIs.
Haojian Wu [Fri, 3 Feb 2023 22:50:25 +0000 (23:50 +0100)]
[Tooling/Inclusion] Support multiple headers in the stdlib APIs.

Unittest will be added in https://reviews.llvm.org/D143280

Patch by Viktoriia Bakalova.

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

20 months ago[libc][NFC] Move attributes from common to macros folder
Guillaume Chatelet [Tue, 7 Feb 2023 13:16:33 +0000 (13:16 +0000)]
[libc][NFC] Move attributes from common to macros folder

20 months ago[libc][NFC] Sort dependencies
Guillaume Chatelet [Tue, 7 Feb 2023 12:58:26 +0000 (12:58 +0000)]
[libc][NFC] Sort dependencies

20 months ago[libc][NFC] Use LIBC_TARGET_IS_GPU instead of defining PACKAGE_FOR_GPU
Guillaume Chatelet [Tue, 7 Feb 2023 12:57:52 +0000 (12:57 +0000)]
[libc][NFC] Use LIBC_TARGET_IS_GPU instead of defining PACKAGE_FOR_GPU

20 months ago[NFC][TargetParser] Remove llvm/ADT/Triple.h
Archibald Elliott [Tue, 7 Feb 2023 12:21:51 +0000 (12:21 +0000)]
[NFC][TargetParser] Remove llvm/ADT/Triple.h

I also ran `git clang-format` to get the headers in the right order for
the new location, which has changed the order of other headers in two
files.

20 months ago[debug-info] Followup to e0374fb2f4, avoid changing codegen
Jeremy Morse [Tue, 7 Feb 2023 12:20:32 +0000 (12:20 +0000)]
[debug-info] Followup to e0374fb2f4, avoid changing codegen

As discussed on D140404, calling GetValueInMiddleOfBlock can force PHI
nodes to be created, but the patch was only supposed to fetch a Value if it
wasn't going to generate any PHIs. Fix this by using GetValueAtEndOfBlock
instead of the Middle variant, which was the original intention given the
check of HasValueForBlock.

We don't need to consider the "middle of block" scenario as we're only
dealing with blocks where there are no value definitions.

20 months ago[CodeGen] Make more use of MachineOperand::getOperandNo. NFC.
Jay Foad [Fri, 3 Feb 2023 10:04:28 +0000 (10:04 +0000)]
[CodeGen] Make more use of MachineOperand::getOperandNo. NFC.

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

20 months ago[CodeGen] Define and use MachineOperand::getOperandNo
Jay Foad [Fri, 3 Feb 2023 09:42:25 +0000 (09:42 +0000)]
[CodeGen] Define and use MachineOperand::getOperandNo

This is a helper function to very slightly simplify many calls to
MachineInstruction::getOperandNo.

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

20 months ago[AMDGPU] Remove the unused u8imm operand definition.
Ivan Kosarev [Tue, 7 Feb 2023 11:38:34 +0000 (11:38 +0000)]
[AMDGPU] Remove the unused u8imm operand definition.

Reviewed By: foad

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

20 months ago[LoopVectorize] Use DataLayout::getIndexType instead of i32 for non-constant GEP...
Sander de Smalen [Mon, 6 Feb 2023 11:03:52 +0000 (11:03 +0000)]
[LoopVectorize] Use DataLayout::getIndexType instead of i32 for non-constant GEP indices.

This is specifically relevant for loops that vectorize using a scalable VF,
where the code results in:

  %vscale = call i32 llvm.vscale.i32()
  %vf.part1 = mul i32 %vscale, 4
  %gep = getelementptr  ..., i32 %vf.part1

Which InstCombine then changes into:

  %vscale = call i32 llvm.vscale.i32()
  %vf.part1 = mul i32 %vscale, 4
  %vf.part1.zext = sext i32 %vf.part1 to i64
  %gep = getelementptr  ..., i32 %vf.part1.zext

D143016 tried to remove these extends, but that only works when
the call to llvm.vscale.i32() has a single use. After doing any
kind of CSE on these calls the combine no longer kicks in.

It seems more sensible to ask DataLayout what type to use, rather
than relying on InstCombine to insert the extend and hoping it can
fold it away.

I've only changed this for indices that are not constant, because
I vaguely remember there was a reason for sticking with i32. It
would also mean patching up loads more tests.

Reviewed By: paulwalker-arm

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

20 months ago[clang-tidy] Fix `cppcoreguidelines-init-variables` for invalid vardecl
Sockke [Tue, 7 Feb 2023 11:30:05 +0000 (19:30 +0800)]
[clang-tidy] Fix `cppcoreguidelines-init-variables` for invalid vardecl

https://godbolt.org/z/n4cK4fo3o
The checker missed a check for invalid vardecl and this could cause a false positive.

Reviewed By: carlosgalvezp

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

20 months ago[AArch64][SME2] Add multi-vector frint intrinsics
Kerry McLaughlin [Tue, 7 Feb 2023 11:21:37 +0000 (11:21 +0000)]
[AArch64][SME2] Add multi-vector frint intrinsics

Adds x2 and x4 vector intrinsics for the following instructions:
 - frinta
 - frintm
 - frintn
 - frintp

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: david-arm

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

20 months ago[ARM] Tests for lane interleaving from reductions. NFC
David Green [Tue, 7 Feb 2023 11:16:11 +0000 (11:16 +0000)]
[ARM] Tests for lane interleaving from reductions. NFC

20 months ago[libc][NFC] Rename compiler_feature macros
Guillaume Chatelet [Tue, 7 Feb 2023 11:05:53 +0000 (11:05 +0000)]
[libc][NFC] Rename compiler_feature macros

20 months ago[libc][NFC] Move sanitizer to macros folder
Guillaume Chatelet [Tue, 7 Feb 2023 10:58:13 +0000 (10:58 +0000)]
[libc][NFC] Move sanitizer to macros folder

20 months ago[AArch64][SME2] Add multi-vector floating point min/max number intrinsics
Kerry McLaughlin [Tue, 7 Feb 2023 10:45:29 +0000 (10:45 +0000)]
[AArch64][SME2] Add multi-vector floating point min/max number intrinsics

Adds IR intrinsics for the following SME2 instructions:
 - fmaxnm/fminnm (single, 2 & 4 vector)
 - fmaxnm/fminnm (multi, 2 & 4 vector)

NOTE: These intrinsics are still in development and are subject to future changes.

Reviewed By: david-arm

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

20 months ago[NFC][TargetParser] Remove llvm/Support/TargetParser.h
Archibald Elliott [Tue, 7 Feb 2023 11:08:21 +0000 (11:08 +0000)]
[NFC][TargetParser] Remove llvm/Support/TargetParser.h

20 months ago[NFC][TargetParser] Remove llvm/Support/X86TargetParser.h
Archibald Elliott [Fri, 3 Feb 2023 14:38:31 +0000 (14:38 +0000)]
[NFC][TargetParser] Remove llvm/Support/X86TargetParser.h

20 months ago[NFC][TargetParser] Remove llvm/Support/X86TargetParser.def
Archibald Elliott [Fri, 3 Feb 2023 14:37:04 +0000 (14:37 +0000)]
[NFC][TargetParser] Remove llvm/Support/X86TargetParser.def

20 months ago[NFC][TargetParser] Remove llvm/Support/LoongArchTargetParser.h
Archibald Elliott [Fri, 3 Feb 2023 14:35:45 +0000 (14:35 +0000)]
[NFC][TargetParser] Remove llvm/Support/LoongArchTargetParser.h

20 months ago[NFC][TargetParser] Remove llvm/Support/CSKYTargetParser.h
Archibald Elliott [Fri, 3 Feb 2023 14:34:32 +0000 (14:34 +0000)]
[NFC][TargetParser] Remove llvm/Support/CSKYTargetParser.h

20 months ago[NFC][TargetParser] Remove llvm/Support/ARMTargetParserCommon.h
Archibald Elliott [Fri, 3 Feb 2023 14:31:29 +0000 (14:31 +0000)]
[NFC][TargetParser] Remove llvm/Support/ARMTargetParserCommon.h

20 months ago[NFC][TargetParser] Remove llvm/Support/ARMTargetParser.h
Archibald Elliott [Fri, 3 Feb 2023 14:29:12 +0000 (14:29 +0000)]
[NFC][TargetParser] Remove llvm/Support/ARMTargetParser.h

20 months ago[SDAG] Check fminnum/fmaxnum for non-zero operand.
Samuel Parker [Mon, 6 Feb 2023 15:32:52 +0000 (15:32 +0000)]
[SDAG] Check fminnum/fmaxnum for non-zero operand.

Currently, in TargetLowering, if the target does not support fminnum, we lower
to fminimum if neither operand could be a NaN. But this isn't quite correct
because fminnum and fminimum treat +/-0 differently; so, we need to prove that
one of the operands isn't a zero, or we don't have signed zeros.

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

20 months ago[NFC] minnum/maxnum intrinsic tests
Samuel Parker [Tue, 7 Feb 2023 10:45:14 +0000 (10:45 +0000)]
[NFC] minnum/maxnum intrinsic tests

ARM and WebAssembly tests.

20 months ago[ARM] Remove reduce(shuffle) if all the lanes are used
David Green [Tue, 7 Feb 2023 10:44:35 +0000 (10:44 +0000)]
[ARM] Remove reduce(shuffle) if all the lanes are used

This looks for vaddv(shuffle) or vmlav(shuffle, shuffle), with a shuffle where
all the lanes are used once. Due to the reduction being commutative the shuffle
can be removed.

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

20 months ago[libc][NFC] Move compiler_features to macros folder
Guillaume Chatelet [Tue, 7 Feb 2023 10:40:08 +0000 (10:40 +0000)]
[libc][NFC] Move compiler_features to macros folder

20 months ago[mlir][bufferize] Add noAnalysisFuncFilter to OneShotBufferizationOptions struct
Maya Amrami [Mon, 6 Feb 2023 17:13:33 +0000 (19:13 +0200)]
[mlir][bufferize] Add noAnalysisFuncFilter to OneShotBufferizationOptions struct

This change is needed in order to set the flag when running the pass not via the command line.
It also allows simplifying the signature of some functions.

Reviewed By: springerm

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

20 months agoRevert "[DAGCombine] Fold redundant select"
Samuel Parker [Tue, 7 Feb 2023 10:30:39 +0000 (10:30 +0000)]
Revert "[DAGCombine] Fold redundant select"

This reverts commit bbdf24357932b064f2aa18ea1356b474e0220dde.

20 months ago[libc][NFC] Move cpu_features to macros folder
Guillaume Chatelet [Tue, 7 Feb 2023 10:32:03 +0000 (10:32 +0000)]
[libc][NFC] Move cpu_features to macros folder

20 months ago[flang] add -fstack-arrays flag
Tom Eccles [Wed, 4 Jan 2023 13:03:31 +0000 (13:03 +0000)]
[flang] add -fstack-arrays flag

The implementation of -fstack-arrays was added in
https://reviews.llvm.org/D140415

The new macro BoolOptionWithoutMarshalling in Options.td avoids
generating code to store the flags in clang data structures. For
example, writing something like

  defm stack_arrays : BoolOption<"f", "stack-arrays",
                                 CodeGenOpts<"StackArrays">, [...]

Would generate code referring to `clang::CodeGenOpts::StackArrays`, which
does not exist.

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

20 months ago[flang] add a pass to move array temporaries to the stack
Tom Eccles [Fri, 9 Dec 2022 18:07:31 +0000 (18:07 +0000)]
[flang] add a pass to move array temporaries to the stack

This pass implements the `-fstack-arrays` flag. See the RFC in
`flang/docs/fstack-arrays.md` for more information.

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

20 months ago[libc][NFC] Rename architecture macros and move to macros folder
Guillaume Chatelet [Tue, 7 Feb 2023 10:19:12 +0000 (10:19 +0000)]
[libc][NFC] Rename architecture macros and move to macros folder

20 months ago[ARM] Add various tests for reductions of shuffles. NFC
David Green [Tue, 7 Feb 2023 10:06:58 +0000 (10:06 +0000)]
[ARM] Add various tests for reductions of shuffles. NFC

20 months ago[PHITransAddr] Simplify casts in PHITransAddr
Sergey Kachkov [Thu, 2 Feb 2023 10:21:48 +0000 (13:21 +0300)]
[PHITransAddr] Simplify casts in PHITransAddr

Try to simplify cast in similar way as for GEP and ADD with
constant (e.g. sext/zext + trunc).

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

20 months ago[NFC] Add pre-commit test for simplifyCastInst in PHITransAddr
Sergey Kachkov [Fri, 3 Feb 2023 10:19:59 +0000 (13:19 +0300)]
[NFC] Add pre-commit test for simplifyCastInst in PHITransAddr

20 months ago[NFC][clang] Fix static analyzer concern about uninitialized variable
Mariya Podchishchaeva [Tue, 7 Feb 2023 09:25:05 +0000 (04:25 -0500)]
[NFC][clang] Fix static analyzer concern about uninitialized variable

Reviewed By: xazax.hun

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

20 months ago[libc][doc] Update compiler
Guillaume Chatelet [Mon, 6 Feb 2023 13:03:18 +0000 (13:03 +0000)]
[libc][doc] Update compiler

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

20 months ago[Tooling/Inclusion] Move the StdSpecialSymbolMap.inc to the private lib place.
Haojian Wu [Tue, 7 Feb 2023 09:25:48 +0000 (10:25 +0100)]
[Tooling/Inclusion] Move the StdSpecialSymbolMap.inc to the private lib place.

I missed it in c751264aa19865beab12d94db3ea966c6accd428.

20 months ago[libc][doc] Add macros guidelines
Guillaume Chatelet [Mon, 6 Feb 2023 16:46:31 +0000 (16:46 +0000)]
[libc][doc] Add macros guidelines

This is a first follow up on the libc tuning RFC
https://discourse.llvm.org/t/rfc-llvm-libc-tuning/67980

Once we agree on the format. I'll land a couple of patches to match the guidelines.

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

20 months ago[Tooling/Inclusion] Introduce a human-edit file for C++ std symbols
Haojian Wu [Tue, 7 Feb 2023 09:13:45 +0000 (10:13 +0100)]
[Tooling/Inclusion] Introduce a human-edit file for C++ std symbols

This file is allowed to be edit by human, and it overlays the generated symbol file.
It contains a list of multiple-header symbols.
This patch introduces the file only. Usage will come afterwards.

Reviewed By: kadircet

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

20 months ago[Tooling/Inclusion] Move the generated mapping .inc file to private places.
Haojian Wu [Mon, 6 Feb 2023 15:07:20 +0000 (16:07 +0100)]
[Tooling/Inclusion] Move the generated mapping .inc file to private places.

The .inc files are private now, clients should tooling::stdlib APIs instead.

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

20 months ago[flang][hlfir] place scalar in memory in convertToBox/convertToAddress
Jean Perier [Tue, 7 Feb 2023 08:25:31 +0000 (09:25 +0100)]
[flang][hlfir] place scalar in memory in convertToBox/convertToAddress

Implement the TODO. Be careful to use and propagate the expression
type to create the temporary since the mlir value may have been computed
with a different value type (e.g., i1 for logical) that should not be
used for in memory values that must have Fortran types.

Co-authored-by: Tom Eccles <tom.eccles@arm.com>
Differential Revision: https://reviews.llvm.org/D143421

20 months ago[flang][NFC] addSymbol/lookupSymbol clean-up
Jean Perier [Tue, 7 Feb 2023 08:22:47 +0000 (09:22 +0100)]
[flang][NFC] addSymbol/lookupSymbol clean-up

HLFIR requires mapping symbol to a single mlir::Value (produced
by a fir::FortranVariableOpInterface), while the current lowering
maps the value to a fir::ExtdendedValue.

So far, the HLFIR symbol query was a special one. Hence, all the code
directly using symMap.lookupSymbol and symMap.addSymbol did not work
with the lowering to HLFIR.

Refactor the code so that symbol lookup and add symbol go through
the converter in a centralize place that handles the HLFIR case
(translate fir::FortranVariableOpInterface to fir::ExtdendedValue
in lookups, and generate hlfir.declare when adding symbols).

In the refactoring, fir::FortranVariableOpInterface is added as
a symbolBox variant to avoid special casing all lookups (shallowLookup...).

Remove some unused SymbolBox member function instead of updating
them.

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

20 months ago[flang] Use PointerAssociateLowerBounds when there is lower bounds
Valentin Clement [Tue, 7 Feb 2023 08:15:54 +0000 (09:15 +0100)]
[flang] Use PointerAssociateLowerBounds when there is lower bounds

The current code was not taking provided lower bounds when the pointer
is polymorphic and was just calling PointerAssociate. This patch
updates the behavior and use PointerAssociateLowerBounds with the provided
lower bounds.

Reviewed By: jeanPerier

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

20 months ago[cmake] Use LLVM_ENABLE_ASSERTIONS to enable assertions in libstdc++
Jay Foad [Sat, 21 Jan 2023 09:32:50 +0000 (09:32 +0000)]
[cmake] Use LLVM_ENABLE_ASSERTIONS to enable assertions in libstdc++

On my machine this showed no new failures in check-llvm and increased
the testing time from 138 to 142 seconds, for a Release build with
assertions enabled.

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