platform/upstream/llvm.git
2 years agofix tests after my commit 80b3dcc045f8ea6e5e532d8891bbf1305bce89e8
Nuno Lopes [Mon, 30 May 2022 18:44:06 +0000 (19:44 +0100)]
fix tests after my commit 80b3dcc045f8ea6e5e532d8891bbf1305bce89e8
 doesn't like exit code 126 I'm afraid

2 years ago[Support] Make report_fatal_error respect its GenCrashDiag argument so it doesn't...
Nuno Lopes [Mon, 30 May 2022 18:16:06 +0000 (19:16 +0100)]
[Support] Make report_fatal_error respect its GenCrashDiag argument so it doesn't generate a backtrace

There are a few places where we use report_fatal_error when the input is broken.
Currently, this function always crashes LLVM with an abort signal, which
then triggers the backtrace printing code.
I think this is excessive, as wrong input shouldn't give a link to
LLVM's github issue URL and tell users to file a bug report.
We shouldn't print a stack trace either.

This patch changes report_fatal_error so it uses exit() rather than
abort() when its argument GenCrashDiag=false.

Reviewed by: nikic, MaskRay, RKSimon

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

2 years agoRevert "[HLSL] Enable vector types for hlsl."
Nico Weber [Mon, 30 May 2022 18:10:21 +0000 (14:10 -0400)]
Revert "[HLSL] Enable vector types for hlsl."

This reverts commit e576280380d3f5221cfcc14e9fabeacc8506a43c.
Breaks tests on mac/arm, see comment on https://reviews.llvm.org/D125052

Also revert follow-up "[gn build] Port e576280380d3"
This reverts commit 1e01b1ec72031fcaceb4e77e1c5c8e34f1e862e8.

2 years ago[VPlan] Add test for printing VPlan for outer loop vectorization.
Florian Hahn [Mon, 30 May 2022 17:19:32 +0000 (18:19 +0100)]
[VPlan] Add test for printing VPlan for outer loop vectorization.

Test coverage for D123005.

2 years ago[ODRHash][NFC] Add missing 'select' case for `ODRMismatchDecl`.
Volodymyr Sapsai [Fri, 27 May 2022 21:05:12 +0000 (14:05 -0700)]
[ODRHash][NFC] Add missing 'select' case for `ODRMismatchDecl`.

No test changes because `err_module_odr_violation_mismatch_decl_unknown`
is a catch-all when custom diagnostic is missing. And missing custom
diagnostic we should fix by implementing it, not by improving the
general case. But if we pass enum value not covered by 'select', clang
can crash, so protect against that.

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

2 years agoFix warning for unused variable in the non-assert build (NFC)
Mehdi Amini [Mon, 30 May 2022 16:21:38 +0000 (16:21 +0000)]
Fix warning for unused variable in the non-assert build (NFC)

2 years ago[gn build] Port e576280380d3
LLVM GN Syncbot [Mon, 30 May 2022 16:11:40 +0000 (16:11 +0000)]
[gn build] Port e576280380d3

2 years ago[TwoAddressInstructionPass] Special processing of STATEPOINT instruction.
Denis Antrushin [Sun, 10 Apr 2022 08:31:31 +0000 (15:31 +0700)]
[TwoAddressInstructionPass] Special processing of STATEPOINT instruction.

STATEPOINT is a special pseudo instruction which represent Moving GC semantic to LLVM.
Every tied def/use VReg pair in STATEPOINT represent same physical register which can
'magically' change during call wrapped by statepoint.
(By construction, tied use operand  is not live across  STATEPOINT).

This means that when converting into two-address form, there is not need to insert COPY
instruction before stateppoint, what TwoAddressInstruction pass does for 'regular'
instructions.

Reviewed By: MatzeB

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

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[libc++] Reduce the verbosity when running the libc++ Lit configuration
Louis Dionne [Mon, 30 May 2022 15:06:19 +0000 (11:06 -0400)]
[libc++] Reduce the verbosity when running the libc++ Lit configuration

We print the same information as before, however we do it with less
verbosity unless `--debug` is used.

2 years ago[sanitizers] Fixes strndup API behaviour when intercepted by sanitizers
Pierre Gousseau [Mon, 30 May 2022 16:00:10 +0000 (17:00 +0100)]
[sanitizers] Fixes strndup API behaviour when intercepted by sanitizers

Sanitizers ignore flag allocator_may_return_null=1 in strndup() calls.
When OOM is emulated, this causes to the unexpected crash.

Committed by pgousseau on behalf of "Kostyantyn Melnik, kmnls.kmnls@gmail.com"

Reviewed by: pgousseau

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

2 years ago[mlir] provide Python bindings for the Transform dialect
Alex Zinenko [Mon, 30 May 2022 13:14:02 +0000 (15:14 +0200)]
[mlir] provide Python bindings for the Transform dialect

Python bindings for extensions of the Transform dialect are defined in separate
Python source files that can be imported on-demand, i.e., that are not imported
with the "main" transform dialect. This requires a minor addition to the
ODS-based bindings generator. This approach is consistent with the current
model for downstream projects that are expected to bundle MLIR Python bindings:
such projects can include their custom extensions into the bundle similarly to
how they include their dialects.

Reviewed By: nicolasvasilache

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

2 years ago[mlir] add VectorizeOp to structured transform ops
Alex Zinenko [Mon, 30 May 2022 13:13:23 +0000 (15:13 +0200)]
[mlir] add VectorizeOp to structured transform ops

Vectorization is a key transformation to achieve high performance on most
architectures. In the transform dialect, vectorization is implemented as a
parameterizable transform op. It currently applies to a scope of payload IR
delimited by some isolated-from-above op, mainly because several enabling
transformations (such as affine simplification) are needed to perform
vectorization and these transformation would apply to ops other than the "main"
computational payload op. A separate "navigation" transform op that obtains the
isolated-from-above ancestor of an op is introduced in the core transform
dialect. Even though it is currently only useful for vectorization,
isolated-from-above ops are a common anchor for transformations (usually
implemented as passes) that is likely to be reused in the future.

Depends On D126374

Reviewed By: nicolasvasilache

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

2 years agoChange build_llvm_package.bat to build_llvm_release.bat
Hans Wennborg [Mon, 30 May 2022 15:06:41 +0000 (17:06 +0200)]
Change build_llvm_package.bat to build_llvm_release.bat

We don't build snapshot packages anymore, so repurpose this
for doing release builds instead.

2 years ago[InstCombine] When swapping GEPs, only keep inbounds if both are
Nikita Popov [Mon, 30 May 2022 14:52:11 +0000 (16:52 +0200)]
[InstCombine] When swapping GEPs, only keep inbounds if both are

If only one of the GEPs is inbounds, then after swapping, there is
no guarantee that one of them will be inbounds as well
(see e.g. https://alive2.llvm.org/ce/z/agaCnp).

This is only a partial fix, because even if both are inbounds, the
result is not necessarily inbounds (if the offsets have different
signs).

2 years ago[OpenMP][Clang] Fix atomic compare for signed vs. unsigned
Joel E. Denny [Mon, 30 May 2022 15:01:10 +0000 (11:01 -0400)]
[OpenMP][Clang] Fix atomic compare for signed vs. unsigned

Without this patch, arguments to the
`llvm::OpenMPIRBuilder::AtomicOpValue` initializer are reversed.

Reviewed By: ABataev, tianshilei1992

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

2 years ago[flang][OpenMP] Check for occurrence of multiple list items in nontemporal clause...
Arnamoy Bhattacharyya [Mon, 30 May 2022 14:10:54 +0000 (10:10 -0400)]
[flang][OpenMP] Check for occurrence of multiple list items in nontemporal clause for simd directive

This patch implements the following semantic check:

A list-item cannot appear in more than one nontemporal clause.

Reviewed By: kiranchandramohan, shraiysh

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

2 years ago[InstCombine] Always create new GEPs when swapping GEPs
Nikita Popov [Mon, 30 May 2022 14:46:53 +0000 (16:46 +0200)]
[InstCombine] Always create new GEPs when swapping GEPs

As the long explanatory comment attests, performing the modification
in place is pretty tricky. Drop this unnecessary complexity and
always create new instructions.

This should be NFC-ish, but can probably cause difference due to
worklist order.

2 years ago[InstCombine] Add tests for inbounds handling in loop invariant GEP fold (NFC)
Nikita Popov [Mon, 30 May 2022 14:40:18 +0000 (16:40 +0200)]
[InstCombine] Add tests for inbounds handling in loop invariant GEP fold (NFC)

2 years ago[Local] Don't remove invoke of non-willreturn function
Nikita Popov [Mon, 30 May 2022 13:37:46 +0000 (15:37 +0200)]
[Local] Don't remove invoke of non-willreturn function

The code was only checking for memory side-effects, but not for
divergence side-effects. Replace this with a generic check.

2 years ago[SimplifyCFG] Add test for invoke of nounwind non-willreturn function (NFC)
Nikita Popov [Mon, 30 May 2022 13:33:23 +0000 (15:33 +0200)]
[SimplifyCFG] Add test for invoke of nounwind non-willreturn function (NFC)

Test both the case with and without willreturn attribute.

2 years agoRevert "[clang][test] mark tests added in ee8524087c78 as unsupported on AIX"
Jake Egan [Mon, 30 May 2022 13:33:10 +0000 (09:33 -0400)]
Revert "[clang][test] mark tests added in ee8524087c78 as unsupported on AIX"

The tests pass now on a clean build.

This reverts commit 1b34f1e996565bc5e4f2be14b89f881f8fe0f3b9.

2 years ago[InstCombine] Fold a mul with bool value into and
zhongyunde [Mon, 30 May 2022 13:04:40 +0000 (21:04 +0800)]
[InstCombine] Fold a mul with bool value into and

Fixes https://github.com/llvm/llvm-project/issues/55599
  X * Y --> X & Y, iff X, Y can be only {0, 1}.
https://alive2.llvm.org/ce/z/_RsTKF

Reviewed By: spatel, nikic

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

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