platform/upstream/llvm.git
17 months ago[NFC] PHITransAddr refactoring - use range-based loops and standard algorithms
Sergey Kachkov [Thu, 2 Feb 2023 14:49:54 +0000 (17:49 +0300)]
[NFC] PHITransAddr refactoring - use range-based loops and standard algorithms

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

17 months ago[AArch64][SVE2p1] Add 2-way SVE2p1 dot product intrinsics
David Sherwood [Wed, 1 Feb 2023 13:48:48 +0000 (13:48 +0000)]
[AArch64][SVE2p1] Add 2-way SVE2p1 dot product intrinsics

This patch adds the LLVM IR intrinsics for the following:

* sdot (2-way, vectors + indexed)
* udot (2-way, vectors + indexed)
* fdot (vectors + indexed)

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

17 months agoAMDGPU: Add more tests to fneg modifier with casting tests
Matt Arsenault [Fri, 27 Jan 2023 14:11:55 +0000 (10:11 -0400)]
AMDGPU: Add more tests to fneg modifier with casting tests

17 months ago[flang] Avoid double finalization when intrinsic assignment is done in the runtime
Valentin Clement [Fri, 3 Feb 2023 11:21:59 +0000 (12:21 +0100)]
[flang] Avoid double finalization when intrinsic assignment is done in the runtime

genRecordAssignment is emitting code to call Assign in the runtime for some cases.
In these cases, the finalization is done by the runtime so we do not need to do it in
a separate cal to avoid multiple finalization..
Also refactor the code in Bridge so the actual finalization of allocatable
is done before any reallocation. We might need to push this into ReallocIfNeeded.
It is not clear if the allocatable lhs needs to be finalized in any cases or only if it is
reallocated.

Reviewed By: jeanPerier

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

17 months agoFix up tests committed in 57a6bb34729df30df18a133ee2083b3323a936dc
David Sherwood [Fri, 3 Feb 2023 11:00:35 +0000 (11:00 +0000)]
Fix up tests committed in 57a6bb34729df30df18a133ee2083b3323a936dc

I committed an older version of the patch without the test updates.
This patch uses the latest versions on
https://reviews.llvm.org/D142904

17 months ago[AArch64][SME2] Add multi-vector zip/uzp intrinsics
David Sherwood [Mon, 30 Jan 2023 16:10:22 +0000 (16:10 +0000)]
[AArch64][SME2] Add multi-vector zip/uzp intrinsics

This patch adds the LLVM IR intrinsics for the following:

* zip (2 and 4 vectors, 8 to 64-bit elements) - aarch64.sve.zip.*
* zip (2 and 4 vectors, 128-bit elements) - aarch64.sve.zipq.*
* uzp (2 and 4 vectors, 8 to 64-bit elements) - aarch64.sve.uzp.*
* uzp (2 and 4 vectors, 128-bit elements) - aarch64.sve.uzpq.*

I have created separate intrinsics for the 128-bit variants
in a similar way to what was done for int_aarch64_sme_readq_horiz.
This permits us to use any vector type (<vscale x 16 x i8>, etc.)
for the 128-bit versions.

I have also named the tests sve2p1-intrinsics-* because although
the instructions are added as part of the SME2 feature they only
operate on SVE vectors.

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

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

17 months ago[MLIR] NFC: fully scope use FastMathFlag.
Christian Sigg [Fri, 3 Feb 2023 10:47:28 +0000 (11:47 +0100)]
[MLIR] NFC: fully scope use FastMathFlag.

Second instance.

17 months ago[AMDGPU] Make offset a 32-bit operand
Piotr Sobczak [Thu, 2 Feb 2023 12:37:46 +0000 (13:37 +0100)]
[AMDGPU] Make offset a 32-bit operand

Promote offset to 32-bit, similarily to what D142549 did for flat_offset.

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

17 months ago[NFC] Remove isSafeToSpeculativelyExecute checks for casts
Sergey Kachkov [Fri, 3 Feb 2023 10:26:30 +0000 (13:26 +0300)]
[NFC] Remove isSafeToSpeculativelyExecute checks for casts

isSafeToSpeculativelyExecute always return true for casts, so remove
this redundant checks.

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

17 months ago[gn build] Port 1e72920c8859
LLVM GN Syncbot [Fri, 3 Feb 2023 10:26:23 +0000 (10:26 +0000)]
[gn build] Port 1e72920c8859

17 months ago[Test] Add tests with narrow checks for SCEVLoopGuardRewriter
Max Kazantsev [Fri, 3 Feb 2023 10:21:29 +0000 (17:21 +0700)]
[Test] Add tests with narrow checks for SCEVLoopGuardRewriter

17 months ago[ORC] Drop Comdat when discarding IR symbol
Jonas Hahnfeld [Tue, 24 Jan 2023 09:54:55 +0000 (10:54 +0100)]
[ORC] Drop Comdat when discarding IR symbol

According to the IR verifier, "Declaration[s] may not be in a Comdat!"

This is a re-commit of 76b3f0b4d5a0b8c54147c4c73a30892bbca76467 with
updates to the test:
 * Force emission of the extra-module, to trigger the bug after D138264,
   by providing a second symbol @g, and making the comdat nodeduplicate.
   (Technically only one is needed, but two should be safer.)
 * Name the comdat $f to avoid failure on Windows:
   LLVM ERROR: Associative COMDAT symbol 'c' does not exist.

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

17 months ago[dsymutil] dsymutil produces broken lines info (probably) with LTO on mac
Alexey Lapshin [Mon, 30 Jan 2023 14:05:53 +0000 (15:05 +0100)]
[dsymutil] dsymutil produces broken lines info (probably) with LTO on mac

This patch fixes #60307 issue. The 8bb4451 introduces the possibility
to unite overlapped or adjacent address ranges to keep address ranges
in an unambiguous state. The AddressRangesMap is used to normalize
address ranges. The AddressRangesMap keeps address ranges and the value
of the relocated address. For intersected range, it creates a united
range that keeps the last inserted mapping value. The same for adjusted ranges.
While it is OK to use the last inserted mapping value for intersected ranges
(as there is no way how to resolve ambiguity) It is not OK to use the
last inserted value for adjacent address ranges. Currently, two following
address ranges are united into a single one:

{0,24,17e685c} {24,d8,55afe20} -> {0,d8,55afe20}

To avoid the problem, the AddressRangesMap should not unite adjacent address ranges
with different relocated addresses. Instead, it should leave adjacent address ranges
as separate ranges. So, the ranges should look like this:

{0,24,17e685c} {24,d8,55afe20}

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

17 months ago[llvm-objcopy] Fix strip-all-gnu test
Anton Sidorenko [Wed, 1 Feb 2023 15:58:24 +0000 (18:58 +0300)]
[llvm-objcopy] Fix strip-all-gnu test

Originally the test has a bug: in the input YAML `.symtab.dyn` section has a type
repeated twice with different values (SHT_SYMTAB and SHT_NOBITS). YAML parser
took SHT_NOBITS as a type of the section, so the test wasn't checking the desired
case.

This patch changes the test to verify that a section with SHT_SYMTAB type and
SHF_ALLOC flag is not removed when --strip-all-gnu flag present.

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

17 months ago[Test] Add signed counterparts of unsigned tests on SCEVLoopGuardRewriter
Max Kazantsev [Fri, 3 Feb 2023 10:06:37 +0000 (17:06 +0700)]
[Test] Add signed counterparts of unsigned tests on SCEVLoopGuardRewriter

17 months ago[Test] Add motivating test for umin support in SCEVLoopGuardRewriter
Max Kazantsev [Fri, 3 Feb 2023 09:00:24 +0000 (16:00 +0700)]
[Test] Add motivating test for umin support in SCEVLoopGuardRewriter

This test is equivalent to another one, where we can infer a
reasonable iteration count. The only difference is that umin and zext
here are swapped, and rewriter fails here.

17 months ago[AArch64][SME2] Add LLVM IR intrinsics for multi-indexed dots
David Sherwood [Wed, 25 Jan 2023 08:58:44 +0000 (08:58 +0000)]
[AArch64][SME2] Add LLVM IR intrinsics for multi-indexed dots

Adds intrinsics for the following SME2 instructions:

* sdot (multi-indexed, 2 and 4 vectors, 32-bit and 64-bit ZA)
* udot (multi-indexed, 2 and 4 vectors, 32-bit and 64-bit ZA)
* usdot (multi-indexed, 2 and 4 vectors)
* sudot (multi-indexed, 2 and 4 vectors)
* fdot (multi-indexed, 2 and 4 vectors)
* bfdot (multi-indexed, 2 and 4 vectors)

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

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

17 months ago[Clang] Add builtin_nondeterministic_value
ManuelJBrito [Thu, 2 Feb 2023 17:42:31 +0000 (17:42 +0000)]
[Clang] Add builtin_nondeterministic_value

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

17 months ago[flang] use runRegionDCE instead of a custom DCE in cg-rewrite
Jean Perier [Fri, 3 Feb 2023 09:29:19 +0000 (10:29 +0100)]
[flang] use runRegionDCE instead of a custom DCE in cg-rewrite

The custom DCE in cg-rewrite is meant to get rid of fir.shape, fir.shift,
fir.shape_shift and fir.slice ops as well as their unused operands
before codegen (that does not lower those abstract operation to LLVM).

However, it turned out to be flowed in case some fir.shape operands were
unused outside of fir.shape and appeared several times as operands:
they were erased at the first appearance, causing the further attemp
to erase it to segfault (since the op IR storage was deallocated).

Instead of trying to fixing the custom DCE code, use mlir::runRegionDCE.

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

17 months ago[flang] Fix potential null scope when lowering dispatch table op
Valentin Clement [Fri, 3 Feb 2023 09:16:54 +0000 (10:16 +0100)]
[flang] Fix potential null scope when lowering dispatch table op

Similary to D140209, the scope might need to be retrieved
from the typeSymbol. The test code was crashing because the
scope passed to CollectBindings was initially null.

Reviewed By: jeanPerier

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

17 months ago[InstCombine] typo fix in the test xor-and-or.ll; NFC
chenglin.bi [Fri, 3 Feb 2023 09:15:47 +0000 (17:15 +0800)]
[InstCombine] typo fix in the test xor-and-or.ll; NFC

17 months ago[InstCombine] Fold pattern xor(and, or) to select
chenglin.bi [Fri, 3 Feb 2023 09:11:41 +0000 (17:11 +0800)]
[InstCombine] Fold pattern xor(and, or) to select

(A & B) ^ (A | C) --> A ? ~B : C

https://alive2.llvm.org/ce/z/KCBfXr
https://alive2.llvm.org/ce/z/Pm-zJN
https://alive2.llvm.org/ce/z/VT8uC2

Reviewed By: spatel

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

17 months ago[NFC] PHITransAddr refactoring - return translated value directly or nullptr on
Sergey Kachkov [Thu, 2 Feb 2023 12:52:34 +0000 (15:52 +0300)]
[NFC] PHITransAddr refactoring - return translated value directly or nullptr on
failure (instead of bool flag)

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

17 months agoRevert "[ORC] Drop Comdat when discarding IR symbol"
Jonas Hahnfeld [Fri, 3 Feb 2023 09:04:38 +0000 (10:04 +0100)]
Revert "[ORC] Drop Comdat when discarding IR symbol"

Failure on Windows:
LLVM ERROR: Associative COMDAT symbol 'c' does not exist.

This reverts commit 76b3f0b4d5a0b8c54147c4c73a30892bbca76467 while
I investigate the problem and a solution that still triggers the
original problem.

17 months ago[mlir] GreedyPatternRewriteDriver: Ignore scope when rewriting top-level ops
Matthias Springer [Fri, 3 Feb 2023 08:44:42 +0000 (09:44 +0100)]
[mlir] GreedyPatternRewriteDriver: Ignore scope when rewriting top-level ops

Top-level ModuleOps cannot be transformed with the GreedyPatternRewriteDriver since D141945 because they do not have an enclosing region that could be used as a scope. Make the scope optional inside GreedyPatternRewriteDriver, so that top-level ops can be processed when they are on the initial list of ops.

Note: This does not allow users to bypass the scoping mechanism by setting `config.scope = nullptr`.

Fixes #60462.

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

17 months ago[docs] Rewrite/improve the docs for LLVM_NATIVE_TOOL_DIR
Martin Storsjö [Tue, 31 Jan 2023 09:09:50 +0000 (11:09 +0200)]
[docs] Rewrite/improve the docs for LLVM_NATIVE_TOOL_DIR

Don't include it among the mandatory options; the automatically built
tools via a nested cmake build work fine these days
(in particular, since 93010544a813dfbfa64dd7cee68785f572f974d1 /
https://reviews.llvm.org/D126313).

Clarify the directory path-to-host-bin into something more verbose,
to avoid ambiguity with LLVM_HOST_TRIPLE.

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

17 months ago[docs] Prefer setting LLVM_HOST_TRIPLE instead of LLVM_DEFAULT_TARGET_TRIPLE and...
Martin Storsjö [Mon, 23 Jan 2023 12:13:40 +0000 (14:13 +0200)]
[docs] Prefer setting LLVM_HOST_TRIPLE instead of LLVM_DEFAULT_TARGET_TRIPLE and LLVM_TARGET_ARCH

Setting LLVM_HOST_TRIPLE propagates the information to a few more
places than if only setting LLVM_TARGET_ARCH and
LLVM_DEFAULT_TARGET_TRIPLE, while both of those settings get their
defaults implied from LLVM_HOST_TRIPLE if they're not overridden.

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

17 months ago[mlir][Bazel] Update bazel BUILD after 889a11783ec
Adrian Kuegel [Fri, 3 Feb 2023 08:42:34 +0000 (09:42 +0100)]
[mlir][Bazel] Update bazel BUILD after 889a11783ec

17 months ago[clang-format][doc] Fix a typo
Owen Pan [Fri, 3 Feb 2023 08:23:46 +0000 (00:23 -0800)]
[clang-format][doc] Fix a typo

17 months agoFix bazel dependency
Thomas Raoux [Fri, 3 Feb 2023 07:53:30 +0000 (07:53 +0000)]
Fix bazel dependency

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

17 months ago[mlir][linalg] Fix crash in vectorizer when expanding affine apply
Thomas Raoux [Fri, 3 Feb 2023 07:49:38 +0000 (07:49 +0000)]
[mlir][linalg] Fix crash in vectorizer when expanding affine apply

Fix the insert point when expanding affine apply and handle cases with
symbols. Also add missing precondition to dynamic shape vectorization.

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

17 months ago[ELF] Fix help message for --lto-pgo-warn-mismatch
Fangrui Song [Fri, 3 Feb 2023 08:04:50 +0000 (00:04 -0800)]
[ELF] Fix help message for --lto-pgo-warn-mismatch

17 months ago[mlir][llvm] Add structured loop metadata
Christian Ulmann [Fri, 3 Feb 2023 07:33:37 +0000 (08:33 +0100)]
[mlir][llvm] Add structured loop metadata

This commit introduces a structured representation of loop metadata to
the LLVM dialect. This attribute explicitly models all known `!llvm.loop`
metadata fields and groups them by introducing nested attributes for each
namespace.

The new attribute replaces the LoopOptionAttr that could only model a
limited subset of loop metadata.

Reviewed By: gysit

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

17 months ago[libc++][format] Fix a missing include in tests.
Konstantin Varlamov [Fri, 3 Feb 2023 07:54:22 +0000 (23:54 -0800)]
[libc++][format] Fix a missing include in tests.

17 months ago[ORC] Drop Comdat when discarding IR symbol
Jonas Hahnfeld [Tue, 24 Jan 2023 09:54:55 +0000 (10:54 +0100)]
[ORC] Drop Comdat when discarding IR symbol

According to the IR verifier, "Declaration[s] may not be in a Comdat!"

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

17 months ago[X86][FP16] Set Custom action for vector FROUND
Phoebe Wang [Fri, 3 Feb 2023 07:19:21 +0000 (15:19 +0800)]
[X86][FP16] Set Custom action for vector FROUND

Reviewed By: RKSimon

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

17 months ago[libc++] Make some tests in `math_nodiscard_extensions` Clang-only.
varconst [Thu, 2 Feb 2023 18:15:48 +0000 (10:15 -0800)]
[libc++] Make some tests in `math_nodiscard_extensions` Clang-only.

Clang implicitly adds the `[[gnu::const]]` attribute to many math
functions from the C standard library functions. Since this behavior is
Clang-specific, make sure the test only runs on Clang.

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

17 months ago[NFC] [Serialization] Add static assert for Num*Declbits
Chuanqi Xu [Fri, 3 Feb 2023 06:29:14 +0000 (14:29 +0800)]
[NFC] [Serialization] Add static assert for Num*Declbits

This re-commits part of c79635cce845. It is reverted since it contains
platform-inconsistent constant. Now the patch only contains constant
defined in DeclBase.h so it should be platform-independent. And this
should be still helpful.

Reviewed By: erichkeane

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

17 months ago[LoongArch] Override TargetLowering::hasAndNotCompare()
gonglingqin [Fri, 3 Feb 2023 01:37:17 +0000 (09:37 +0800)]
[LoongArch] Override TargetLowering::hasAndNotCompare()

Override hasAndNotCompare() to use more `ANDN` instead of using `AND`
and `NOT`.
This patch enables the following transforms:
(X & Y) == Y ---> (~X & Y) == 0
(X & Y) != Y ---> (~X & Y) != 0.

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

17 months ago[mlir] print-op-graph: StringMap=>map to stabilize iteration order
Fangrui Song [Fri, 3 Feb 2023 04:03:34 +0000 (20:03 -0800)]
[mlir] print-op-graph: StringMap=>map to stabilize iteration order

17 months ago[OpenMP] Guard the code if ITT is not used
Shilei Tian [Fri, 3 Feb 2023 03:54:25 +0000 (22:54 -0500)]
[OpenMP] Guard the code if ITT is not used

`check_loc` is not used if ITT is disabled or debug is off, causing a
compiler warning.

Reviewed By: jlpeyton

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

17 months agoAMDGPU: Use module flag to get code object version at IR level
Changpeng Fang [Fri, 3 Feb 2023 02:57:26 +0000 (18:57 -0800)]
AMDGPU: Use module flag to get code object version at IR level

Summary:
  This patch introduces a mechanism to check the code object version from the module flag, This avoids checking from command line.
In case the module flag is missing, we use the current default code object version supported in the compiler.

For tools whose inputs are not IR, we may need other approach (directive, for example) to check the code
object version, That will be in a separate patch later.

For LIT tests update, we directly add module flag if there is only a single code object version associated with all checks in one file.
In cause of multiple code object version in one file, we use the "sed" method to "clone" the checks to achieve the goal.

Reviewer: arsenm

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

17 months agoX86: Add some baseline tests for broken is.fpclass handling with DAZ
Matt Arsenault [Tue, 31 Jan 2023 18:21:17 +0000 (14:21 -0400)]
X86: Add some baseline tests for broken is.fpclass handling with DAZ

If DAZ is enabled, a test against fcZero is not equivalent to a compare
with 0.

17 months agoAMDGPU: Add additional tests for is.fpclass legalization
Matt Arsenault [Thu, 2 Feb 2023 13:59:08 +0000 (09:59 -0400)]
AMDGPU: Add additional tests for is.fpclass legalization

17 months agoAMDGPU: Regenerate test checks
Matt Arsenault [Thu, 2 Feb 2023 13:49:54 +0000 (09:49 -0400)]
AMDGPU: Regenerate test checks

Use right prefix order to get merging.

Also drop -verify-machineinstrs and add -amdgpu-enable-delay-alu=0

17 months agoAMDGPU: Factor out fneg fold predicate function
Matt Arsenault [Wed, 14 Dec 2022 22:58:56 +0000 (17:58 -0500)]
AMDGPU: Factor out fneg fold predicate function

17 months agoAMDGPU: Try to unfold fneg source when matching legacy fmin/fmax
Matt Arsenault [Thu, 15 Dec 2022 15:20:01 +0000 (10:20 -0500)]
AMDGPU: Try to unfold fneg source when matching legacy fmin/fmax

This is NFC as it stands, since other combines will effectively
prevent this from being reachable. This will avoid regressions in a
future change which tries to make better use of select source
modifiers.

Didn't bother with the GlobalISel part for now, since the baseline
combine doesn't seem to work on the existing test.

17 months ago[C++20] [Modules] Pop Expression Evaluation Context when we skip its body during...
Chuanqi Xu [Fri, 3 Feb 2023 02:27:02 +0000 (10:27 +0800)]
[C++20] [Modules] Pop Expression Evaluation Context when we skip its body during parsing

Close https://github.com/llvm/llvm-project/issues/60275

The root cause of issue 60275 is the imbalance of
PushExpressionEvaluationContext() and PopExpressionEvaluationContext().

See
https://github.com/llvm/llvm-project/blob/f1c4f927f7c15b5efdc3589c050fd0513bf6b303/clang/lib/Parse/Parser.cpp#L1396-L1437

We will PushExpressionEvaluationContext() in ActOnStartOfFunctionDef()
in line 1396 and we should pop it in ActOnFinishFunctionBody later.
However if we skip the function body in line 1402, the expression
evaluation context will not be popped. Then here is the issue report. I
fix the issue by inserting codes to pop the expression evaluation
context explicitly if the function body is skipped. Maybe this looks
like an ad-hoc fix. But if we want to fix this in a pretty way, we
should refactor the current framework for pushing and popping expression
evaluation contexts. Currently there are 23
PushExpressionEvaluationContext() callsities and 21
PopExpressionEvaluationContext() callsites in the code. And it seems not
easy to balance them well and fast. So I suggest to land this fix first.
At least it can prevent the crash.

Reviewed By: cor3ntin

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

17 months ago[PowerPC] add a peephole to remove redundant swap instructions after vector splats...
Ting Wang [Fri, 3 Feb 2023 01:52:52 +0000 (20:52 -0500)]
[PowerPC] add a peephole to remove redundant swap instructions after vector splats on P8

Vector store on P8 little endian will have swap instruction added before
the store in PPCISelLowring. If the vector is generated by splat, the
swap instruction can be eliminated.

Reviewed By: shchenz

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

17 months ago[RISCV] Permit tail call to an externally-defined function with weak linkage
LiaoChunyu [Fri, 3 Feb 2023 01:16:49 +0000 (09:16 +0800)]
[RISCV] Permit tail call to an externally-defined function with weak linkage

As described in D45395 `This has been modeled after ARM's tail call opt.`
ARM's abi seems to limit weak symbol.

I did not find the limitation for RISCV. (Please correct me if I am wrong)

gcc seems to use the tail-call opt: https://godbolt.org/z/bjWE68n5o

Reviewed By: MaskRay

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

17 months ago[DX] Speculative big endian fix
Chris Bieneman [Fri, 3 Feb 2023 01:25:28 +0000 (19:25 -0600)]
[DX] Speculative big endian fix

I think this will get it this time.

17 months ago[DX] Fix big-endian... again
Chris Bieneman [Fri, 3 Feb 2023 00:21:19 +0000 (18:21 -0600)]
[DX] Fix big-endian... again

Big endian is the bane of my existance today...

17 months agoRevert "Add CFI integer types normalization"
Mitch Phillips [Thu, 2 Feb 2023 23:48:50 +0000 (15:48 -0800)]
Revert "Add CFI integer types normalization"

This reverts commit b1e9ab7438a098a18fecda88fc87ef4ccadfcf1e.

Reason: Looks like it broke the MSan buildbot, more details in the
phabricator review: https://reviews.llvm.org/D139395

17 months ago[GWP-ASan] Remove thread clamping in tests.
Mitch Phillips [Thu, 2 Feb 2023 23:37:33 +0000 (15:37 -0800)]
[GWP-ASan] Remove thread clamping in tests.

It's better and easier for us to just have threads contend against each
other in the tests if it's more than the maximum supported number of
hardware threads available.

Specifically, the recoverable test fails on Android because the
GTEST_SKIP in a called function, and it only properly works from the
TEST_* harness function. Android tests run on cuttlefish, which can be a
single core with two hyperthreads.

Reviewed By: fmayer

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

17 months ago[SPIRV][NFC] fix build warning and error
Ilia Diachkov [Mon, 30 Jan 2023 20:43:53 +0000 (23:43 +0300)]
[SPIRV][NFC] fix build warning and error

The patch fixes gcc's warning in SPIRVUtils.cpp after D142532.
Also it fixes compilation error by MSVC in SPIRVBuiltins.cpp.

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

17 months ago[mlir][sparse] Implement heap sort for sparse_tensor.sort.
bixia1 [Thu, 2 Feb 2023 22:54:45 +0000 (14:54 -0800)]
[mlir][sparse] Implement heap sort for sparse_tensor.sort.

Reviewed By: aartbik

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

17 months ago[lldb] Fix typo in ScriptedProcess python docstrings (NFC)
Med Ismail Bennani [Wed, 1 Feb 2023 22:52:50 +0000 (14:52 -0800)]
[lldb] Fix typo in ScriptedProcess python docstrings (NFC)

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
17 months ago[lldb/python] Fix scripted_platform python module creation
Med Ismail Bennani [Thu, 2 Feb 2023 00:33:53 +0000 (16:33 -0800)]
[lldb/python] Fix scripted_platform python module creation

This patch should fix the creation and addition of the `scripted_platform`
python module into the `lldb.plugins` module.

Previously, we were creating the `plugins` submodule, each time with a
different source file (either `scripted_process` or `scripted_platform`).

The removes the redundant `create_python_package` call and group both
python source files toghether.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
17 months ago[DeclContext] Sort the Decls before adding into DeclContext
Steven Wu [Thu, 2 Feb 2023 23:07:16 +0000 (15:07 -0800)]
[DeclContext] Sort the Decls before adding into DeclContext

Fix a non-deterministic issue in clang module generation, which the
anonymous declaration number from a function context is not
deterministic. This is due to the unstable iteration order for decls in
scope so the order after moving the decls into function decl context is
not deterministic.

From https://reviews.llvm.org/D135118, we can't use a set that preserves
the order without the performance penalty. Fix the issue by sorting the
decls based on raw encoding of their source location.

rdar://104097976

Reviewed By: akyrtzi, vsapsai

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

17 months agolibRemarks.{so,dylib}: remove Remarks.dylib.exports
Fangrui Song [Thu, 2 Feb 2023 23:13:04 +0000 (15:13 -0800)]
libRemarks.{so,dylib}: remove Remarks.dylib.exports

Remarks.exports is only intended for NOT (BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB)
builds.

For (unintended use case) BUILD_SHARED_LIBS OR LLVM_LINK_LLVM_DYLIB (the latter
is used by some Linux distros), the library defines just one symbol on ELF.
There is no need to use a version script.

I think this is a more proper solution than D139932 and fixes `symbol not
defined` errors after lld default change D135402.

17 months agolibLTO.{so,dylib}: remove unused non-LTO symbols
Fangrui Song [Thu, 2 Feb 2023 22:51:35 +0000 (14:51 -0800)]
libLTO.{so,dylib}: remove unused non-LTO symbols

These dissembler symbols are not used by LTO (see Apple ld64's use
in check-llvm-tools-lto). On ELF platforms, these symbols are not defined and are
rejected by ld --no-undefined-version.

I think this is a more proper solution than D139932 and this fixes
-DBUILD_SHARED_LIBS=on for ELF as well.

17 months ago[DX] Add support for PSV resource bindings
Chris Bieneman [Thu, 2 Feb 2023 19:11:34 +0000 (13:11 -0600)]
[DX] Add support for PSV resource bindings

This patch continues implementing DirectX pipeline state validation
information by adding support for resource binding metadata.

Reviewed By: python3kgae

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

17 months ago[mlgo][nfc] Refactor the log_reader.py utility
Mircea Trofin [Thu, 2 Feb 2023 22:41:55 +0000 (14:41 -0800)]
[mlgo][nfc] Refactor the log_reader.py utility

Small refactoring in preparation for tests for the interactive mode.
This allows reading the header, and performing observations, as explicit
steps. The latter is in particular necessary because the exit condition
for the interactive host will be that the child process (the compiler)
exited.

17 months ago[Attributor][NFCI] Avoid spending time resolving kernel reachability queries
Johannes Doerfert [Thu, 2 Feb 2023 21:05:20 +0000 (13:05 -0800)]
[Attributor][NFCI] Avoid spending time resolving kernel reachability queries

We know kernels (generally) cannot be called from within the module. Thus,
for reachability we would need to step back from a kernel which would allow
us to reach anything anyway. Even if a kernel is invoked from another
kernel, values like allocas and shared memory are not accessible. We
implicitly check for this situation to avoid costly lookups.

17 months ago[Attributor][NCFI] Explicitly state what interfering accesses to look for
Johannes Doerfert [Fri, 27 Jan 2023 05:05:30 +0000 (21:05 -0800)]
[Attributor][NCFI] Explicitly state what interfering accesses to look for

We used to check the query instructions for effects but that does not
work well with complex accesses we will probably support in the future.
Now we simply let the user decide what accesses to look for.

17 months agoAdd usage info for backtick to the lldb tutorial.
Jim Ingham [Thu, 2 Feb 2023 21:46:42 +0000 (13:46 -0800)]
Add usage info for backtick to the lldb tutorial.

17 months ago[modularize] StringMap=>map to make iteration order deterministic
Fangrui Song [Thu, 2 Feb 2023 21:46:52 +0000 (13:46 -0800)]
[modularize] StringMap=>map to make iteration order deterministic

17 months ago[unittest] Use UnorderedElementsAre for StringMap keys
Fangrui Song [Thu, 2 Feb 2023 21:39:47 +0000 (13:39 -0800)]
[unittest] Use UnorderedElementsAre for StringMap keys

17 months ago[Libomptarget] Add new enum to the dynamically opened HSA implementation
Joseph Huber [Thu, 2 Feb 2023 21:14:20 +0000 (15:14 -0600)]
[Libomptarget] Add new enum to the dynamically opened HSA implementation

Summary:
We added a new agent information enum in a previous commit. This was not
added to the dynamic HSA implementation so it failed to compile without
a local HSA install to use.

17 months agoRepair sphinx doc generation
Joshua Batista [Thu, 2 Feb 2023 20:31:53 +0000 (12:31 -0800)]
Repair sphinx doc generation

mistake in the log commit neglected to place a space after the `` literal,
which messed up the build by incapacitating the sphinx generator.

Reviewed By: beanz

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

17 months ago[BOLT][NFC] Rename {MachO,}RewriteInstance::create methods
Amir Ayupov [Wed, 4 May 2022 03:29:13 +0000 (20:29 -0700)]
[BOLT][NFC] Rename {MachO,}RewriteInstance::create methods

Follow the code style of fallible constructors in [LLVM Programmer's Manual]
(https://llvm.org/docs/ProgrammersManual.html#fallible-constructors)
and rename `RewriteInstance::createRewriteInstance` to `RewriteInstance::create`

Reviewed By: #bolt, rafauler

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

17 months ago[PowerPC] Switch to by-name matching for instructions (part 2 of 2).
James Y Knight [Tue, 8 Nov 2022 22:11:08 +0000 (17:11 -0500)]
[PowerPC] Switch to by-name matching for instructions (part 2 of 2).

This is a follow-on to https://reviews.llvm.org/D134073.

Currently, all of the "memri"-style complex operands, which contain
both a register and an immediate, are encoded into a single field in
the instruction definition. This requires complex encoders/decoders,
and instruction definitions that insert and extract the correct parts
of the bits.

Now, switch to naming and encoding/decoding the sub-operands
separately.

Thus, we can now disable useDeprecatedPositionallyEncodedOperands.

Reviewed By: barannikov88

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

17 months ago[PowerPC] Switch to by-name matching for instructions (part 1 of 2).
James Y Knight [Tue, 8 Nov 2022 22:11:05 +0000 (17:11 -0500)]
[PowerPC] Switch to by-name matching for instructions (part 1 of 2).

This is a follow-on to https://reviews.llvm.org/D134073.

After https://reviews.llvm.org/D137653 we can now switch the PPC
target away from positional operand matching.

This patch fixes all of the "easy" cases. While this changes a large
number of lines of tablegen source, it results in only a single
non-comment change in the code generated by tablegen: the (unused)
codegen-only "MTVRSAVEv" instruction was previously incorrectly
encoding operand 0, and now encodes (correctly) operand 1.

Changes which result in generated-code changes have been split off
into the next (smaller) patch, for ease of review.

Reviewed By: barannikov88

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

17 months ago[X86] Reflow comment to fit 80 columns. NFC
Craig Topper [Thu, 2 Feb 2023 20:17:17 +0000 (12:17 -0800)]
[X86] Reflow comment to fit 80 columns. NFC

17 months ago[clang] Warn by default that implicit capture of 'this' is deprecated in C++20 and...
Tom Honermann [Thu, 26 Jan 2023 15:32:27 +0000 (07:32 -0800)]
[clang] Warn by default that implicit capture of 'this' is deprecated in C++20 and later.

Previously, a warning that C++20 deprecated implicit capture of 'this' for
lambda captures specified with a capture default of '=' was only issued when
'-Wdeprecated' or '-Wdeprecated-this-capture' was specified. This change
enables the warning by default (it is still only issued when compiling for
C++20 or later). This is consistent with gcc which warns by default (MSVC
requires '/Wall').

Reviewed By: erichkeane, shafik

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

17 months ago[BOLT][NFC] Simplify SW::checkStackPointerRestore
Amir Ayupov [Thu, 2 Feb 2023 20:03:44 +0000 (12:03 -0800)]
[BOLT][NFC] Simplify SW::checkStackPointerRestore

Reviewed By: rafauler

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

17 months ago[BOLT][NFC] Use llvm::make_second_range
Amir Ayupov [Thu, 2 Feb 2023 20:02:02 +0000 (12:02 -0800)]
[BOLT][NFC] Use llvm::make_second_range

Reviewed By: #bolt, rafauler

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

17 months ago[flang] Do not finalize pointer function result
Valentin Clement [Thu, 2 Feb 2023 19:47:19 +0000 (20:47 +0100)]
[flang] Do not finalize pointer function result

According to 7.5.6.3 point 5, only nonpointer function result
need to be finalized. Update the condition to exclude pointer
function result.

Reviewed By: jeanPerier

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

17 months agoAdd builtin_elementwise_log
Joshua Batista [Thu, 2 Feb 2023 19:10:53 +0000 (11:10 -0800)]
Add builtin_elementwise_log

Add codegen for llvm log elementwise builtin
The log 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 builtin is restricted to floating point types only.

Reviewed By: beanz

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

17 months ago[RISCV] Merge rv32-vsetvli-intrinsics.ll and rv64-vsetvli-intrinsics.ll into a single...
Craig Topper [Thu, 2 Feb 2023 19:20:43 +0000 (11:20 -0800)]
[RISCV] Merge rv32-vsetvli-intrinsics.ll and rv64-vsetvli-intrinsics.ll into a single test using sed. NFC

17 months ago[NFC] Add split-file as runtime test dependency
YongKang Zhu [Thu, 2 Feb 2023 19:21:58 +0000 (11:21 -0800)]
[NFC] Add split-file as runtime test dependency

Here is a similar change that adds `split-file` as compiler-rt test dependency: https://reviews.llvm.org/rG0eb01a9c4581a24c163f3464cebdb20534fbda35

Reviewed By: thevinster

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

17 months ago[Libomptarget] Improve next-gen AMDGPU plugin error messages
Joseph Huber [Thu, 2 Feb 2023 16:29:47 +0000 (10:29 -0600)]
[Libomptarget] Improve next-gen AMDGPU plugin error messages

The next-gen plugin properly prints errors. This patch improves the
error messages by including the Node-ID of the GPU that failed as well
as a textual representation of the enumeration values.

Reviewed By: kevinsala

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

17 months ago[LLVM][Runtimes] Hide unused CMake variable messages for runtimes builds
Joseph Huber [Thu, 2 Feb 2023 17:31:48 +0000 (11:31 -0600)]
[LLVM][Runtimes] Hide unused CMake variable messages for runtimes builds

The LLVM runtime build is used to bootstrap projects with the built LLVM
toolchain. This effectively re-runs CMake with the current build
directory. One problem is that this passes every common CMake variable
to the projects individually, some of which are not necessarily used.

This patch suppresses the unused variable warnings for the runtimes.
The standard CMake invocation should still be able to print out the
unused variables so it should not impact code quality.

Reviewed By: thieta

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

17 months ago[clang][driver] Fix test fail on Mac after fe082124
Mariya Podchishchaeva [Thu, 2 Feb 2023 18:40:26 +0000 (13:40 -0500)]
[clang][driver] Fix test fail on Mac after fe082124

`--` should be added before input.

17 months ago[PowerPC] Don't crash when disassembling invalid immediate
Nemanja Ivanovic [Thu, 2 Feb 2023 18:38:08 +0000 (12:38 -0600)]
[PowerPC] Don't crash when disassembling invalid immediate

There is an assert in the disassembler functions to ensure
that the immediate is the appropriate width. However,
sometimes what is being disassembled is not instructions
but data that happens to have the bit pattern of an existing
instruction but invalid operands. It is valid for such
things to exist in the text section so we don't want
to crash when disassembling such a thing.

This patch removes the asserts and produces a disassembler
failure for such cases.

17 months ago[RISCV][Driver] Add -mrvv-vector-bits= option similar to -msve-vector-bits=
Craig Topper [Thu, 2 Feb 2023 18:18:17 +0000 (10:18 -0800)]
[RISCV][Driver] Add -mrvv-vector-bits= option similar to -msve-vector-bits=

This option will control the vscale min/max.

I have left out the '+' support that SVE supports for now. We already
have minimum controlled by the Zvl*b extension so this didn't seem that
useful.

I've added "scalable" from SVE to allow the option to be cancelled later on
command line. Though this name might make less sense for RISC-V since
the word "scalable" does not appear in the V spec. Maybe something like
"unknown" or "runtime" or "variable" would be better?

In addition to "scalable", 64, 128, 256, 512, ..., 65536, I have added an extra
value "zvl" that will use the value from Zvl*b as the min and max.
This avoids repeating the numeric value in two places or to get
min/max from -mcpu.

The primary effect of this option today is simplification of stack
address calculations for RVV vectors and avoiding the use of
vrgatherei16 in some cases if we know there are less than 256 elements.

Future patches may add something similar to the arm_sve_vector_bits
attribute to allow RVV vectors to be used in structs and global
variables.

Reviewed By: frasercrmck

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

17 months ago[libc++] Remove use of internal glibc macros to determine if c8rtomb() and mbrtoc8...
Tom Honermann [Wed, 25 Jan 2023 22:57:15 +0000 (17:57 -0500)]
[libc++] Remove use of internal glibc macros to determine if c8rtomb() and mbrtoc8() are present.

When support for declaring the c8rtomb() and mbrtoc8() functions within the
std namespace was added in commit 7e7013c5d4b1b3996c8dba668c5a94bb33b2999b,
internal glibc macros were used to determine if C2X extensions are enabled.
Specifically, a check for whether `__GLIBC_USE` is defined and whether
`__GLIBC_USE(ISOC2X)` is non-0 was added. `__GLIBC_USE` is an internal
detail of the glibc implementation that may be changed or removed in the
future potentially leading to inconsistency or compilation failures.  This
change removes the use of the internal glibc macro to avoid such problems.
Unfortunately, without another mechanism to determine if C2X extensions are
enabled, this removal will result in inconsistent declarations of the
c8rtomb() and mbrtoc8() functions; when C++ char8_t support is not enabled, but
C2X extensions are, these functions will be declared in the global namespace
but not in the std namespace. This situation will improve when C23 support
is finalized and the check can be re-implemented using `__STDC_VERSION__`.

17 months ago[mlir][affine] fix affine LICM pass for has effected memory's user
lipracer [Thu, 2 Feb 2023 18:23:24 +0000 (10:23 -0800)]
[mlir][affine] fix affine LICM pass for has effected memory's user

When the memory is written by dma, its user is moved

Reviewed By: bondhugula

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

17 months ago[LSAN] Enable more tests which are passing as is in HWASAN.
Kirill Stoimenov [Thu, 2 Feb 2023 17:35:27 +0000 (17:35 +0000)]
[LSAN] Enable more tests which are passing as is in HWASAN.

Reviewed By: vitalybuka

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

17 months ago[RISCV] Add CoveredBySubRegs to the X*_PD register class.
Craig Topper [Thu, 2 Feb 2023 17:58:08 +0000 (09:58 -0800)]
[RISCV] Add CoveredBySubRegs to the X*_PD register class.

Not completely sure what effect this has, but it's certainly true.

Reviewed By: asb

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

17 months ago[SelectionDAG] Correctly widen bitcast of scalar to vector for big endian
Nemanja Ivanovic [Thu, 2 Feb 2023 18:01:04 +0000 (12:01 -0600)]
[SelectionDAG] Correctly widen bitcast of scalar to vector for big endian

For big endian targets that need a node such as this:
v2i8 = bitcast i16:tN

legalized by:

1. Promoting the i16 input type
2. Widening the v2i32 result type

The result will be incorrect because the legalizer will promote
the input type and then produce a scalar_to_vector from that
wider type to a vector of N elements of that type. That puts
the desired bits into the low order bytes of element zero and
they need to be in the high order bytes on big endian systems.
This patch changes the legalization to widen to a vector with
elements of the original scalar size.

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

17 months ago[flang] Disable libstdc++ assertions in the runtime library
Jay Foad [Thu, 2 Feb 2023 12:18:41 +0000 (12:18 +0000)]
[flang] Disable libstdc++ assertions in the runtime library

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

17 months ago[MLIR] NFC: fully scope use FastMathFlag.
Christian Sigg [Thu, 2 Feb 2023 17:24:13 +0000 (18:24 +0100)]
[MLIR] NFC: fully scope use FastMathFlag.

17 months agoRevert "[LSAN] Enable more tests which are passing as is in HWASAN."
Kirill Stoimenov [Thu, 2 Feb 2023 17:10:34 +0000 (17:10 +0000)]
Revert "[LSAN] Enable more tests which are passing as is in HWASAN."

This reverts commit b4abbf17572dce3993402f2e00e72678518ef6e1.

17 months ago[AMDGPU] GFX11: accept global_atomic_csub as an alias
Jay Foad [Thu, 2 Feb 2023 13:38:37 +0000 (13:38 +0000)]
[AMDGPU] GFX11: accept global_atomic_csub as an alias

GFX11 renamed this instruction to global_atomic_csub_u32 but should
accept the old name as an alias, for consistency with the other global
atomics and with buffer_atomic_csub.

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

17 months ago[flang] Avoid double finalization in Assign
Valentin Clement [Thu, 2 Feb 2023 17:02:01 +0000 (18:02 +0100)]
[flang] Avoid double finalization in Assign

First call to Assign is issuing finalization for the
LHS and its components. Avoid calling finalization for components
again when doing the component by component assignment.

Reviewed By: klausler

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

17 months ago[clang][driver] Emit an error for `/clang:-x`
Mariya Podchishchaeva [Thu, 2 Feb 2023 16:41:11 +0000 (11:41 -0500)]
[clang][driver] Emit an error for `/clang:-x`

`/clang:-x` emits an error instead of a warning. And if the error is suppressed,
`/clang:-x` takes no effect.
Considering that `/clang:` is a recent addition in 2018-11 and there are MSVC
style alternatives, therefore `/clang:-x` doesn't seem useful and we just reject
it since properly supporting it would add lots of complexity.

Fixes #59307

Reviewed By: MaskRay

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

17 months agoReapply 9cffabc68ca380be937e192be909feff7b144822
Mircea Trofin [Thu, 2 Feb 2023 16:03:35 +0000 (08:03 -0800)]
Reapply 9cffabc68ca380be937e192be909feff7b144822

This reverts commit 735f117f4d0deb9644d65c8fe8a80add058e7a2b.

17 months ago[LSAN] Enable more tests which are passing as is in HWASAN.
Kirill Stoimenov [Thu, 2 Feb 2023 01:19:35 +0000 (01:19 +0000)]
[LSAN] Enable more tests which are passing as is in HWASAN.

Reviewed By: vitalybuka

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

17 months ago[C++20] Fix a crash with modules.
Utkarsh Saxena [Mon, 23 Jan 2023 18:15:46 +0000 (19:15 +0100)]
[C++20] Fix a crash with modules.

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