platform/upstream/llvm.git
2 years agoRe-land "[VP] vp intrinsics are not speculatable" with test fix
Simon Moll [Mon, 30 May 2022 12:38:59 +0000 (14:38 +0200)]
Re-land "[VP] vp intrinsics are not speculatable" with test fix

Update the llvmir-intrinsics.mlir test to account for the modified
attribute sets.

This reverts commit 2e2a8a2d9082250e4aad312c6008a526f2b007c7.

2 years agoRevert "[VP] vp intrinsics are not speculatable"
Mehdi Amini [Mon, 30 May 2022 12:26:16 +0000 (12:26 +0000)]
Revert "[VP] vp intrinsics are not speculatable"

This reverts commit 78a18d2b54e7e8e0e2c1d1cb33d015d7f69b8cc7.

Break MLIR bot: https://lab.llvm.org/buildbot/#/builders/61/builds/27127

2 years agoApply clang-tidy fixes for llvm-else-after-return in OpPythonBindingGen.cpp (NFC)
Mehdi Amini [Tue, 24 May 2022 01:28:57 +0000 (01:28 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in OpPythonBindingGen.cpp (NFC)

2 years agoApply clang-tidy fixes for modernize-use-override in SparseTensorUtils.cpp (NFC)
Mehdi Amini [Tue, 24 May 2022 00:41:23 +0000 (00:41 +0000)]
Apply clang-tidy fixes for modernize-use-override in SparseTensorUtils.cpp (NFC)

2 years agoRevert "build_llvm_package.bat: Produce zip files in addition to the installers"
Hans Wennborg [Mon, 30 May 2022 11:55:54 +0000 (13:55 +0200)]
Revert "build_llvm_package.bat: Produce zip files in addition to the installers"

The zip files were too large to be practical, so they were never
shipped. Reverting to reduce build time and complexity of the script.

This reverts commit 4486aa03c5f431ba33a1d1ac9991da912e3decd9.

2 years ago[OpenMP] Pass chunk-size to MLIR while lowering from parse-tree
Mats Petersson [Mon, 22 Mar 2021 15:28:31 +0000 (15:28 +0000)]
[OpenMP] Pass chunk-size to MLIR while lowering from parse-tree

Test that chunk size is passed to the static init function.
Using three different variations:
1. Single constant.
2. Expression with constants.
3. Variable value.

Reviewed By: peixin, shraiysh

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

2 years ago[MemDep][NFC] Remove duplicating check in `if` and `else` branch
Max Kazantsev [Mon, 30 May 2022 10:28:33 +0000 (17:28 +0700)]
[MemDep][NFC] Remove duplicating check in `if` and `else` branch

Same check is done whether the condition is true or false. Just hoist
it out of conditional.

2 years ago[VP] vp intrinsics are not speculatable
Simon Moll [Mon, 30 May 2022 10:19:48 +0000 (12:19 +0200)]
[VP] vp intrinsics are not speculatable

VP intrinsics show UB if the %evl parameter is out of bounds - they must
not carry the speculatable attribute.  The out-of-bounds UB disappears
when the %evl parameter is expanded into the mask or expansion replaces
the entire VP intrinsic with non-VP code.

This patch
- Removes the speculatable attribute on all VP intrinsics.
- Generalizes the isSafeToSpeculativelyExecute function to let VP
  expansion know whether the VP intrinsic replacement will be
  speculatable.  VP expansion may only discard %evl where this is the
  case.

Reviewed By: frasercrmck

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

2 years ago[MemDep][NFCI] Remove redundant dyn_cast, replace with cast
Max Kazantsev [Mon, 30 May 2022 10:16:42 +0000 (17:16 +0700)]
[MemDep][NFCI] Remove redundant dyn_cast, replace with cast

When `IsLoad` is `true`, we don't need to check if the instruction
is actually a load with dyn_cast. Saves some petty amount of CT.

2 years agoUpdate the Windows packaging script
Hans Wennborg [Mon, 30 May 2022 09:51:28 +0000 (11:51 +0200)]
Update the Windows packaging script

Check in updates based on how the latest release was built [0] and add
the bug fix from [1] which allows LLDB to start.

Other changes which had accumulated in the local release script:
- Don't build the clang format plugin (VS has the functionality built
  in now)
- Disable tests that have been failing (I'll try to follow up and
  re-enable them)
- Switch to Python 3.10
- Jump through more hoops to make LLDB pick the right Python.

0. https://discourse.llvm.org/t/14-0-4-final-has-been-tagged/62750/3
1. https://github.com/llvm/llvm-project/issues/54589

2 years agoTest stackmap support for floating point types.
Edd Barrett [Mon, 30 May 2022 09:18:22 +0000 (10:18 +0100)]
Test stackmap support for floating point types.

It appears that float support is complete, or at least, the stackmap records
emitted are not inconceivable (I must admit that I don't know about many of the
architectures under test here).

One curiosity, the SystemZ tests highlight an undocumented (or maybe incorrect)
quirk of the stackmap format: in the case of a Register record, the Offset or
SmallConstant field can encode a sub-register index! I've only ever seen this
field zero for Register entries up until now.

2 years ago[OpenCL] Expose wg collective functions for CL3 SPIR targets
Sven van Haastregt [Mon, 30 May 2022 09:48:49 +0000 (10:48 +0100)]
[OpenCL] Expose wg collective functions for CL3 SPIR targets

Since the SPIR/SPIR-V targets enable all known features, we must
ensure the Work-group Collective Functions feature macro is set for
OpenCL 3.0.

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

2 years ago[AArch64] Tests for showing MachineCombiner COPY patterns. NFC
David Green [Mon, 30 May 2022 09:47:44 +0000 (10:47 +0100)]
[AArch64] Tests for showing MachineCombiner COPY patterns. NFC

2 years ago[mlir] add interchange, pad and scalarize to structured transform dialect
Alex Zinenko [Tue, 24 May 2022 16:25:57 +0000 (18:25 +0200)]
[mlir] add interchange, pad and scalarize to structured transform dialect

Add ops to the structured transform extension of the transform dialect that
perform interchange, padding and scalarization on structured ops. Along with
tiling that is already defined, this provides a minimal set of transformations
necessary to build vectorizable code for a single structured op.

Define two helper traits: one that implements TransformOpInterface by applying
a function to each payload op independently and another that provides a simple
"functional-style" producer/consumer list of memory effects for the transform
ops.

Reviewed By: nicolasvasilache

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

2 years ago[AMDGPU][GFX9][NFC] Rename the base class for SMEM stores.
Ivan Kosarev [Mon, 30 May 2022 09:31:59 +0000 (10:31 +0100)]
[AMDGPU][GFX9][NFC] Rename the base class for SMEM stores.

2 years ago[AMDGPU][GFX9] Support base+soffset+offset SMEM stores.
Ivan Kosarev [Mon, 30 May 2022 09:26:49 +0000 (10:26 +0100)]
[AMDGPU][GFX9] Support base+soffset+offset SMEM stores.

Reviewed By: dp

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

2 years ago[X86] Adjust vector fp test costs to match int test costs
Simon Pilgrim [Mon, 30 May 2022 08:50:08 +0000 (09:50 +0100)]
[X86] Adjust vector fp test costs to match int test costs

znver1/2 models were missing the vtestps/pd overrides to match the vptest integer equivalents.

Noticed while investigating Issue #54889

2 years agoRevert "[mlir] Lower complex.sqrt and complex.atan2 to Arithmetic dialect."
Alexander Belyaev [Mon, 30 May 2022 08:48:58 +0000 (10:48 +0200)]
Revert "[mlir] Lower complex.sqrt and complex.atan2 to Arithmetic dialect."

This reverts commit f5fa633b0955a8cee878b384801038fccef11fdc.

Integration test sparse_complex_ops.mlir breaks because of it.

2 years ago[MLIR][NVVM] NFC: add labels to test functions.
Christian Sigg [Mon, 30 May 2022 07:18:23 +0000 (09:18 +0200)]
[MLIR][NVVM] NFC: add labels to test functions.

Reviewed By: ftynse

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

2 years ago[M68k] Remove unused variable to fix MSVC warning. NFC.
Simon Pilgrim [Mon, 30 May 2022 07:59:49 +0000 (08:59 +0100)]
[M68k] Remove unused variable to fix MSVC warning. NFC.

2 years ago[X86] Adjust vector extend to ymm to match SoG (Issue #54889)
Simon Pilgrim [Mon, 30 May 2022 07:51:39 +0000 (08:51 +0100)]
[X86] Adjust vector extend to ymm to match SoG (Issue #54889)

znver1 ymm variants of VPMOVSX**/VPMOVZX** instructions require double pumping.

Now matches AMD SoG, Agner and instlatx64 numbers.

Thanks to @fabian-r for the report

2 years ago[GVN] Enable enable-split-backedge-in-load-pre option by default
Nikita Popov [Wed, 25 May 2022 14:37:38 +0000 (16:37 +0200)]
[GVN] Enable enable-split-backedge-in-load-pre option by default

This option was added in D89854. It prevents GVN from performing
load PRE in a loop, if doing so would require critical edge
splitting on the backedge. From the review:

> I know that GVN Load PRE negatively impacts peeling,
> loop predication, so the passes expecting that latch has
> a conditional branch.

In the PhaseOrdering test in this patch, splitting the backedge
negatively affects vectorization: After critical edge splitting,
the loop gets rotated, effectively peeling off the first loop
iteration. The effect is that the first element is handled
separately, then the bulk of the elements use a vectorized
reduction (but using unaligned, off-by-one memory accesses) and
then a tail of 15 elements is handled separately again.

It's probably worth noting that the loop load PRE from D99926 is
not affected by this change (as it does not need backedge
splitting). This is about normal load PRE that happens to occur
inside a loop.

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

2 years ago[mlir] Lower complex.sqrt and complex.atan2 to Arithmetic dialect.
Alexander Belyaev [Fri, 27 May 2022 13:59:19 +0000 (15:59 +0200)]
[mlir] Lower complex.sqrt and complex.atan2 to Arithmetic dialect.

I don't see a point here in the lit tests here since sqrt, mul and other ops
expand as well. I just added "smoke" tests to verify that the conversion works
and does not create any illegal ops.

I will create a patch that adds a simple integration test to
mlir/test/Integration/Dialect/ComplexOps/ that will compare the values.

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

2 years ago[MLIR][GPU] Expose GpuParallelLoopMapping as non-test pass.
Christian Sigg [Mon, 30 May 2022 06:32:01 +0000 (08:32 +0200)]
[MLIR][GPU] Expose GpuParallelLoopMapping as non-test pass.

Reviewed By: bondhugula, herhut

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

2 years ago[pseudo] Remove an unnecessary nullable check diagnostic in the bnf
Haojian Wu [Mon, 30 May 2022 07:01:55 +0000 (09:01 +0200)]
[pseudo] Remove an unnecessary nullable check diagnostic in the bnf
grammar, NFC.

This diagnostic has been handled in eliminateOptional.

2 years ago[NFC] Use %clang instead of %clang++ in tests
Chuanqi Xu [Mon, 30 May 2022 06:38:04 +0000 (14:38 +0800)]
[NFC] Use %clang instead of %clang++ in tests

Previously the tests uses %clang++ instead of %clang, which cause the
test fail in windows.

2 years ago[gn build] Port 751c7be5b20f
LLVM GN Syncbot [Mon, 30 May 2022 06:27:55 +0000 (06:27 +0000)]
[gn build] Port 751c7be5b20f

2 years ago[TableGen] Remove code beads
Sheng [Mon, 30 May 2022 06:26:38 +0000 (14:26 +0800)]
[TableGen] Remove code beads

Code beads is useless since the only user, M68k, has moved on to
a new encoding/decoding infrastructure.

Reviewed By: myhsu

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

2 years ago[Driver] Enable to use C++20 standalne by -fcxx-modules
Chuanqi Xu [Mon, 30 May 2022 02:08:39 +0000 (10:08 +0800)]
[Driver] Enable to use C++20 standalne by -fcxx-modules

This patch allows user to use C++20 module by -fcxx-modules. Previously,
we could only use it under -std=c++20. Given that user could use C++20
coroutine standalonel by -fcoroutines-ts. It makes sense to offer an
option to use C++20 modules without enabling C++20.

Reviewed By: iains, MaskRay

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

2 years ago[JumpThreading][NFCI] Reuse existing DT instead of recomputation
Max Kazantsev [Mon, 30 May 2022 05:48:10 +0000 (12:48 +0700)]
[JumpThreading][NFCI] Reuse existing DT instead of recomputation

This whole part with recomputation of BPI and BFI looks redundant,
and we tried to get rid of it in D124439. Unfortunately, it causes
some hard-to-reproduce failures due to invalid state of analysis.
Until this is investigated and fixed, let's try to reuse at least
part of available analyzes.

DT is available at this point, and there is no need to recompute it.

Please revert if you see it causing *any* behavior changes.

2 years ago[clang-apply-replacements] Added an option to ignore insert conflict.
Sockke [Mon, 30 May 2022 05:02:25 +0000 (13:02 +0800)]
[clang-apply-replacements] Added an option to ignore insert conflict.

If two different texts are inserted at the same offset, clang-apply-replacements prints the conflict error and discards all fixes. This patch adds support for adjusting conflict offset and keeps running to continually fix them.

https://godbolt.org/z/P938EGoxj doesn't have any fixes when I run run-clang-tidy.py to generate a YAML file with clang-tidy and fix them with clang-apply-replacements. The YAML file has two different header texts insertions at the same offset, unlike clang-tidy with '-fix', clang-apply-replacements does not adjust for this conflict.

Reviewed By: aaron.ballman

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

2 years ago[RISCV] Support VP_REDUCE_MUL mask operation
Ping Deng [Mon, 30 May 2022 02:54:23 +0000 (02:54 +0000)]
[RISCV] Support VP_REDUCE_MUL mask operation

Reviewed By: reames

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

2 years ago[LegalizeTypes][VP] Add integer promotion support for vp.fptosi/vp.fptoui
Ping Deng [Mon, 30 May 2022 02:52:40 +0000 (02:52 +0000)]
[LegalizeTypes][VP] Add integer promotion support for vp.fptosi/vp.fptoui

Reviewed By: craig.topper

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

2 years agoRevert "[Driver] Enable to use C++20 standalne by -fcxx-modules"
Chuanqi Xu [Mon, 30 May 2022 02:43:13 +0000 (10:43 +0800)]
Revert "[Driver] Enable to use C++20 standalne by -fcxx-modules"

This reverts commit 99eca8353808f63670c647aeae03e0ce66eb21e0.

Since it would cause clang-tools-extra fail.

2 years ago[Driver] Enable to use C++20 standalne by -fcxx-modules
Chuanqi Xu [Mon, 30 May 2022 02:08:39 +0000 (10:08 +0800)]
[Driver] Enable to use C++20 standalne by -fcxx-modules

This patch allows user to use C++20 module by -fcxx-modules. Previously,
we could only use it under -std=c++20. Given that user could use C++20
coroutine standalonel by -fcoroutines-ts. It makes sense to offer an
option to use C++20 modules without enabling C++20.

Reviewed By: iains, MaskRay

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

2 years ago[InstCombine] bitcast (extractelement <1 x elt>, dest) -> bitcast(<1 x elt>, dest)
Chenbing Zheng [Mon, 30 May 2022 02:16:32 +0000 (10:16 +0800)]
[InstCombine] bitcast (extractelement <1 x elt>, dest) -> bitcast(<1 x elt>, dest)

Only solve dest type is vector to avoid inverse transform in visitBitCast.

Reviewed By: spatel

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

2 years agoFix `performance-unnecessary-value-param` for template specialization
Sockke [Mon, 30 May 2022 01:43:27 +0000 (09:43 +0800)]
Fix `performance-unnecessary-value-param` for template specialization

The checker missed a check for parameter type of primary template of specialization template and this could cause build breakages.

Reviewed By: aaron.ballman, flx

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

2 years ago[NFC][VP] Fix llvm.vp.merge intrinsic Expansion in LangRef
Lian Wang [Fri, 27 May 2022 06:20:21 +0000 (06:20 +0000)]
[NFC][VP] Fix llvm.vp.merge intrinsic Expansion in LangRef

Reviewed By: simoll

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

2 years ago[RISCV] isel (add (and X, 0x1FFFFFFFE), Y) as (SH1ADD (SRLI X, 1), Y)
Craig Topper [Mon, 30 May 2022 01:05:06 +0000 (18:05 -0700)]
[RISCV] isel (add (and X, 0x1FFFFFFFE), Y) as (SH1ADD (SRLI X, 1), Y)

This pattern is what we get after DAG combine for C code like this.

short *ptr1, *ptr2, *ptr3;
unsigned diff = ptr1 - ptr2;
return ptr3[diff];

Reviewed By: reames

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

2 years ago[RISCV] Add test cases showing missed opportunity to use shXadd.uw. NFC
Craig Topper [Mon, 30 May 2022 01:03:25 +0000 (18:03 -0700)]
[RISCV] Add test cases showing missed opportunity to use shXadd.uw. NFC

The tests here show the codegen for something like this C code.

unsigned diff = ptr1 - ptr2;
return ptr3[diff];

The pointer difference is truncated to 32-bits before being used
again as an index. In SelectionDAG this appears as an AND between
a SRL and a SHL. DAGCombiner will remove the shifts leaving only
an AND. The Mask now has 1,2, or 3 trailing zeros and 31, 30, or 29
leading zeros. We end up falling back to constant materialization
to create this mask.

We could instead use srli followed by slli.uw. Or since
we have an add, we can use srli followed by shXadd.uw.

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

2 years agoRecommit "[LICM] Only create load in ph when promoting load or store doesn't exec."
Florian Hahn [Sun, 29 May 2022 20:57:14 +0000 (21:57 +0100)]
Recommit "[LICM] Only create load in ph when promoting load or store doesn't exec."

This reverts the revert commit ad95255b9215a.

The updated version also creates a load when the store may not execute.
In those cases, we still need to introduce a load in a function where
there may not have been one before, so this doesn't completely resolve
issue #51248.

Original message:

    When only a store is sunk, there is no need to create a load in the
    pre-header, as the result of the load will never get used.

    The dead load can can introduce UB, if the function is marked as
    writeonly.

    Reviewed By: nikic

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

2 years ago[AArch64] Reuse larger DUP if available
David Green [Sun, 29 May 2022 18:42:13 +0000 (19:42 +0100)]
[AArch64] Reuse larger DUP if available

If both a v2i32 DUP(x) and a v4i32 DUP(x) node exists, we can re-use the
larger node using a vector extract to obtain the smaller. This comes up
in the smull/smlal code, but needs a small fixup to allow the smull2
code in tryExtendDUPToExtractHigh/performAddSubLongCombine to still
match smull2 extracts.

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

2 years ago[libc++][test] Remove Clang <= 3.7 workaround in is_default_constructible test
Joe Loser [Sat, 28 May 2022 23:08:18 +0000 (17:08 -0600)]
[libc++][test] Remove Clang <= 3.7 workaround in is_default_constructible test

Clang 3.7 and below is not actively used or supported in the test suite now, so
remove the workaround in the test.

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

2 years ago[InstCombine] Add baseline tests for shift+and+icmp transforms; NFC
chenglin.bi [Sun, 29 May 2022 17:01:37 +0000 (01:01 +0800)]
[InstCombine] Add baseline tests for shift+and+icmp transforms; NFC

2 years ago[X86] Adjust vector shift costs to match SoG (Issue #54889)
Simon Pilgrim [Sun, 29 May 2022 16:55:39 +0000 (17:55 +0100)]
[X86] Adjust vector shift costs to match SoG (Issue #54889)

znver1/2 models were incorrectly modelling the fpupipe (should be pipe2 for shift-by-scalar-amount and pipe1 for shift-by-element-amount) and znver1 ymm variants also require double pumping.

Now matches AMD SoG, Agner and instlatx64 numbers.

Thanks to @fabian-r for the report

2 years ago[InstCombine] Add baseline tests for shift+and transforms; NFC
chenglin.bi [Sun, 29 May 2022 16:30:56 +0000 (00:30 +0800)]
[InstCombine] Add baseline tests for shift+and transforms; NFC

2 years ago[libc++][doc] Clarify wording on the status page.
Mark de Wever [Sun, 15 May 2022 13:29:03 +0000 (15:29 +0200)]
[libc++][doc] Clarify wording on the status page.

Reviewed By: philnik, #libc

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

2 years ago[libc++] Adds __format_string as nasty macro.
Mark de Wever [Sun, 15 May 2022 13:17:46 +0000 (15:17 +0200)]
[libc++] Adds __format_string as nasty macro.

Both D121530 and D125606 had issues with this macro.

Reviewed By: #libc, philnik

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

2 years ago[libclang] Fix error message capitalization
Ayke van Laethem [Sun, 29 May 2022 11:42:22 +0000 (13:42 +0200)]
[libclang] Fix error message capitalization

This was a review suggestion from MaskRay that I forgot to incorporate
in the patch.

See: https://reviews.llvm.org/D124815

2 years ago[libclang] Fall back to getMainExecutable when dladdr fails
Ayke van Laethem [Tue, 3 May 2022 00:53:05 +0000 (02:53 +0200)]
[libclang] Fall back to getMainExecutable when dladdr fails

musl-libc doesn't support dladdr in statically linked binaries:

> Are you using static or dynamic linking? If static, dladdr is just a
> stub that always fails. It could be implemented to work under some
> conditions, but it would be highly dependent on what options you
> compile the binary with, since by default static binaries do not
> contain the bloat that would be needed to perform introspection.

Source: https://www.openwall.com/lists/musl/2013/01/15/25 (in response
to a bug report).

Libclang unfortunately uses dladdr to find the ResourcesPath so will
fail if it is linked statically on Alpine Linux. This patch fixes this
issue by falling back to getMainExecutable if dladdr returns an error.

Reference: https://github.com/llvm/llvm-project/issues/40641#issuecomment-981011427

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

2 years ago[libc++] Use __enable_if_t and is_integral in cstddef
Nikolas Klauser [Sat, 28 May 2022 13:22:25 +0000 (15:22 +0200)]
[libc++] Use __enable_if_t and is_integral in cstddef

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

2 years ago[mlir][NFC] Trivial : Fix typo
Javed Absar [Sat, 28 May 2022 19:32:13 +0000 (20:32 +0100)]
[mlir][NFC] Trivial : Fix typo

Reviewed By: JohnTitor

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

2 years ago[libc++] Adds missing includes.
Mark de Wever [Sun, 29 May 2022 09:11:32 +0000 (11:11 +0200)]
[libc++] Adds missing includes.

This fixes the broken Apple builds. This has been tested in D121530
(https://buildkite.com/llvm-project/libcxx-ci/builds/11113)

2 years ago[clang-repl] Recover the lookup tables of the primary context.
Purva-Chaudhari [Sun, 29 May 2022 04:55:10 +0000 (04:55 +0000)]
[clang-repl] Recover the lookup tables of the primary context.

Before this patch, there was re-declaration error if error was encountered in
the same line. The recovery support acted only if this type of error was
encountered in the first line of the program and not in subsequent lines.

For example:

```
clang-repl> int i=9;
clang-repl> int j=9; err;
input_line_3:1:5: error: redefinition of 'j'
int j = 9;
```

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

2 years ago[clang] Remove `rm` script which is no longer necessary
Yuki Okushi [Sat, 28 May 2022 16:26:46 +0000 (01:26 +0900)]
[clang] Remove `rm` script which is no longer necessary

8b4fa2c98e07997469f53bee30c0d24a61dc7c8c added this to remove left-over files on January.
Now we could assume they're cleaned up and this `rm` script is no longer necessary as FIXME states.

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

2 years ago[MLIR][Presburger] Add applyDomain/Range to IntegerRelation
Groverkss [Sat, 28 May 2022 20:36:11 +0000 (02:06 +0530)]
[MLIR][Presburger] Add applyDomain/Range to IntegerRelation

This patch adds support for applying a relation on domain/range of a relation.

Reviewed By: arjunp, ftynse

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

2 years ago[VPlan] Use Exiting-block instead of Exit-block terminology (NFC).
Florian Hahn [Sat, 28 May 2022 20:16:05 +0000 (21:16 +0100)]
[VPlan] Use Exiting-block instead of Exit-block terminology (NFC).

In LLVM's common loop terminology, an exit block is a block outside a
loop with a predecessor inside the loop. An exiting block is a block
inside the loop which branches to an exit block outside the loop.

This patch updates a few places where VPlan was using ExitBlock for a
block exiting a region. Those instances have been updated to use
ExitingBlock.

Reviewed By: Ayal

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

2 years agoIncrease the default maximum stack walk
Jason Molenda [Sat, 28 May 2022 20:09:36 +0000 (13:09 -0700)]
Increase the default maximum stack walk

lldb will only backtrace a fixed number of stack frames, as a
last-ditch attempt to avoid a runaway looping backtrace.  It's
unusual that anyone ends up depending on this final safety net in
years. I picked the original number of 300000 was picked by seeing
how many stack frames I could make in a small recursive function
on Darwin systems before using the default stack space.  Checking
again today on a modern system, I can exceed this limit & lldb will
not show the original invocation of the recursing call.  Double the
old value to cover this larger maximum possible stack frame count,
as a default value.
(`target.process.thread.max-backtrace-depth`)

2 years ago[flang] Make extension explicit: exponent-letter matching kind-param
Emil Kieri [Fri, 27 May 2022 22:27:59 +0000 (00:27 +0200)]
[flang] Make extension explicit: exponent-letter matching kind-param

As an extension for REAL literals, we allow an exponent letter which
matches an explicit kind-param. The standard requires the exponent
to be 'E' if a kind-param is present. This patch
 - documents this extension in Extensions.md
 - enables a portability warning if it is used with -pedantic

The test case for this, kinds05.f90, needs D125804, which makes
test_errors.py test warnings as well, to actually test the warnings.
I include it already now to keep things together, it will do no harm
(I hope ...).

We also add WARNING-directives to the test kinds04.f90 in preparation
for D125804. As the exponent-letter 'Q' does not imply the same kind
on all platforms, the emitted warnings are platform-dependent.
Therefore, the test is duplicated into two variants which are run
conditionally.

Finally, we promote the portability warning for when the exponent letter
is neither 'E' nor matching the kind-param to a standard warning.

Reviewed By: klausler

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

2 years ago[clang][cmake] Fixed typo in hmaptool CMakeLists.txt
Daniel Hannon [Sat, 28 May 2022 17:10:10 +0000 (10:10 -0700)]
[clang][cmake] Fixed typo in hmaptool CMakeLists.txt

There was a typo in the CMakeLists.txt for hmap tool that installed it to the wrong directory

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

Reviewed By: keith

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

2 years ago[flang] Make generic resolution conform to 15.5.5.2 w/r/t host association
Peter Klausler [Thu, 26 May 2022 23:56:27 +0000 (16:56 -0700)]
[flang] Make generic resolution conform to 15.5.5.2 w/r/t host association

When two or more generic interfaces are available by declaration or
by USE association at different scoping levels, we need to search
the outer generic interfaces as well as the inner ones, but only after
the inner ones have failed to produce a specific procedure that matches
a given set of actual arguments.  This means that it is possible for
a specific procedure of a generic interface of an inner scope to override
a conflicting specific procedure of a generic interface of an outer
scope.

Also cope with forward references to derived types when a generic
interface is also in scope.

Fixes LLVM bug https://github.com/llvm/llvm-project/issues/55240 and
LLVM bug https://github.com/llvm/llvm-project/issues/55300.

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

2 years ago[nfc][flang] Fix spelling errors and usage in an error message
Peter Klausler [Thu, 26 May 2022 18:01:19 +0000 (11:01 -0700)]
[nfc][flang] Fix spelling errors and usage in an error message

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

2 years agoRemove `deplibs` keyword completely
Yuki Okushi [Fri, 27 May 2022 10:21:52 +0000 (19:21 +0900)]
Remove `deplibs` keyword completely

D102763 removed the almost support of `deplibs` but it seems `kw_deplibs` was missed.
This patch removes it.

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

2 years ago[flang] Avoid spurious warnings from reading module files
Peter Klausler [Tue, 24 May 2022 22:06:12 +0000 (15:06 -0700)]
[flang] Avoid spurious warnings from reading module files

When processing the literal constants of the various kinds of
INTEGER that are too large by 1 (e.g., 2147483648_4) in expression
analysis, emit a portability warning rather than a fatal error if
the literal constant appears as the operand to a unary minus, since
the folded result will be in range.  And don't emit any warning if
the negated literal is coming from a module file -- f18 wrote the
module file and the warning would simply be confusing, especially to
the programmer that wrote (-2147483647_4-1) in the first place.

Further, emit portability warnings for the canonical expressions for
infinities and NaN (-1./0., 0./0., & 1./0.), but not when they appear
in a module file, for the same reason.  The Fortran language has no
syntax for these special values so we have to emit expressions that
fold to them.

Fixes LLVM bugs https://github.com/llvm/llvm-project/issues/55086 and
https://github.com/llvm/llvm-project/issues/55081.

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

2 years ago[docs] Update the label name for new contributors
Yuki Okushi [Fri, 27 May 2022 09:03:30 +0000 (18:03 +0900)]
[docs] Update the label name for new contributors

The `beginner` label is deprecated
and the `good first issue` label is now preferred.

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

2 years ago[libc++] Minor emscripten changes from downstream
Sam Clegg [Sat, 22 May 2021 13:39:33 +0000 (06:39 -0700)]
[libc++] Minor emscripten changes from downstream

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

2 years ago[flang][OpenMP] Fix pointer variables in atomic read/write
Peixin-Qiao [Sat, 28 May 2022 08:41:14 +0000 (16:41 +0800)]
[flang][OpenMP] Fix pointer variables in atomic read/write

For pointer variables, using getSymbolAddress cannot get the coorect
address for atomic read/write operands. Use genExprAddr to fix it.

Reviewed By: shraiysh, NimishMishra

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

2 years ago[flang][OpenMP][OpenACC] Fix exit of a region
Peixin-Qiao [Sat, 28 May 2022 08:34:26 +0000 (16:34 +0800)]
[flang][OpenMP][OpenACC] Fix exit of a region

The stop statement is allowed in OpenMP/OpenACC block region.

Reviewed By: kiranchandramohan, shraiysh

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

2 years ago[gn build] Port 30c37fb89cb7
LLVM GN Syncbot [Sat, 28 May 2022 08:16:52 +0000 (08:16 +0000)]
[gn build] Port 30c37fb89cb7

2 years ago[libc++] Granularize more of <type_traits>
Nikolas Klauser [Thu, 26 May 2022 09:49:01 +0000 (11:49 +0200)]
[libc++] Granularize more of <type_traits>

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[libc++] Remove unused __functional includes
Nikolas Klauser [Fri, 20 May 2022 22:45:51 +0000 (00:45 +0200)]
[libc++] Remove unused __functional includes

Reviewed By: ldionne, #libc

Spies: arichardson, smeenai, libcxx-commits, arphaman

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

2 years ago[Lex] Fix crash during dependency scanning while skipping an unmatched `#if`
Argyrios Kyrtzidis [Sat, 28 May 2022 06:59:30 +0000 (23:59 -0700)]
[Lex] Fix crash during dependency scanning while skipping an unmatched `#if`

2 years ago[CompilerInstance] Fix weird condition on `createCodeCompletionConsumer`
Yuki Okushi [Fri, 27 May 2022 08:42:49 +0000 (17:42 +0900)]
[CompilerInstance] Fix weird condition on `createCodeCompletionConsumer`

Fixes llvm#53545

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

2 years ago[Driver] Replace err_invalid_branch_protection with err_drv_unsupported_option_argument
Fangrui Song [Sat, 28 May 2022 05:28:39 +0000 (22:28 -0700)]
[Driver] Replace err_invalid_branch_protection with err_drv_unsupported_option_argument

The convention is to use err_drv_unsupported_option_argument instead of adding a
new diagnostic for every option.

2 years ago[ARM][AArch64] Change -mharden-sls= to use err_drv_unsupported_option_argument
Fangrui Song [Sat, 28 May 2022 05:03:48 +0000 (22:03 -0700)]
[ARM][AArch64] Change -mharden-sls= to use err_drv_unsupported_option_argument

Update the diagnostic in D81404: the convention is to use
err_drv_unsupported_option_argument instead of adding a new diagnostic for every
option.

Reviewed By: nickdesaulniers

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

2 years ago[scudo] Clean up Zircon header file uses
Roland McGrath [Sat, 28 May 2022 01:22:38 +0000 (18:22 -0700)]
[scudo] Clean up Zircon header file uses

Make fuchsia.h and fuchsia.cpp each include what they use.

2 years ago[mlir][bufferization] Add extra filter mechanism to bufferizeOp
Matthias Springer [Sat, 28 May 2022 02:48:36 +0000 (04:48 +0200)]
[mlir][bufferization] Add extra filter mechanism to bufferizeOp

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

2 years ago[mlir][bufferize][NFC] Split analysis+bufferization of ModuleBufferization
Matthias Springer [Sat, 28 May 2022 02:42:47 +0000 (04:42 +0200)]
[mlir][bufferize][NFC] Split analysis+bufferization of ModuleBufferization

Analysis and bufferization can now be run separately.

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

2 years ago[mlir][bufferization][NFC] Remove post-analysis step infrastructure
Matthias Springer [Sat, 28 May 2022 02:36:24 +0000 (04:36 +0200)]
[mlir][bufferization][NFC] Remove post-analysis step infrastructure

Now that analysis and bufferization are better separated, post-analysis steps are no longer needed. Users can directly interleave analysis and bufferization as needed.

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

2 years ago[mlir][bufferization][NFC] Move OpFilter out of BufferizationOptions
Matthias Springer [Fri, 27 May 2022 23:45:55 +0000 (01:45 +0200)]
[mlir][bufferization][NFC] Move OpFilter out of BufferizationOptions

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

2 years ago[OpenACC][OpenMP] Document atomic-in-teams extension
Joel E. Denny [Fri, 27 May 2022 22:53:19 +0000 (18:53 -0400)]
[OpenACC][OpenMP] Document atomic-in-teams extension

That is, put D126323 in the status doc and explain its relationship to
OpenACC support.

Reviewed By: jdoerfert

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

2 years ago[RISCV] Allow PRE of vsetvli involving non-1 LMUL
Philip Reames [Fri, 27 May 2022 22:37:42 +0000 (15:37 -0700)]
[RISCV] Allow PRE of vsetvli involving non-1 LMUL

This is a follow up to address a review comment from D124869. When deciding whether to PRE a vsetvli, we can allow non-LMUL1 vsetvlis.

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

2 years ago[LSR][TTI][PowerPC][SystemZ][X86] Add const-ness to TTI::isLSRCostLess. NFC
eopXD [Wed, 25 May 2022 03:06:34 +0000 (20:06 -0700)]
[LSR][TTI][PowerPC][SystemZ][X86] Add const-ness to TTI::isLSRCostLess. NFC

Reviewed By: Meinersbur

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

2 years ago[bazel] BLAKE3: Adopt aarch64 and x86_64.
NAKAMURA Takumi [Fri, 27 May 2022 14:39:52 +0000 (23:39 +0900)]
[bazel] BLAKE3: Adopt aarch64 and x86_64.

FIXME: arm(32) may be applicable here. I haven't tested yet.

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

2 years ago[lldb] Fix cross compiling on macOS
Martin Storsjö [Fri, 27 May 2022 13:37:43 +0000 (16:37 +0300)]
[lldb] Fix cross compiling on macOS

When cross compiling, a separate nested cmake is spawned, for building
host code generation tools such as lldb-tblgen.

When cross compiling on macOS, the nested native build would trigger
the lldb check for libc++, if testing is enabled (which it is by default).
(Even if `LLDB_INCLUDE_TESTS=OFF` is set on the main build, it has to
be passed separately in `CROSS_TOOLCHAIN_FLAGS_NATIVE` to reach the
nested build.)

Skip this check when building the host tools when cross compiling, as
the user won't try to run tests in that nested build.

(Alternatively, we could consider disabling all the `*_INCLUDE_TESTS`
by default in the nested host tools build.)

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

2 years ago[RISCV] Correct load/store alignments in sink-splat-operands.ll. NFC
Craig Topper [Fri, 27 May 2022 21:39:30 +0000 (14:39 -0700)]
[RISCV] Correct load/store alignments in sink-splat-operands.ll. NFC

These should be aligned to the natural alignment of the element.
Probably copy/paste mistake from the i32 tests.

Reviewed By: reames

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

2 years ago[mlir][sparse] Fixes C++98 warning
wren romano [Fri, 27 May 2022 19:42:46 +0000 (12:42 -0700)]
[mlir][sparse] Fixes C++98 warning

The semicolons were introduced in D126105 in order to correct clang-format, but I forgot this file must be compiled as C++98 rather than C++11.

Reviewed By: aartbik

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

2 years ago[RISCV] Add a vsetvli PRE test involving non-1 LMUL
Philip Reames [Fri, 27 May 2022 19:51:54 +0000 (12:51 -0700)]
[RISCV] Add a vsetvli PRE test involving non-1 LMUL

2 years ago[RISCV] Use template version of SignExtend64 for constant extends. NFC
Craig Topper [Fri, 27 May 2022 20:10:47 +0000 (13:10 -0700)]
[RISCV] Use template version of SignExtend64 for constant extends. NFC

We were inconsistent about which one we used.

2 years ago[CMake] Make FindLibEdit.cmake more robust
Tobias Ribizel [Fri, 27 May 2022 20:06:45 +0000 (13:06 -0700)]
[CMake] Make FindLibEdit.cmake more robust

FindLibEdit uses pkg-config to find the necessary flags, but this may break with cross-compilation,
because the PkgConfig module in CMake doesn't respect the SYSROOT specified in a toolchain file.
Instead of taking the parameters from pkg-config for granted, we check whether our compiler can
actually include and link against the library.

Fixes #55445
Fixes #55671

Reviewed By: MaskRay

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

2 years ago[runtimes] Rename various libcpp-has-no-XYZ Lit features to just no-XYZ
Louis Dionne [Thu, 26 May 2022 15:49:47 +0000 (11:49 -0400)]
[runtimes] Rename various libcpp-has-no-XYZ Lit features to just no-XYZ

Since those features are general properties of the environment, it makes
sense to use them from libc++abi too, and so the name libcpp-has-no-xxx
doesn't make sense.

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

2 years ago[libc++][NFC] Rename rand.dis to rand.dist
Nikolas Klauser [Mon, 23 May 2022 16:47:52 +0000 (18:47 +0200)]
[libc++][NFC] Rename rand.dis to rand.dist

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgrang, mstorsjo

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

2 years ago[RISCV] Remove unused variables. NFC
Craig Topper [Fri, 27 May 2022 19:13:41 +0000 (12:13 -0700)]
[RISCV] Remove unused variables. NFC

2 years ago[lld][WebAssembly] Fix crash on undefined+weak function syms in LTO objects
Sam Clegg [Fri, 27 May 2022 15:34:31 +0000 (08:34 -0700)]
[lld][WebAssembly] Fix crash on undefined+weak function syms in LTO objects

Symbols from LTO objects don't contain Wasm signatures, but we need a
signature when we create undefined/stub functions for missing weakly
undefined symbols.

Luckily, after LTO, we know that symbols that are not referenced by a
regular object file must not be needed in the final output so there
is no need to generate undefined/stub function for them.

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

2 years ago[llvm-lib] Ignore /LTCG option
Pengxuan Zheng [Thu, 19 May 2022 18:30:57 +0000 (11:30 -0700)]
[llvm-lib] Ignore /LTCG option

"The /LTCG option to LIB specifies that the inputs from cl.exe include object
files generated by using the /GL compiler option."

Based on Microsoft's description
above (https://docs.microsoft.com/en-us/cpp/build/reference/running-lib?view=msvc-170),
there doesn't seem to be anything llvm-lib needs to do to support the flag.

Reviewed By: rnk

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

2 years ago[RISCV] Return false from isOffsetFoldingLegal instead of reversing the fold in lowering.
Craig Topper [Fri, 27 May 2022 17:16:32 +0000 (10:16 -0700)]
[RISCV] Return false from isOffsetFoldingLegal instead of reversing the fold in lowering.

When lowering GlobalAddressNodes, we were removing a non-zero offset and
creating a separate ADD.

It already comes out of SelectionDAGBuilder with a separate ADD. The
ADD was being removed by DAGCombiner.

This patch disables the DAG combine so we don't have to reverse it.
Test changes all look to be instruction order changes. Probably due
to different DAG node ordering.

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

2 years agoAMDGPU: Add G_AMDGPU_MAD_64_32 instructions
Nicolai Hähnle [Thu, 28 Apr 2022 22:52:44 +0000 (17:52 -0500)]
AMDGPU: Add G_AMDGPU_MAD_64_32 instructions

These generic instructions are trivially selected to
V_MAD_[IU]64_[IU]32 instructions when run on the VALU.

When at least both factors are scalar, it is usually better to execute
some or all of the instruction on the SALU. To this end, we lower the
instruction to simpler instructions that are supported on the SALU
when applying the register bank mapping.

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

2 years ago[TSan][Darwin] Deflake test
Julian Lettner [Fri, 27 May 2022 17:15:18 +0000 (10:15 -0700)]
[TSan][Darwin] Deflake test

The asserted order of THREAD_DESTROY and end of main() is not
guaranteed:
```
 7: Hello from pthread
 8: THREAD_TERMINATE 0x7e8000104000, self: 0x7e8000104000, name: child thread
 9: Done.
10: THREAD_DESTROY 0x7e8000104000, self: 0x7e8000104000, name: child thread
```

Resulting in:
```
error: CHECK: expected string not found in input
// CHECK: Done.
```

Remove checking for "Done." (end of main()) to deflake this test.
Alternatively, we could use `CHECK-DAG`.

rdar://94036145

2 years ago[runtimes] Officially deprecate the legacy testing configuration system
Louis Dionne [Thu, 26 May 2022 15:12:45 +0000 (11:12 -0400)]
[runtimes] Officially deprecate the legacy testing configuration system

Add a warning and tweak the release note to explain that the deprecation
targets libc++, libc++abi and libuwnind as well.

Also, as a fly-by, ensure that our CI runs the legacy testing configuration
for libc++, libc++abi and libunwind. This doesn't matter too much since
it's deprecated, but we might as well test it properly.

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

2 years ago[libc++] Add various missing _LIBCPP_HIDE_FROM_ABI
Louis Dionne [Thu, 26 May 2022 19:24:59 +0000 (15:24 -0400)]
[libc++] Add various missing _LIBCPP_HIDE_FROM_ABI

Those were spotted when a project unintentionally started exporting
these symbols from its ABI just by using the libc++ headers.

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