platform/upstream/llvm.git
2 years ago[test] Remove an outdated FIXME
Yuki Okushi [Fri, 27 May 2022 10:49:41 +0000 (19:49 +0900)]
[test] Remove an outdated FIXME

rG6a9c719ee1be4562a9e16f2c71ac3e51ef9c4292 removed the backticks and this FIXME comment is no longer necessary.

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

2 years ago[clangd] Remove a test with a duplicate of FileCacheTests
Yuki Okushi [Sun, 29 May 2022 01:11:10 +0000 (10:11 +0900)]
[clangd] Remove a test with a duplicate of FileCacheTests

FIXME says it should be removed so followed it.

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

2 years ago[CodeGen][AArch64] Add support for LDAPR
Alexander Shaposhnikov [Tue, 31 May 2022 21:40:50 +0000 (21:40 +0000)]
[CodeGen][AArch64] Add support for LDAPR

This diff adds support for LDAPR (RCPC extension)
(https://github.com/llvm/llvm-project/issues/55561).

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

Test plan: ninja check-all

2 years ago[mlir][sparse] Improving the FATAL macro
wren romano [Tue, 31 May 2022 20:06:10 +0000 (13:06 -0700)]
[mlir][sparse] Improving the FATAL macro

The previous macro definition using `{...}` would fail to compile when the callsite uses a semicolon followed by an else-statement (i.e., `if (...) FATAL(...); else ...;`).  Replacing the simple braces with `do{...}while(0)` (n.b., semicolon not included in the macro definition) enables callsites to use the semicolon plus else-statement syntax without problems.  The new definition now requires the semicolon at all callsites, but since it was already being called that way nothing changes.

For more explanation, see <https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html>

Reviewed By: aartbik

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

2 years ago[Bazel] Fix typo: startlark=>starlark
Fangrui Song [Tue, 31 May 2022 21:12:40 +0000 (14:12 -0700)]
[Bazel] Fix typo: startlark=>starlark

2 years ago[AMDGPU] Fix image opcodes GlobalISel on gfx90a.
Stanislav Mekhanoshin [Tue, 24 May 2022 18:43:00 +0000 (11:43 -0700)]
[AMDGPU] Fix image opcodes GlobalISel on gfx90a.

- Correct flavor of an instruction was not selected.
- GFX90A does not support TFE.

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

2 years ago[gn build] Port 13e1a653278b
LLVM GN Syncbot [Tue, 31 May 2022 21:00:23 +0000 (21:00 +0000)]
[gn build] Port 13e1a653278b

2 years ago[flang][nfc] Fix Windows build
Andrzej Warzynski [Tue, 31 May 2022 20:57:35 +0000 (20:57 +0000)]
[flang][nfc] Fix Windows build

* Breaking change: https://reviews.llvm.org/D125832
* Buildbot failure: https://lab.llvm.org/buildbot/#/builders/172/builds/13123

Sending this without a review - this is a rather straightforward fix.

2 years ago[libc] add fprintf and file_writer
Michael Jones [Wed, 18 May 2022 23:58:17 +0000 (16:58 -0700)]
[libc] add fprintf and file_writer

This patch adds the file_writer header, which just provides a wrapper
for File->write, as well as fprintf to use it. There are no unit tests
for file_writer since it's too simple to need them, but fprintf does
have a simple test of writing to a file.

Reviewed By: sivachandra

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

2 years ago[HLSL] Enable vector types for hlsl.
Xiang Li [Thu, 5 May 2022 22:31:22 +0000 (15:31 -0700)]
[HLSL] Enable vector types for hlsl.

Vector types in hlsl is using clang ext_vector_type.
Declaration of vector types is in builtin header hlsl.h.
hlsl.h will be included by default for hlsl shader.

Reviewed By: Anastasia

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

2 years ago[BOLT] [AArch64] Handle constant islands spanning multiple functions
Denis Revunov [Tue, 31 May 2022 18:50:59 +0000 (11:50 -0700)]
[BOLT] [AArch64] Handle constant islands spanning multiple functions

Fix BOLT's constant island mapping when a constant island marked by $d
spans multiple functions. Currently, because BOLT only marks the
constant island in the first function where $d is located, if the next
function contains data at its start, BOLT will miss the data and try
to disassemble it. This patch adds code to explicitly go through all
symbols between $d and $x markers and mark their respective offsets as
data, which stops BOLT from trying to disassemble data. It also adds
MarkerType enum and refactors related functions.

Reviewed By: yota9, rafauler

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

2 years agoRevert "[clangd] Fix hover crashing on integral or enumeral casts"
Sam McCall [Tue, 31 May 2022 20:29:37 +0000 (22:29 +0200)]
Revert "[clangd] Fix hover crashing on integral or enumeral casts"

This reverts commit ce5ebf0b9113df8ccaec1bcfd6804fb16cdef69d.

Fails on bots e.g. https://buildkite-cloud.s3.amazonaws.com/logs-by-pipeline/f8ab115f-a384-49e8-a048-0f71ab03c5d0/0181020b-0737-40e5-a05a-ab198347d8ad/0181020b-ecbe-4ac6-ad23-e04c17217893.log?response-content-disposition=inline&response-content-type=text%2Fplain&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQPCP3C7LT7IGTS76%2F20220531%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220531T202904Z&X-Amz-Expires=600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEDwaCXVzLWVhc3QtMSJGMEQCIEfw6ocELTUWa2mj4reHKLe5OdUmQqVJpPsdZS2wNDhhAiB7qx6Q17HVVY%2BkJZ5hwTQ6b1MkOG4czysfciD9GghJmCrSBAg1EAAaDDAzMjM3OTcwNTMwMyIMgdUfJT4A6wcP2hl2Kq8EefYtGIt0yaiOSfuq05UzI6WcBY9yOOyYCs3%2FJJDvK3jkpiYQhjA1kgVluePIb3P4yOTXs8lv9U6p8HU555Vzvrv1Wg%2FGvx7U398lH8zg%2BqkvEwnpGuRf0pTInPJftg2bgm%2F7l%2BCM6PtW4mRlzjeQ0IoA3AeENqVM35RYtQdh%2BcAZIfV4l7uAySVgwY1yFu0XznuGAVVryZyYcA2cjKkkNE%2F9n2QTo80%2FbZBvoh1bxJqXRbs5WrSnWlIEj3RPX61ir7lDpRNL5tyVlqsv%2BvV01aS%2F9JbM4cNDXZ%2BDwOR1Q%2By1ajJOomuK9Bqm%2Fq8%2B9%2Byo1t8rFSN7I4X%2BGGuicXFQQnIJAkW3zSQlx9SWrf2uDg7cbXL4MukD9cQB5aN8yX85a%2BRcbb5l4%2BOC%2B8UFKMeemUZyEl5PyyJSBnAnzqvKviJPev9Thj9rZeHGEJD9vOkVM%2FG2tOlC7HUxXAE4kuLlAdeKdIOtHz%2Bx8FzRn%2Bgl6EB2nB4kSVLvfgrsrlHS0L0J1zWbN%2F6prqzum%2FEVIhT7Y5fyZRqtygAX2n7iBjQEM3vpF2GTneUI1FlDeQvGPLADFdq7bXSUOt577YOTw1mW1JzqmZljrJeIM40HdMYnuIg3%2FwW8oK6RKGADdW7URPw%2FoFeGKfrnN%2BuDwJKvrRGCpReseGse2sdYIe28rgGHpc5xsp3pzipQDLfW3hTNtM%2FNNuPJjUWZoBRTMr2eMuk2zs2c6jNvnuBTbgXjcdjCbjCX2dmUBjqqAUalggvk2TGoJzTuqAT%2Fj1kz0vnHdmsHY3B9aR2kY501gISXQMKj7l03E7OfFsu4oPzEgmnyQFKcAolRDI%2F7NRmG8HwtP40iTCjflOHIxkJ1%2FnVNqkeyIznUu6zOr589zIjNqFCm74jOfWjj2%2FO8WU4pc%2FRqeBuGzzpQkAIGGxCwsmd3WG8Z8pyMoJomij7c4LO6ep4O0OUESxbXHcIfzUfR6ajPsKFKS9lb&X-Amz-SignedHeaders=host&X-Amz-Signature=96a132be6f99b5cd5cf29f3226115e480508079047bc8639d69c672f1fe9f0c1

2 years ago[mlir][sparse] Factoring out SparseTensorFile class for readSparseTensorShape
wren romano [Tue, 31 May 2022 19:55:01 +0000 (12:55 -0700)]
[mlir][sparse] Factoring out SparseTensorFile class for readSparseTensorShape

The primary goal of this change is to define readSparseTensorShape.  Whereas the SparseTensorFile class is merely introduced as a way to reduce code duplication along the way.

Depends On D126106

Reviewed By: aartbik

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

2 years ago[HLSL][clang][Driver] Parse target profile early to update Driver::TargetTriple.
Xiang Li [Fri, 13 May 2022 21:36:27 +0000 (14:36 -0700)]
[HLSL][clang][Driver] Parse target profile early to update Driver::TargetTriple.

This is to avoid err_target_unknown_abi which is caused by use default TargetTriple instead of shader model target triple.

Reviewed By: beanz

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

2 years ago[clangd] Fix hover crashing on integral or enumeral casts
Georg Kotheimer [Tue, 31 May 2022 19:57:51 +0000 (21:57 +0200)]
[clangd] Fix hover crashing on integral or enumeral casts

When pretty printing the value of an expression, we cannot infer from
the type of the expression the type of the constant that the expression
evaluates to, as the expression might contain a type cast.

2 years ago[windows] Remove unused pybind exception params
Nathaniel McVicar [Tue, 31 May 2022 17:03:48 +0000 (10:03 -0700)]
[windows] Remove unused pybind exception params

Resolve MSVC warning C4104 for unreferenced variable

Reviewed By: mehdi_amini

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

2 years ago[BOLT] Allow merge-fdata to take a directory as input
Yi Kong [Tue, 31 May 2022 13:14:31 +0000 (21:14 +0800)]
[BOLT] Allow merge-fdata to take a directory as input

and recursively merge all files under said directory. This is similar
to `llvm-profdata merge`.

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

2 years ago[pseudo] Respect LLVM_USE_HOST_TOOLS
Sam McCall [Tue, 31 May 2022 18:45:22 +0000 (20:45 +0200)]
[pseudo] Respect LLVM_USE_HOST_TOOLS

This is the intended way to request that build-time tools be built in a
distinct configuration.

This is set implicitly by LLVM_OPTIMIZED_TABLEGEN, which may be
surprising, but if undesired this should be fixed elsewhere.

Should fix crbug.com/1330304

2 years ago[BOLT] Fix LIT tests on Windows VS2019
Rafael Auler [Tue, 31 May 2022 18:45:15 +0000 (11:45 -0700)]
[BOLT] Fix LIT tests on Windows VS2019

Fix newline issue in link_fdata.py, as well as how to call the tool.

Reviewed By: Amir

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

2 years ago[flang] Rename `flang` as `flang-to-external-fc`
Andrzej Warzynski [Tue, 17 May 2022 19:36:27 +0000 (19:36 +0000)]
[flang] Rename `flang` as `flang-to-external-fc`

Our ultimate goal is to rename `flang-new` as `flang`. This is "Step 1"
in which we only rename the bash wrapper script, `flang`, as
`flang-to-external-fc`. The new name more accurately reflects what the
wrapper script does.

With this patch, `flang` becomes a symbolic link pointing to
`flang-to-external-fc`. This allows a smooth transmission for any
buildbots that use this script. Once the buildbots are reconfigured to
use the updated name, CMake rule for the symbolic link will be removed.

For more context see:
  * https://discourse.llvm.org/t/rename-flang-new-as-flang,
  * https://reviews.llvm.org/D125788.

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

2 years ago[DFSan] build-libc-list.py no longer provides a list of default files.
Andrew Browne [Wed, 25 May 2022 22:40:01 +0000 (15:40 -0700)]
[DFSan] build-libc-list.py no longer provides a list of default files.

Reviewed By: vitalybuka

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

2 years ago[libc++][CI] AIX does not have alternative for time_put_byname
zhijian [Tue, 31 May 2022 18:20:34 +0000 (14:20 -0400)]
[libc++][CI] AIX does not have alternative for time_put_byname

Reviewers: David Tenty, Mark de Wever

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

2 years agoCreate specialization of -Wgnu-statement-expression for expressions found in macros.
Michael Wyman [Fri, 27 May 2022 05:39:04 +0000 (22:39 -0700)]
Create specialization of -Wgnu-statement-expression for expressions found in macros.

-Wgnu-statement-expression currently warns for both direct source uses of statement expressions but also macro expansions; since they may be used by macros to avoid multiple evaluation of macro arguments, engineers might want to suppress warnings when statement expressions are expanded from macros but see them if introduced directly in source code.

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

2 years ago[libc++][CI] fixed "LOCALE_fr_FR_UTF_8" for my_facet for AIX
zhijian [Tue, 31 May 2022 18:12:01 +0000 (14:12 -0400)]
[libc++][CI] fixed "LOCALE_fr_FR_UTF_8" for my_facet for AIX

SUMMARY:

fixed "LOCALE_fr_FR_UTF_8" for my_facet for AIX

Reviewers: David Tenty, Mark de Wever

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

2 years ago[MLIR][Presburger] Simplex::computeOptimum: slightly simplify code (NFC)
Arjun P [Wed, 25 May 2022 15:46:45 +0000 (16:46 +0100)]
[MLIR][Presburger] Simplex::computeOptimum: slightly simplify code (NFC)

2 years ago[gn build] Port 2e61dfb1249e
LLVM GN Syncbot [Tue, 31 May 2022 17:57:18 +0000 (17:57 +0000)]
[gn build] Port 2e61dfb1249e

2 years ago[libc++][CI] fixed convert_thousands_sep_ru_RU for Russian in the libcxx/test/support...
zhijian [Tue, 31 May 2022 17:55:59 +0000 (13:55 -0400)]
[libc++][CI] fixed convert_thousands_sep_ru_RU for Russian in the libcxx/test/support/locale_helpers.h for AIX

Reviewers: David Tenty, Mark de Wever

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

2 years ago[AMDGPU] Instruction Type Pipeline
jeff [Mon, 16 May 2022 18:13:20 +0000 (11:13 -0700)]
[AMDGPU] Instruction Type Pipeline

This patch implements a DAG mutation which adds edges between different groups of instructions. The purpose is to try to generate code that conforms to a pipeline (groupA instructions occur before groupB, groupB -> groupC, and so on). Currently the pipeline order is hardcoded as VMEM->DSRead->MFMA->DSWrite, but the patch was designed to be easily extensible. Alias analysis is problematic for pipelining as memory instructions will usually not be able to be reordered w.r.t one another.

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

2 years agoFix windows build
Alex Brachet [Tue, 31 May 2022 17:31:55 +0000 (17:31 +0000)]
Fix windows build

2 years ago[clang][Driver] Fix SIE builders
Alex Brachet [Tue, 31 May 2022 17:24:58 +0000 (17:24 +0000)]
[clang][Driver] Fix SIE builders

2 years ago[riscv] add test coverage for fractional lmul w/fixed length vectorization
Philip Reames [Tue, 31 May 2022 17:09:44 +0000 (10:09 -0700)]
[riscv] add test coverage for fractional lmul w/fixed length vectorization

2 years ago[RISCV] Use two ADDIs to do some stack pointer adjustments.
Craig Topper [Tue, 31 May 2022 17:14:34 +0000 (10:14 -0700)]
[RISCV] Use two ADDIs to do some stack pointer adjustments.

If the adjustment doesn't fit in 12 bits, try to break it into
two 12 bit values before falling back to movImm+add/sub.

This is based on a similar idea from isel.

Reviewed By: luismarques, reames

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

2 years ago[libc++][CI][AIX] change grouping() return value of std::moneypunct_byname for en_US...
zhijian [Tue, 31 May 2022 17:20:31 +0000 (13:20 -0400)]
[libc++][CI][AIX] change grouping() return value of std::moneypunct_byname for en_US.UTF-8

Reviewers: David Tenty, Mark de Wever
Differential Revision: https://reviews.llvm.org/D126474

2 years ago[libc++] Removes __cpp_lib_monadic_optional.
Mark de Wever [Tue, 17 May 2022 17:15:18 +0000 (19:15 +0200)]
[libc++] Removes __cpp_lib_monadic_optional.

P0798R8 "Monadic operations for std::optional" has been implemented, so
this LWG issue can be adopted.

During review it was discovered another paper bumped the macro. The
part affecting optional of this paper is done, the variant isn't. The
status page is updated to reflect the current state.

Implements
- LWG 3621 Remove feature-test macro __cpp_lib_monadic_optional

Updates status of
- P2231R1 Missing constexpr in std::optional and std::variant

Reviewed By: #libc, philnik, ldionne

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

2 years ago[scudo] Ensure pointer is not null
Alex Brachet [Tue, 31 May 2022 17:16:49 +0000 (17:16 +0000)]
[scudo] Ensure pointer is not null

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

2 years ago[InstrProf] Stop exporting lprofDirMode
Alex Brachet [Tue, 31 May 2022 17:13:00 +0000 (17:13 +0000)]
[InstrProf] Stop exporting lprofDirMode

This symbol should not be exposed and doesn't need to be.

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

2 years ago[Clang] Extend -gen-reproducer flag
Alex Brachet [Tue, 31 May 2022 17:10:16 +0000 (17:10 +0000)]
[Clang] Extend -gen-reproducer flag

`-gen-reproducer` causes crash reproduction to be emitted
even when clang didn't crash, and now can optionally take an
argument of never, on-crash (default), on-error and always.

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

2 years ago[RISCV] Fix a few corner case bugs in RISCVMergeBaseOffsetOpt::matchLargeOffset
Craig Topper [Tue, 31 May 2022 16:43:43 +0000 (09:43 -0700)]
[RISCV] Fix a few corner case bugs in RISCVMergeBaseOffsetOpt::matchLargeOffset

The immediate for LUI is stored as 20-bit unsigned value. We need
to sign extend if after shifting by 12 to match the instruction
behavior.

If we find an LUI+ADDI on RV64, it means the constant isn't a
simm32. If it was, we would have emitted LUI+ADDIW from constant
materialization. Make sure the constant is a simm32 before folding.
This appears to match gcc.

A future patch will add support for LUI+ADDIW on RV64.

2 years ago[RISCV] Pre-commit tests for D126635. NFC
Craig Topper [Tue, 31 May 2022 16:41:03 +0000 (09:41 -0700)]
[RISCV] Pre-commit tests for D126635. NFC

2 years ago[InstCombine] fold icmp of sext bool based on limited range
Sanjay Patel [Tue, 31 May 2022 15:39:29 +0000 (11:39 -0400)]
[InstCombine] fold icmp of sext bool based on limited range

X <=u (sext i1 Y) --> (X == 0) | Y

https://alive2.llvm.org/ce/z/W_tZzo

This is the conjugate/sibling pattern suggested with D126171
for a sign-extended bool value.

2 years ago[InstCombine] add tests for icmp of sext i1; NFC
Sanjay Patel [Tue, 31 May 2022 15:02:43 +0000 (11:02 -0400)]
[InstCombine] add tests for icmp of sext i1; NFC

These are adapted from the zext tests added for D126171.

2 years ago[X86] Add test case for PR55648
Simon Pilgrim [Tue, 31 May 2022 16:21:34 +0000 (17:21 +0100)]
[X86] Add test case for PR55648

2 years ago[X86] LowerMINMAX - split v4i64 types on AVX1 targets (Issue #55648)
Simon Pilgrim [Tue, 31 May 2022 16:17:39 +0000 (17:17 +0100)]
[X86] LowerMINMAX - split v4i64 types on AVX1 targets (Issue #55648)

Originally we tried to use default expansion for v4i64 types to make it easier to concatenate the results back together, but this can cause infinite loop issues with existing VSELECT splitting code in narrowExtractedVectorSelect if we have other uses of the VSELECT results (e.g. reduction patterns).

To fix the infinite loop, this patch always splits MIN/MAX v4i64 nodes during lowering and I've added a TODO for combineConcatVectorOps to investigate when we can cheaply concatenate VSELECT/BLENDV nodes together.

Fixes #55648 - regression test case will be added in a follow up.

2 years ago[Clang][Docs] Fix typo in offload packager reference
Joseph Huber [Tue, 31 May 2022 16:27:15 +0000 (12:27 -0400)]
[Clang][Docs] Fix typo in offload packager reference

2 years ago[MLIR][Math] Improve docs (NFC)
lorenzo chelini [Mon, 30 May 2022 10:19:10 +0000 (12:19 +0200)]
[MLIR][Math] Improve docs (NFC)

Remove boilerplate examples and add a text at the dialect level to describe
what kind of operands the operations accept (i.e., scalar, tensor or vector).
Left a shorter sentence describing the input operands for each operation as
this redundancy is convenient when browsing the documentation using the
website.

Reviewed By: ftynse

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

2 years ago[Clang][Docs] Document the clang-offload-packager better
Joseph Huber [Tue, 31 May 2022 15:52:44 +0000 (11:52 -0400)]
[Clang][Docs] Document the clang-offload-packager better

Summary:
This patch adds more in-depth documentation to the
clang-offload-packacker's binary format. This format is used to create
fat binaries and link them.

2 years ago[clangd] Minor fixes to ExtractVariableTests missed in D124486
David Goldman [Tue, 31 May 2022 15:32:23 +0000 (11:32 -0400)]
[clangd] Minor fixes to ExtractVariableTests missed in D124486

2 years ago[flang] Support BIND(C) variable scope check
PeixinQiao [Tue, 31 May 2022 15:26:00 +0000 (23:26 +0800)]
[flang] Support BIND(C) variable scope check

As Fortran 2018 C819, a variable with the BIND attribute shall be declared
in the specification part of a module. Add the support for this check.

Reviewed By: klausler

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

2 years ago[Scalarizer] Regenerate test checks (NFC)
Nikita Popov [Tue, 31 May 2022 15:21:58 +0000 (17:21 +0200)]
[Scalarizer] Regenerate test checks (NFC)

2 years ago[PS5] Tweak dllexport test
Paul Robinson [Tue, 31 May 2022 15:21:10 +0000 (08:21 -0700)]
[PS5] Tweak dllexport test

Post-commit review pointed out that both PS4 and PS5 were using the
same -std argument, better to use different ones just in case.

2 years ago[AMDGPU] gfx11 Image instructions
Joe Nash [Thu, 12 May 2022 13:27:48 +0000 (09:27 -0400)]
[AMDGPU] gfx11 Image instructions

MC layer support for instructions in the MIMG encoding(Image
instructions).

Contributors:
Carl Ritson <carl.ritson@amd.com>

Patch 13/N for upstreaming of AMDGPU gfx11 architecture.

Depends on D125992

Reviewed By: rampitec, #amdgpu

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

2 years ago[clangd] ExtractVariable support for C and Objective-C
David Goldman [Tue, 26 Apr 2022 19:30:50 +0000 (15:30 -0400)]
[clangd] ExtractVariable support for C and Objective-C

- Use the expression's type for non-C++ as the variable type. This works
  well, but might not preserve the typedefs due to type
  canonicalization.

- Improve support for Objective-C property references which are
  represented using `ObjCPropertyRefExpr` and `BuiltinType::PseudoObject`.

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

2 years ago[X86] combineEXTRACT_SUBVECTOR - pull out repeated getVectorNumElements() calls....
Simon Pilgrim [Tue, 31 May 2022 15:13:41 +0000 (16:13 +0100)]
[X86] combineEXTRACT_SUBVECTOR - pull out repeated getVectorNumElements() calls. NFC.

2 years agoLangRef: fix bad indentation in allockind bullets
Augie Fackler [Tue, 31 May 2022 15:06:15 +0000 (11:06 -0400)]
LangRef: fix bad indentation in allockind bullets

2 years ago[Driver][Modules] Remove dependence on linking support from clang/test/Driver/modules.cpp
Daniel McIntosh [Mon, 30 May 2022 17:13:29 +0000 (13:13 -0400)]
[Driver][Modules] Remove dependence on linking support from clang/test/Driver/modules.cpp

The new tests in clang/test/Driver/modules.cpp added by D120540 will fail if the
toolchain getting tested doesn't support linking. This reduces the utility of
the test since we would like a failure of this test to reflect a problem with
modules. We should already have other tests that validate linking support.

Reviewed By: ChuanqiXu

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

2 years ago[AArch64] Remove references to Streaming SVE from target features.
Sander de Smalen [Wed, 18 May 2022 06:26:50 +0000 (07:26 +0100)]
[AArch64] Remove references to Streaming SVE from target features.

Following discussion on D120261 and D121208 it seems better to remove the
concept of Streaming SVE from the subtarget/assembler predicates and
instead reason about 'SVE' and 'SME' as its higher level features, rather
than trying to model this runtime mode through explicit feature flags.

This patch is largely NFC.

Reviewed By: paulwalker-arm, david-arm

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

2 years agoRevert "[Libomptarget] Add `leaf` attribute to `vprintf` declaration"
Joseph Huber [Tue, 31 May 2022 14:14:51 +0000 (10:14 -0400)]
Revert "[Libomptarget] Add `leaf` attribute to `vprintf` declaration"

This is preventing users from calling `printf` on NVPTX code. Revert for
now until there is a fix.

This reverts commit eda4ef3add4d25345e0b29580776f1576040c525.

2 years agoBuildLibCalls: infer allockind attributes on relevant functions
Augie Fackler [Tue, 29 Mar 2022 18:27:30 +0000 (14:27 -0400)]
BuildLibCalls: infer allockind attributes on relevant functions

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

2 years agoattributes: introduce allockind attr for describing allocator fn behavior
Augie Fackler [Tue, 29 Mar 2022 15:14:07 +0000 (11:14 -0400)]
attributes: introduce allockind attr for describing allocator fn behavior

I chose to encode the allockind information in a string constant because
otherwise we would get a bit of an explosion of keywords to deal with
the possible permutations of allocation function types.

I'm not sure that CodeGen.h is the correct place for this enum, but it
seemed to kind of match the UWTableKind enum so I put it in the same
place. Constructive suggestions on a better location most certainly
encouraged.

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

2 years ago[X86] narrowExtractedVectorSelect - don't peek through bitcasts to find source vector
Simon Pilgrim [Tue, 31 May 2022 13:57:10 +0000 (14:57 +0100)]
[X86] narrowExtractedVectorSelect - don't peek through bitcasts to find source vector

We don't seem to need this for any test coverage and it was making tracking of the uses() of the source vector more difficult

Noticed while investigating Issue #55648

2 years ago[InstCombine] Fix inbounds preservation when swapping GEPs (PR44206)
Nikita Popov [Mon, 30 May 2022 15:09:40 +0000 (17:09 +0200)]
[InstCombine] Fix inbounds preservation when swapping GEPs (PR44206)

When reassociating GEPs, we can only keep inbounds if both original
GEPs were inbounds, and their offsets have the same sign. For the
sake of simplicity, I only handle the case where both offsets are
non-negative here.

It would probably be fine to just not preserve inbounds at all here,
but as I don't see a compile-time impact for adding the
isKnownNonNegative() calls I went with this more conservative
approach.

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

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

2 years ago[Clang] Always set opaque pointers mode
Nikita Popov [Tue, 31 May 2022 13:40:46 +0000 (15:40 +0200)]
[Clang] Always set opaque pointers mode

Always set the opaque pointers mode, to make sure that
-no-opaque-pointers continues working when the default on the LLVM
side is flipped.

2 years ago[X86] LowerTRUNCATE - avoid creating extract_subvector(bitcast(vec)) patterns
Simon Pilgrim [Tue, 31 May 2022 13:30:28 +0000 (14:30 +0100)]
[X86] LowerTRUNCATE - avoid creating extract_subvector(bitcast(vec)) patterns

We have a generic DAG combine to attempt to fold extract_subvector(bitcast(vec)) -> bitcast(extract_subvector(vec)) but if we create these patterns late in lowering then we often miss them.

Noticed while investigating Issue #55648 which gets caught in an infinite loop trying to split extract_subvector(bitcast(vselect()) patterns - this doesn't fix the issue yet but reduces the regressions from the WIP fix.

2 years ago[libc++abi][AIX] add personality and helper functions for the state table EH
Xing Xue [Tue, 31 May 2022 13:21:34 +0000 (09:21 -0400)]
[libc++abi][AIX] add personality and helper functions for the state table EH

Summary:
This patch adds the personality and helper functions for the state table based EH used by IBM legacy compilers xlC and xlclang++ on AIX.

 * A high level description of the state table based EH is provided in the code comments.

 * Function scan_state_tab() is added to scan the state table. It is invoked by the state table personality routine __xlcxx_personality_v0() and returns scan_results like scan_eh_tab() does.

 * A couple of EH helper functions used by xlC and xlclang++ generated code are also added, e.g., __xlc_catch_matchv2() which checks whether the thrown object matches the catch handler's exception type.

 * Debugging macros _LIBCXXABI_TRACE_STATETAB, _LIBCXXABI_TRACE_STATETAB0, and _LIBCXXABI_TRACING_STATETAB are added to dump state table scanning traces if environment variable LIBCXXABI_PRINT_STATTAB is set.

 * The state variable and state table data is the LSDA found from the traceback table of the function during unwinding.

Reviewed by: MaskRay, cebowleratibm, libc++abi

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

2 years ago[NFC] Change LoopVectorizationCostModel::useOrderedReductions() to be a const function.
Mel Chen [Tue, 31 May 2022 12:38:44 +0000 (05:38 -0700)]
[NFC] Change LoopVectorizationCostModel::useOrderedReductions() to be a const function.

Reviewed By: fhahn

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

2 years ago[InstCombine] Fix const folding of switches with default case
Danila Malyutin [Mon, 30 May 2022 13:30:49 +0000 (16:30 +0300)]
[InstCombine] Fix const folding of switches with default case

In case phi was in the default block it could lead to multi-edge.
Fixes #55721.

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

2 years ago[mlir][Bazel] Adjust BUILD.bazel file
Adrian Kuegel [Tue, 31 May 2022 11:35:49 +0000 (13:35 +0200)]
[mlir][Bazel] Adjust BUILD.bazel file

2 years agoApply clang-tidy fixes for llvm-else-after-return in OpPythonBindingGen.cpp (NFC)
Mehdi Amini [Mon, 30 May 2022 14:44:00 +0000 (14:44 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in OpPythonBindingGen.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming in SparseTensorUtils.cpp...
Mehdi Amini [Mon, 30 May 2022 13:56:16 +0000 (13:56 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in SparseTensorUtils.cpp (NFC)

2 years ago[bazel] Port 42c17073fcba
Benjamin Kramer [Tue, 31 May 2022 11:47:01 +0000 (13:47 +0200)]
[bazel] Port 42c17073fcba

2 years ago[AMDGPU][DOC][NFC] Add GFX90C and GFX940 assembler syntax description
Dmitry Preobrazhensky [Tue, 31 May 2022 11:29:06 +0000 (14:29 +0300)]
[AMDGPU][DOC][NFC] Add GFX90C and GFX940 assembler syntax description

2 years ago[mlir] Support import llvm intrinsics.
jacquesguan [Mon, 30 May 2022 09:38:33 +0000 (09:38 +0000)]
[mlir] Support import llvm intrinsics.

This patch supports to convert the llvm intrinsic to the corresponding op. It still leaves some intrinsics to be handled specially.

Reviewed By: ftynse

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

2 years ago[InstCombine] Fix inbounds preservation when merging GEPs (PR55722)
Nikita Popov [Tue, 31 May 2022 09:51:19 +0000 (11:51 +0200)]
[InstCombine] Fix inbounds preservation when merging GEPs (PR55722)

Even if the total offset is inbounds, we might represent it by first
performing a large negative offset and then a small positive one.
With inbounds semantics as currently specified, each offset must
be inbounds individually, not just the overall offset of the GEP.

Fix this by checking that the sign of all offsets is the same.

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

2 years ago[Flang][OpenMP] Fix for unstructured regions in OpenMP constructs - 2
kiranchandramohan [Tue, 31 May 2022 09:25:00 +0000 (09:25 +0000)]
[Flang][OpenMP] Fix for unstructured regions in OpenMP constructs - 2

The following changes are made for OpenMP operations with unstructured region,
1. For combined constructs the outer operation is considered a structured
region and the inner one as the unstructured.
2. Added a condition to ensure that we create new blocks only once for nested
unstructured OpenMP constructs.

Tests are added for checking the structure of the CFG.

Note: This is part of upstreaming from the fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project. Code originally reviewed
at https://github.com/flang-compiler/f18-llvm-project/pull/1394.

Reviewed By: vdonaldson, shraiysh, peixin

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

2 years ago[RISCV][NFC] Adjust some comments in RISCVInsertVSETVLI
Fraser Cormack [Tue, 31 May 2022 09:12:30 +0000 (10:12 +0100)]
[RISCV][NFC] Adjust some comments in RISCVInsertVSETVLI

Capitalize the first letter of comments like the others, and a few other
tweaks.

2 years agoRevert "Round up zero-sized symbols to 1 byte in `.debug_aranges`."
Bjorn Pettersson [Tue, 31 May 2022 09:03:33 +0000 (11:03 +0200)]
Revert "Round up zero-sized symbols to 1 byte in `.debug_aranges`."

This reverts commit 256a52d9aac8a9e98fbfd6a3d91090bf127cef7d (and
also the follow-up commit 38eb4fe74b3843ab0d7fc1e that moved a test
case to a different directory).

As discussed in https://reviews.llvm.org/D126257 there is a suspicion
that something was wrong with this commit as text section range was
shortened to 1 byte rather than rounded up as shown in the
llvm/test/DebugInfo/X86/dwarf-aranges.ll test case.

2 years ago[AMDGPU][NFC] Refine defining the offset field for GFX10+ SMEM instructions.
Ivan Kosarev [Tue, 31 May 2022 08:54:11 +0000 (09:54 +0100)]
[AMDGPU][NFC] Refine defining the offset field for GFX10+ SMEM instructions.

Reviewed By: dp

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

2 years ago[AArch64] Look through copy in MachineCombiner FMUL patterns.
David Green [Tue, 31 May 2022 08:28:00 +0000 (09:28 +0100)]
[AArch64] Look through copy in MachineCombiner FMUL patterns.

This is a small addition to D99662, which added machine combiner
patterns for FMUL(DUP(..)). Due to the way these are generated from
ISel, they may also be FMUL(COPY(DUP(..))), which this patch now
ignores the no-op COPY in.

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

2 years ago[BOLT][NFC] Don't over-specify the size of SmallVector
Yi Kong [Tue, 31 May 2022 08:13:23 +0000 (16:13 +0800)]
[BOLT][NFC] Don't over-specify the size of SmallVector

This is the recommended way, should make merging profiles ever so
slightly faster.

2 years agoFix bazel build
Mikhail Goncharov [Tue, 31 May 2022 08:15:12 +0000 (10:15 +0200)]
Fix bazel build

After 1c2edb026ed67ddbb30ebe3e2d2f4f17a882a881

2 years ago[X86] Adjust vector test costs to match SoG (Issue #54889)
Simon Pilgrim [Tue, 31 May 2022 08:14:06 +0000 (09:14 +0100)]
[X86] Adjust vector test costs to match SoG (Issue #54889)

znver1/2 models were incorrectly modelling the latency/throughput/uops and znver1 ymm variants also require double pumping.

Now matches what I can decipher from the AMD SoG, Agner and instlatx64 numbers vs the llvm-exegesis report provided by @fabian-r

2 years ago[flang] Upstream the lowering of the while loop
Diana Picus [Wed, 25 May 2022 12:51:10 +0000 (12:51 +0000)]
[flang] Upstream the lowering of the while loop

Upstream the code for handling while loops from the fir-dev branch at
https://github.com/flang-compiler/f18-llvm-project/tree/fir-dev/

Also add tests.

The while loop is lowered to a header block that checks the loop
condition and branches either to the exit block or to the body of the
loop. The body of the loop will unconditionally branch back to the
header.

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: V Donaldson <vdonaldson@nvidia.com>
2 years agoRevert "[clang-repl] Recover the lookup tables of the primary context."
Vassil Vassilev [Tue, 31 May 2022 06:24:24 +0000 (06:24 +0000)]
Revert "[clang-repl] Recover the lookup tables of the primary context."

This reverts commit 5ff27fe1ff03d5aeaf8567c97618170f0cef8f58.

This patch caused failures in asan: https://lab.llvm.org/buildbot/#/builders/5/builds/24221

2 years ago[Clang][CSKY] Add support about CSKYABIInfo
Zi Xuan Wu (Zeson) [Fri, 20 May 2022 03:59:17 +0000 (11:59 +0800)]
[Clang][CSKY] Add support about CSKYABIInfo

According to the CSKY ABIv2 document, https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf
construct the ABIInfo to handle argument passing and return of clang data type. It also includes how to emit and expand VAArg intrinsic.

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

2 years ago[X86][NFC] Refine X86 Domain Reassignment for compiling time
Xiang1 Zhang [Mon, 30 May 2022 00:37:36 +0000 (08:37 +0800)]
[X86][NFC] Refine X86 Domain Reassignment for compiling time

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

2 years ago[mlir:PDLL] Rework the C++ generation of native Constraint/Rewrite arguments and...
River Riddle [Tue, 3 May 2022 02:24:53 +0000 (19:24 -0700)]
[mlir:PDLL] Rework the C++ generation of native Constraint/Rewrite arguments and results

The current translation uses the old "ugly"/"raw" form which used PDLValue for the arguments
and results. This commit updates the C++ generation to use the recently added sugar that
allows for directly using the desired types for the arguments and result of PDL functions.
In addition, this commit also properly imports the C++ class for ODS operations, constraints,
and interfaces. This allows for a much more convienent C++ API than previously granted
with the raw/low-level types.

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

2 years ago[mlir:PDLL] Fix signature help for operation operands
River Riddle [Sat, 30 Apr 2022 07:32:24 +0000 (00:32 -0700)]
[mlir:PDLL] Fix signature help for operation operands

We were currently only completing on the first operand because
the completion check was outside of the parse loop.

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

2 years ago[mlir:PDLL-LSP] Add a custom LSP command for viewing the output of PDLL
River Riddle [Sat, 30 Apr 2022 07:29:49 +0000 (00:29 -0700)]
[mlir:PDLL-LSP] Add a custom LSP command for viewing the output of PDLL

This commit adds a new PDLL specific LSP command, pdll.viewOutput, that
allows for viewing the intermediate outputs of a given PDLL file. The available
intermediate forms currently mirror those in mlir-pdll, namely: AST, MLIR, CPP.
This is extremely useful for a developer of PDLL, as it simplifies various testing,
and is also quite useful for users as they can easily view what is actually being
generated for their PDLL files.

This new command is added to the vscode client, and is available in the right
client context menu of PDLL files, or via the vscode command palette.

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

2 years ago[mlir:PDLL] Add proper support for operation result type inference
River Riddle [Sat, 30 Apr 2022 04:13:29 +0000 (21:13 -0700)]
[mlir:PDLL] Add proper support for operation result type inference

This allows for the results of operations to be inferred in certain contexts,
and matches the support in PDL for result type inference. The main two
initial circumstances are when used as a replacement of another operation,
or when the operation being created implements InferTypeOpInterface.

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

2 years ago[RISCV] Pass OptLevel to `RISCVDAGToDAGISel` correctly
eopXD [Mon, 30 May 2022 12:06:48 +0000 (05:06 -0700)]
[RISCV] Pass OptLevel to `RISCVDAGToDAGISel` correctly

Originally, `OptLevel` isn't passed into the `MachineFunctionPass`.
This lets the default parameter of `SelectionDAGISel`, which is
`CodeGenOpt::Default`, be passed in. OptLevelChanger captures the
optimization level with the parameter, and rather not the value
within `TargetMachine`. This lets the optimization be
unintentionally overwriten if other value than `CodeGenOpt::Default`
passed.

This patch fixes this by passing the optimization level rather
than using the default value.

Reviewed By: craig.topper

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

2 years ago[libc++][test] Enable some ADL robust algorithm tests
Joe Loser [Mon, 30 May 2022 17:59:51 +0000 (11:59 -0600)]
[libc++][test] Enable some ADL robust algorithm tests

Some algorithm ADL robustness tests are commented out, but work as is. Uncomment
them.

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

2 years ago[RISCV] Precommit test case to show bug in RISCVISelDagToDag
eopXD [Mon, 30 May 2022 20:40:06 +0000 (13:40 -0700)]
[RISCV] Precommit test case to show bug in RISCVISelDagToDag

The optimization level should not be restored into O2.
This is a pre-commit test case to show fix in D126641.

Reviewed By: craig.topper

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

2 years ago[clang] NFC: introduce test for D126620
Matheus Izvekov [Mon, 30 May 2022 18:54:48 +0000 (20:54 +0200)]
[clang] NFC: introduce test for D126620

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: v.g.vassilev

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

2 years agocompiler-rt/cpu_model: Ensure constructor priority is set and align with GCC
Keno Fischer [Wed, 25 May 2022 21:35:01 +0000 (21:35 +0000)]
compiler-rt/cpu_model: Ensure constructor priority is set and align with GCC

GCC recently started setting constructor priority on init_have_lse_atomics [1]
to avoid undefined initialization order with respect to other initializers,
causing accidental use of ll/sc intrinsics on targets where this was not
intended (which presents a minor performance problem as well as a
compatibility problem for users wanting to use the rr debugger). I initially
thought compiler-rt does not have the same issue as libgcc, since it looks
like we're already setting init priority on the constructor.

Unfortuantely, it does not appear that the HAVE_INIT_PRIORITY check is ever
performed anyway, so despite appearances the init priority was not actually
applied. Fix that by applying the init priority unconditionally. It has been
supported in clang ever since it was first introduced and in any case for
more than 14 years in both gcc and clang. MSVC is already excluded from this
code path and we're already using constructors with init priority elsewhere
in compiler-rt without additional check (though mostly in the sanitizer
runtime, which may have more narrow target support). Regardless, I believe
that for our supported compilers, if they support the constructor attribute,
they should also support init priorities.

While we're here, change the init priority from 101, which is the highest
priority for end user applications, to instead use one of the priority levels
reserved for implementations (1-100; lower integers are higher priority).
GCC ended up using `90`, so this commit aligns the value in compiler-rt
to the same value to ensure that there are no subtle initialization order
differences between libgcc and compiler-rt.

[1] https://github.com/gcc-mirror/gcc/commit/75c4e4909ae2667f56487434f99c2915b4570794

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

2 years ago[FileCheck] Use %ProtectFileCheckOutput in recently added test
Joel E. Denny [Mon, 30 May 2022 20:26:17 +0000 (16:26 -0400)]
[FileCheck] Use %ProtectFileCheckOutput in recently added test

2 years ago[libc++][NFC] Improve comment about vector and string base class ABI flags
Louis Dionne [Mon, 30 May 2022 20:26:33 +0000 (16:26 -0400)]
[libc++][NFC] Improve comment about vector and string base class ABI flags

2 years ago[Hexagon] Widen vector types with non-power-of-2 element counts
Krzysztof Parzyszek [Mon, 30 May 2022 19:14:59 +0000 (12:14 -0700)]
[Hexagon] Widen vector types with non-power-of-2 element counts

Such vector types cannot be split at the moment, because splitting expects
an even number of elements in the source type. If a target marks such a type
as "split", TargetLoweringBase::computeRegisterProperties will override it
with widening to the next power of 2. This could lead to issues during
instruction selection when conflicting information about how to handle this
type is present.

2 years agocmake: fix clang standalone build
Matheus Izvekov [Mon, 30 May 2022 18:33:50 +0000 (20:33 +0200)]
cmake: fix clang standalone build

D126308 broke building clang standalone, as LLVM_UTILS_INSTALL_DIR is
not exported.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D126671

2 years ago[InstCombine] fold shift-right-by-constant with shift-right-of-constant operand
Sanjay Patel [Mon, 30 May 2022 19:30:01 +0000 (15:30 -0400)]
[InstCombine] fold shift-right-by-constant with shift-right-of-constant operand

  (C2 >> X) >> C1 --> (C2 >> C1) >> X

The shift-left form of this transform has existed since:
16f18ed7b555bce5163

...but it applies to matching shift right opcodes too:
https://alive2.llvm.org/ce/z/c5eQms

2 years ago[InstCombine] remove unnecessary one-use check from (C2 << X) << C1 fold
Sanjay Patel [Mon, 30 May 2022 19:15:27 +0000 (15:15 -0400)]
[InstCombine] remove unnecessary one-use check from (C2 << X) << C1 fold

The restriction goes back to:
16f18ed7b555bce51
...but the fold only replaces a shift with a shift, so that's not necessary.
Generalizing to other opcodes is planned as a follow-up.