platform/upstream/llvm.git
2 years agoGenerate sse-intel-ocl.ll automatically. NFC
Amaury Séchet [Sat, 7 May 2022 22:44:40 +0000 (22:44 +0000)]
Generate sse-intel-ocl.ll automatically. NFC

2 years agoRegenerate avx512-regcall-NoMask.ll . NFC
Amaury Séchet [Sat, 7 May 2022 22:21:48 +0000 (22:21 +0000)]
Regenerate avx512-regcall-NoMask.ll . NFC

2 years ago[IROutliner] Accomodate blocks containing PHINodes with one entry outside the region...
Andrew Litteken [Sun, 1 May 2022 23:14:18 +0000 (18:14 -0500)]
[IROutliner] Accomodate blocks containing PHINodes with one entry outside the region and others inside the region.

When a PHINode has an incoming block from outside the region, it must be handled specially when assigning a global value number to each incoming value. A PHINode has multiple predecessors, and we must handle this case rather than only the single predecessor case.

Reviewer: paquette

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

2 years ago[RISCV] Regenerate rv32zbp-zbkb.ll
Simon Pilgrim [Sat, 7 May 2022 20:29:36 +0000 (21:29 +0100)]
[RISCV] Regenerate rv32zbp-zbkb.ll

Noticed in D124839

2 years ago[AArch64] Add missing NVCAST patterns.
David Green [Sat, 7 May 2022 20:08:14 +0000 (21:08 +0100)]
[AArch64] Add missing NVCAST patterns.

There were apparently some missing NVCAST patterns. This fills them in
using foreach, as opposed to having the specify them individually.

Fixes #55321

2 years ago[AMDGPU] lowerEXTRACT_VECTOR_ELT - fold from a SCALAR_TO_VECTOR source
Simon Pilgrim [Sat, 7 May 2022 19:23:24 +0000 (20:23 +0100)]
[AMDGPU] lowerEXTRACT_VECTOR_ELT - fold from a SCALAR_TO_VECTOR source

As suggested by @foad on D124839

If we're extracting a vector element that originally came from a scalar_to_vector, then avoid the bitcasting of a vector type and perform the shift masking on the (any-extended) scalar source directly, making use of the fact that the upper elements of a scalar_to_vector are all undef.

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

2 years ago[LegalizeTypes] Make use of SelectionDAG::getShiftAmountConstant. NFC
Craig Topper [Sat, 7 May 2022 19:16:49 +0000 (12:16 -0700)]
[LegalizeTypes] Make use of SelectionDAG::getShiftAmountConstant. NFC

Instead of calling getShiftAmountTy and getConstant separately.

2 years ago[LegalizeTypes] Don't assume fshl/fshr shift amount type matches the other operands.
Craig Topper [Fri, 6 May 2022 17:31:18 +0000 (10:31 -0700)]
[LegalizeTypes] Don't assume fshl/fshr shift amount type matches the other operands.

Like other shifts, the type isn't required to match. We shouldn't
assume we can call ZExtPromotedInteger.

I tested the PromoteIntOp_FunnelShift locally by removing the promotion
of the shift amount from PromoteIntRes_FunnelShift. But with the final
version of this patch it is never executed on any tests.

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

2 years ago[DAGCombine] Add node in the worklist in topological order in CombineTo
Amaury Séchet [Sat, 30 Apr 2022 20:36:40 +0000 (20:36 +0000)]
[DAGCombine] Add node in the worklist in topological order in CombineTo

This is part of an ongoing effort toward making DAGCombine process the nodes in topological order.

This is able to discover a couple of new optimizations, but also causes a couple of regression. I nevertheless chose to submit this patch for review as to start the discussion with people working on the backend so we can find a good way forward.

Reviewed By: RKSimon

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

2 years ago[ARM] Update ror.ll test to canonicalized IR
Simon Pilgrim [Sat, 7 May 2022 16:23:42 +0000 (17:23 +0100)]
[ARM] Update ror.ll test to canonicalized IR

As discussed on D124839, we're almost certainly only ever going to see this from IR directly - which now will create funnel shift intrinsics directly

I've also added a couple of rotl(rotr()) tests to check left/right rotation merging.

2 years ago[Headers][X86] amxintrin.h - fixed unknown parameter Wdocumentation warning. NFC
Simon Pilgrim [Sat, 7 May 2022 15:20:34 +0000 (16:20 +0100)]
[Headers][X86] amxintrin.h - fixed unknown parameter Wdocumentation warning. NFC

Noticed while triaging Issue #35297

2 years ago[Bitstream] Only consider flushing to file on block boundaries
Sam McCall [Fri, 6 May 2022 22:47:40 +0000 (00:47 +0200)]
[Bitstream] Only consider flushing to file on block boundaries

The goal of flushing to disk is to keep a reasonable bound on peak memory usage.
With a a default threshold of 512MB (and most BitstreamWriters having no backing
file at all), checking after every byte whether to flush seems excessive.

This change makes clangd's unittests run 5% faster (in opt), so it's not
actually free even in the case with no backing file. Likely there are more
important workloads where it makes some difference.

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

2 years agoconst char* for LLVMTargetMachineEmitToFile's argument
Amaury Séchet [Sat, 7 May 2022 14:26:21 +0000 (14:26 +0000)]
const char* for LLVMTargetMachineEmitToFile's argument

The `LLVMTargetMachineEmitToFile` takes a `char* Filename` right now, but it doesn't modify it.
This is annoying to use in the case where you want to pass a const string, because you either have to remove the const, or copy it somewhere else and pass that. Either way, it's not very nice.

I added a const and clang formatted it. This shouldn't break any ABI in my opinion.
I'm sorry but I didn't know whom to put as reviewer for this, so I chose someone with a lot of commits from the .cpp file.

Reviewed By: deadalnix

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

2 years ago[X86] Add 32-bit target test coverage to clean header tests
Simon Pilgrim [Sat, 7 May 2022 14:23:29 +0000 (15:23 +0100)]
[X86] Add 32-bit target test coverage to clean header tests

2 years ago[SLP] Cluster ordering for loads
David Green [Sat, 7 May 2022 13:38:11 +0000 (14:38 +0100)]
[SLP] Cluster ordering for loads

Given a load without a better order, this patch partially sorts the
elements to form clusters of adjacent elements in memory. These clusters
can potentially be loaded in fewer loads, meaning less overall shuffling
(for example loading v4i8 clusters of a v16i8 as a single f32 loads, as
opposed to multiple independent bytes loads and inserts).

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

2 years ago[X86] rdrand-builtins.c - add 32-bit target coverage and enable -Wall/-Werror
Simon Pilgrim [Sat, 7 May 2022 13:35:36 +0000 (14:35 +0100)]
[X86] rdrand-builtins.c - add 32-bit target coverage and enable -Wall/-Werror

2 years agoAutomatically generate aix32-cc-abi-vaarg.ll . NFC
Amaury Séchet [Sat, 7 May 2022 13:04:40 +0000 (13:04 +0000)]
Automatically generate aix32-cc-abi-vaarg.ll . NFC

2 years ago[InstCombine] fix miscompile when casting int->FP->int
Sanjay Patel [Sat, 7 May 2022 12:22:08 +0000 (08:22 -0400)]
[InstCombine] fix miscompile when casting int->FP->int

As shown in https://github.com/llvm/llvm-project/issues/55150 -
the existing fold may be wrong when converting to a signed value.
This is a quick fix to avoid the miscompile.

I added tests/comments for all of the signed/unsigned combinations
at either side of the boundary width, and tried to confirm with Alive2:
https://alive2.llvm.org/ce/z/3p9DSu

There are already some TODO items in the test file that suggest
possible refinements, so the regression with ui->FP->si is probably ok.
It seems unlikely that we'd see these kind of edge cases with
non-byte-width integer types in real code. The potential miscompile
went undetected for several years.

This and 747c6a0c734e fixes #55150.

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

2 years ago[X86] Remove unused 'hint' argument from prefetch tests
Simon Pilgrim [Sat, 7 May 2022 12:38:40 +0000 (13:38 +0100)]
[X86] Remove unused 'hint' argument from prefetch tests

hint is a compile time constant and can't be passed in as a variable - we already hardcode

2 years ago[InstCombine] Remove side effect of replaced constrained intrinsics
Serge Pavlov [Thu, 5 May 2022 05:02:42 +0000 (12:02 +0700)]
[InstCombine] Remove side effect of replaced constrained intrinsics

If a constrained intrinsic call was replaced by some value, it was not
removed in some cases. The dangling instruction resulted in useless
instructions executed in runtime. It happened because constrained
intrinsics usually have side effect, it is used to model the interaction
with floating-point environment. In some cases side effect is actually
absent or can be ignored.

This change adds specific treatment of constrained intrinsics so that
their side effect can be removed if it actually absents.

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

2 years agoReland "[FuzzMutate] Split out FuzzerCLI library that doesn't depend on IR."
Sam McCall [Sat, 7 May 2022 11:44:42 +0000 (13:44 +0200)]
Reland "[FuzzMutate] Split out FuzzerCLI library that doesn't depend on IR."

This reverts commit a1bb952e833b34fdf03bd571e7f8c948191be018.

I'd somehow missed updating llvm-yaml-parser-fuzzer, now fixed.

2 years agoRevert "[FuzzMutate] Split out FuzzerCLI library that doesn't depend on IR."
Aaron Ballman [Sat, 7 May 2022 11:29:57 +0000 (07:29 -0400)]
Revert "[FuzzMutate] Split out FuzzerCLI library that doesn't depend on IR."

This reverts commit 1c5e85b3da649c89db87abecc53b42f6eaa574c2.

It broke a lot of bots with a link error:
https://lab.llvm.org/buildbot/#/builders/171/builds/14222
https://lab.llvm.org/buildbot/#/builders/188/builds/13748
https://lab.llvm.org/buildbot/#/builders/109/builds/38127

2 years agoFix underlining in docs to fix the sphinx build
Aaron Ballman [Sat, 7 May 2022 11:21:43 +0000 (07:21 -0400)]
Fix underlining in docs to fix the sphinx build

2 years ago[ISD::IndexType] Helper functions for common queries.
Paul Walker [Tue, 5 Apr 2022 16:48:22 +0000 (17:48 +0100)]
[ISD::IndexType] Helper functions for common queries.

Add helper functions to query the signed and scaled properties
of ISD::IndexType along with functions to change them.

Remove setIndexType from MaskedGatherSDNode because it only has
one usage and typically should only be changed alongside its
index operand.

Minimise the direct use of the enum values to lay the groundwork
for more refactoring.

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

2 years ago[FuzzMutate] Split out FuzzerCLI library that doesn't depend on IR.
Sam McCall [Fri, 6 May 2022 08:36:34 +0000 (10:36 +0200)]
[FuzzMutate] Split out FuzzerCLI library that doesn't depend on IR.

All llvm-project fuzzers use this library to parse command-line arguments.
Many of them don't deal with LLVM IR or modules in any way. Bundling those
functions in one library forces build dependencies that don't need to be there.

Among other things, this means check-clang-pseudo no longer depends on most of
LLVM.

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

2 years ago[FuzzMutate] Move LLVM module (de)serialization from FuzzerCLI -> IRMutator. NFC
Sam McCall [Fri, 6 May 2022 08:15:41 +0000 (10:15 +0200)]
[FuzzMutate] Move LLVM module (de)serialization from FuzzerCLI -> IRMutator. NFC

These are not directly related to the CLI, and are mostly (always?) used when
mutating the modules as part of fuzzing.

Motivation: split FuzzerCLI into its own library that does not depend on IR.
Subprojects that don't use IR should be be fuzzed without the dependency.

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

2 years ago[X86] Add description comments to SandyBridge for COPY/WriteZero/WriteVecMaskedGather...
Simon Pilgrim [Sat, 7 May 2022 09:42:12 +0000 (10:42 +0100)]
[X86] Add description comments to SandyBridge for COPY/WriteZero/WriteVecMaskedGatherWriteback cases. NFC.

Match other models.

Use X86WriteRes for WriteVecMaskedGatherWriteback like other models as well.

2 years ago[SLP] Add tests for awkward laod orders from SLP. NFC
David Green [Sat, 7 May 2022 09:27:32 +0000 (10:27 +0100)]
[SLP] Add tests for awkward laod orders from SLP. NFC

2 years ago[InstCombine] sub(add(X,Y),umin(Y,Z)) --> add(X,usub.sat(Y,Z))
Chenbing Zheng [Sat, 7 May 2022 09:17:48 +0000 (17:17 +0800)]
[InstCombine] sub(add(X,Y),umin(Y,Z)) --> add(X,usub.sat(Y,Z))

Alive2: https://alive2.llvm.org/ce/z/2UNVbp

Reviewed By: RKSimon, spatel

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

2 years agoFix MLIR integration test after a8308020 (`func.` prefix is required bythe parser...
Mehdi Amini [Sat, 7 May 2022 09:09:03 +0000 (09:09 +0000)]
Fix MLIR integration test after a8308020 (`func.` prefix is required bythe parser now)

2 years ago[InstCombine] precommit some tests for reassociate add
Chenbing Zheng [Sat, 7 May 2022 07:52:28 +0000 (15:52 +0800)]
[InstCombine] precommit some tests for reassociate add

2 years ago[InstCombine] add casts from splat-a-bit pattern if necessary
Chenbing Zheng [Sat, 7 May 2022 07:34:57 +0000 (15:34 +0800)]
[InstCombine] add casts from splat-a-bit pattern if necessary

Splatting a bit of constant-index across a value:
sext (ashr (trunc iN X to iM), M-1) to iN --> ashr (shl X, N-M), N-1
If the dest type is different, use a cast (adjust use check).

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

Reviewed By: spatel

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

2 years agoRevert "[CMake][libcxx] Use target_include_directories for libc++ headers"
Petr Hosek [Sat, 7 May 2022 05:19:54 +0000 (22:19 -0700)]
Revert "[CMake][libcxx] Use target_include_directories for libc++ headers"

This reverts commit 203455c85ad03325ce2d77f067f6ac953f2a32ce since
it breaks the OpenMP builders for AMDGPU.

2 years ago[libcxx] Remove static inline and make use of _LIBCPP_HIDE_FROM_ABI in __support...
Brad Smith [Sat, 7 May 2022 05:06:32 +0000 (01:06 -0400)]
[libcxx] Remove static inline and make use of _LIBCPP_HIDE_FROM_ABI in __support headers

After feedback from D122861, do the same thing with some of the other headers. Try to move the
headers so they have a similar style and way of doing things.

Reviewed By: ldionne, daltenty

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

2 years ago[libcxx] random_device, use arc4random() on Solaris
Brad Smith [Sat, 7 May 2022 04:57:41 +0000 (00:57 -0400)]
[libcxx] random_device, use arc4random() on Solaris

Reviewed By: ldionne

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

2 years ago[test][ORC-RT] Disable elfnix_platform tests on non-x86_64 platforms
Peter S. Housel [Sat, 7 May 2022 02:59:56 +0000 (19:59 -0700)]
[test][ORC-RT] Disable elfnix_platform tests on non-x86_64 platforms

ORC ELFNixPlatform currently only supports x86_64.

2 years agoRevert "[runtime] Build compiler-rt with --unwindlib=none"
Petr Hosek [Sat, 7 May 2022 02:52:38 +0000 (19:52 -0700)]
Revert "[runtime] Build compiler-rt with --unwindlib=none"

This reverts commit 102bc634cb4129d9984a8da8515af945e8a5568b because
some tests are failing on sanitizer bots.

2 years agoUpstream support for POINTER assignment in FORALL.
Eric Schweitz [Fri, 22 Apr 2022 20:59:17 +0000 (13:59 -0700)]
Upstream support for POINTER assignment in FORALL.

Reviewed By: vdonaldson, PeteSteinfeld

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

2 years ago[runtime] Build compiler-rt with --unwindlib=none
Petr Hosek [Wed, 27 Apr 2022 06:23:53 +0000 (23:23 -0700)]
[runtime] Build compiler-rt with --unwindlib=none

This applies the change made to libunwind+libcxxabi+libcxx in D113253
to compiler-rt as well.

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

2 years agoRevert "[runtime] Build compiler-rt with --unwindlib=none"
Petr Hosek [Sat, 7 May 2022 00:52:10 +0000 (17:52 -0700)]
Revert "[runtime] Build compiler-rt with --unwindlib=none"

This reverts commit fecad835fb4c6e65eb487fc626355686959605f6.

2 years ago[runtime] Build compiler-rt with --unwindlib=none
Petr Hosek [Wed, 27 Apr 2022 06:23:53 +0000 (23:23 -0700)]
[runtime] Build compiler-rt with --unwindlib=none

This applies the change made to libunwind+libcxxabi+libcxx in D113253
to compiler-rt as well.

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

2 years ago[CMake] Include llvm-debuginfod-find in Fuchsia toolchain
Petr Hosek [Fri, 6 May 2022 08:35:52 +0000 (01:35 -0700)]
[CMake] Include llvm-debuginfod-find in Fuchsia toolchain

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

2 years ago[Scalar][NFC] Minor cleanups in CallSiteSplitting.cpp
Alexander Shaposhnikov [Fri, 6 May 2022 23:03:49 +0000 (23:03 +0000)]
[Scalar][NFC] Minor cleanups in CallSiteSplitting.cpp

2 years ago[HWASan] Clean up hwasan_symbolize.
Florian Mayer [Fri, 6 May 2022 22:44:51 +0000 (15:44 -0700)]
[HWASan] Clean up hwasan_symbolize.

The globals are better expressed as members of the Symbolizer, and all
functions operating on it should be methods instead.

Also using the standard idiom of wrapping the main code in
`if __name__ == '__main__'`.

Reviewed By: eugenis

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

2 years ago[HWASan] Allow to linkify symbolizer output.
Florian Mayer [Fri, 6 May 2022 21:14:19 +0000 (14:14 -0700)]
[HWASan] Allow to linkify symbolizer output.

Reviewed By: eugenis

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

2 years ago[clang-format][NFC] Make all TokenAnnotator member functions const
owenca [Fri, 6 May 2022 01:30:39 +0000 (18:30 -0700)]
[clang-format][NFC] Make all TokenAnnotator member functions const

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

2 years agoRevert "[SimpleLoopUnswitch] Collect either logical ANDs/ORs but not both."
Florian Hahn [Fri, 6 May 2022 21:38:15 +0000 (22:38 +0100)]
Revert "[SimpleLoopUnswitch] Collect either logical ANDs/ORs but not both."

This reverts commit db7a87ed4fa79a7c366438ae62d8a1088a11f29c.

This seems to cause a PPC buildbot failure:
https://lab.llvm.org/buildbot#builders/93/builds/8787

2 years ago[compiler-rt] Fix issue with compiler-rt tests mixing <atomic> and <stdatomic.h>
Louis Dionne [Fri, 6 May 2022 18:46:08 +0000 (14:46 -0400)]
[compiler-rt] Fix issue with compiler-rt tests mixing <atomic> and <stdatomic.h>

Since D97044, libc++ implements <stdatomic.h>, which is not compatible
with the <atomic> header in C++03 mode. To fix the tests, avoid using
<stdatomic.h> at all, since it is not strictly required.

rdar://92867529

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

2 years ago[libc++][ranges] Implement `views::single`.
Konstantin Varlamov [Fri, 6 May 2022 21:17:11 +0000 (14:17 -0700)]
[libc++][ranges] Implement `views::single`.

This only adds the customization point object (which isn't pipeable),
the view itself has already been implemented previously.

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

2 years ago[AArch64] Add llvm/test/CodeGen/AArch64/i256-math.ll
Kazu Hirata [Fri, 6 May 2022 21:26:12 +0000 (14:26 -0700)]
[AArch64] Add llvm/test/CodeGen/AArch64/i256-math.ll

This patch adds a test case for i256 additions and subtractions.  I'm
leaving out multiplications for now, which would result in very long
sequences.

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

2 years ago[gn build] Port 9924d8d66ae1
LLVM GN Syncbot [Fri, 6 May 2022 21:16:49 +0000 (21:16 +0000)]
[gn build] Port 9924d8d66ae1

2 years ago[libc++][ranges] Implement `views::take`.
Konstantin Varlamov [Fri, 6 May 2022 20:33:33 +0000 (13:33 -0700)]
[libc++][ranges] Implement `views::take`.

The view itself has been implemented previously -- this patch only adds
the ability to pipe it.

Also implements [P1739](https://wg21.link/p1739) (partially) and [LWG3407](https://wg21.link/lwg3407).

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

2 years agoFix check-clang-tools target after 7cc8377f2c572a919ecb
Sam McCall [Fri, 6 May 2022 21:06:19 +0000 (23:06 +0200)]
Fix check-clang-tools target after 7cc8377f2c572a919ecb

This change was intended to add the tests check-clang and check-clang-pseudo,
but afterwards it was *only* running those tests.
(This was because unlike add_lit_testsuite, add_lit_testsuite*s* does not
get included in umbrella suites).

2 years ago[CMake][libcxx] Use target_include_directories for libc++ headers
Petr Hosek [Mon, 28 Mar 2022 21:12:23 +0000 (14:12 -0700)]
[CMake][libcxx] Use target_include_directories for libc++ headers

This is the idiomatic way to handle include directories in CMake.

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

2 years ago[ORC-RT][ORC] Handle dynamic unwind registration for libunwind
Peter S. Housel [Thu, 2 Dec 2021 07:11:49 +0000 (23:11 -0800)]
[ORC-RT][ORC] Handle dynamic unwind registration for libunwind

This changes the ELFNix platform Orc runtime to use, when available,
the __unw_add_dynamic_eh_frame_section interface provided by libunwind
for registering .eh_frame sections loaded by JITLink. When libunwind
is not being used for unwinding, the ELFNix platform detects this and
defaults to the __register_frame interface provided by libgcc_s.

Reviewed By: lhames

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

2 years ago[OpenMP] Try to Infer target triples using the offloading architecture
Joseph Huber [Thu, 5 May 2022 22:09:55 +0000 (18:09 -0400)]
[OpenMP] Try to Infer target triples using the offloading architecture

Currently we require the `-fopenmp-targets=` option to specify the
triple to use for the offloading toolchains, and the `-Xopenmp-target=`
option to specify architectures to a specific toolchain. The changes
made in D124721 allowed us to use `--offload-arch=` to specify multiple
target architectures. However, this can become combersome with many
different architectures. This patch introduces functinality that
attempts to deduce the target triple and architectures from the
offloading action. Currently we will deduce known GPU architectures when
only `-fopenmp` is specified.

This required a bit of a hack to cache the deduced architectures,
without this we would've just thrown an error when we tried to look up
the architecture again when generating the job. Normally we require the
user to manually specify the toolchain arguments, but here they would
confict unless we overrode them.

Depends on: D124721

Reviewed By: saiislam

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

2 years ago[OpenMP] Allow compiling multiple target architectures with OpenMP
Joseph Huber [Sat, 30 Apr 2022 22:46:58 +0000 (18:46 -0400)]
[OpenMP] Allow compiling multiple target architectures with OpenMP

This patch adds support for OpenMP to use the `--offload-arch` and
`--no-offload-arch` options. Traditionally, OpenMP has only supported
compiling for a single architecture via the `-Xopenmp-target` option.
Now we can pass in a bound architecture and use that if given, otherwise
we default to the value of the `-march` option as before.

Note that this only applies the basic support, the OpenMP target runtime
does not yet know how to choose between multiple architectures.
Additionally other parts of the offloading toolchain (e.g. LTO) require
the `-march` option, these should be worked out later.

Reviewed By: tra

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

2 years ago[mlir] Remove special case parsing/printing of `func` operations
River Riddle [Thu, 21 Apr 2022 04:39:22 +0000 (21:39 -0700)]
[mlir] Remove special case parsing/printing of `func` operations

This was leftover from when the standard dialect was destroyed, and
when FuncOp moved to the func dialect. Now that these transitions
have settled a bit we can drop these.

Most updates were handled using a simple regex: replace `^( *)func` with `$1func.func`

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

2 years ago[InstCombine] canonicalize fneg after shuffle
Sanjay Patel [Fri, 6 May 2022 19:48:41 +0000 (15:48 -0400)]
[InstCombine] canonicalize fneg after shuffle

For the unary shuffle pattern, this is opposite to what we try
to do with binops, but it seems better to keep it consistent
with the motivating binary shuffle pattern. On that, it is
clearly better on the usual no-extra uses case.

There is a chance that this will pull an fneg away from some
other binop and cause a regression in codegen, but that should
be invertible in the backend. The transform is birectional:
https://alive2.llvm.org/ce/z/kKaKCU
https://alive2.llvm.org/ce/z/3Desfw

Fixes #45631

2 years ago[InstCombine] add tests for shuffle with fneg operand(s); NFC
Sanjay Patel [Fri, 6 May 2022 19:23:48 +0000 (15:23 -0400)]
[InstCombine] add tests for shuffle with fneg operand(s); NFC

issue #45631

2 years agoRevert "Automatically generates several X86/sse tests cases. NFC"
Nico Weber [Fri, 6 May 2022 20:24:51 +0000 (16:24 -0400)]
Revert "Automatically generates several X86/sse tests cases. NFC"

This reverts commit 324d696c154aad42b2580d2f225a677c04fe0ab4.
Broke check-llvm on Windows, see e.g.
https://lab.llvm.org/buildbot/#/builders/216/builds/4005 and
comment on https://reviews.llvm.org/rG324d696c154aad42b2580d2f225a677c04fe0ab4

2 years ago[Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia
Petr Hosek [Tue, 16 Nov 2021 20:54:11 +0000 (12:54 -0800)]
[Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia

When targeting cortex-a53, set this linker flag rather than relying
on the toolchain users to do it in their build.

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

2 years agoFix build with shared libs: add missing CMake dep to MLIR sparse pipeline
Mehdi Amini [Fri, 6 May 2022 20:20:03 +0000 (20:20 +0000)]
Fix build with shared libs: add missing CMake dep to MLIR sparse pipeline

2 years agoApply clang-tidy fixes for bugprone-copy-constructor-init in TestPassManager.cpp...
Mehdi Amini [Fri, 6 May 2022 00:00:14 +0000 (00:00 +0000)]
Apply clang-tidy fixes for bugprone-copy-constructor-init in TestPassManager.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming in SparseTensorUtils.cpp...
Mehdi Amini [Thu, 5 May 2022 23:22:38 +0000 (23:22 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in SparseTensorUtils.cpp (NFC)

2 years agoApply clang-tidy fixes for llvm-include-order in Merger.cpp (NFC)
Mehdi Amini [Thu, 5 May 2022 23:10:19 +0000 (23:10 +0000)]
Apply clang-tidy fixes for llvm-include-order in Merger.cpp (NFC)

2 years ago[riscv] Use early return to reduce nesting for InsertVSETVLI [nfc]
Philip Reames [Fri, 6 May 2022 20:10:05 +0000 (13:10 -0700)]
[riscv] Use early return to reduce nesting for InsertVSETVLI [nfc]

2 years ago[riscv] Add early return to InsertVSETLI fixed point step [nfc]
Philip Reames [Fri, 6 May 2022 19:53:34 +0000 (12:53 -0700)]
[riscv] Add early return to InsertVSETLI fixed point step [nfc]

If the income state hasn't changed, and the step function is fixed by assumption, then the output state can't have changed.

In the current algorithm, this is a very minor win and mostly allows adding tracing output without being horrible verbose.

2 years ago[riscv] Add some minimal tracing output to InsertVSETVLI
Philip Reames [Fri, 6 May 2022 19:50:24 +0000 (12:50 -0700)]
[riscv] Add some minimal tracing output to InsertVSETVLI

Only available with -debug.  Main purpose is simplifying an upcoming change, and providing tools for debugging problems.

2 years agoRevert "[DAGCombine] Make combineShuffleOfBitcast LittleEndian specific"
David Green [Fri, 6 May 2022 20:03:22 +0000 (21:03 +0100)]
Revert "[DAGCombine] Make combineShuffleOfBitcast LittleEndian specific"

This reverts commit 891c3cf99e100e8871aff9a0747c887a5d0a8b0f as it turns
out that the error was not caused by this commit, the error caming
from D124526 instead.

2 years ago[gn build] (semi-manually) port 7e63a0d479dd
Nico Weber [Fri, 6 May 2022 19:54:29 +0000 (15:54 -0400)]
[gn build] (semi-manually) port 7e63a0d479dd

2 years agoUpdate ReleaseNotes.rst
Shivam [Fri, 6 May 2022 19:50:45 +0000 (01:20 +0530)]
Update ReleaseNotes.rst

2 years agoupdate the doc for the static analyzer checker
Shivam [Fri, 6 May 2022 19:49:46 +0000 (01:19 +0530)]
update the doc for the static analyzer checker

2 years agoAdded the brief discription about the new CSA checker.
Shivam [Fri, 6 May 2022 19:46:22 +0000 (01:16 +0530)]
Added the brief discription about the new CSA checker.

2 years ago[runtimes] Always configure libc++abi before libc++
Louis Dionne [Tue, 1 Mar 2022 14:17:57 +0000 (09:17 -0500)]
[runtimes] Always configure libc++abi before libc++

That makes it possible to reuse libc++abi targets from the libc++
configuration, which is necessary to allow major CMake simplifications.
As a fly-by fix, we also unify how compiler-rt ordering is handled so
it matches how libc++ and libc++abi are handled (compiler-rt always
ends up first).

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

2 years agoEnable the use of ThreadPoolTaskGroup in MLIR threading helper to enable nested paral...
Mehdi Amini [Fri, 6 May 2022 19:38:49 +0000 (19:38 +0000)]
Enable the use of ThreadPoolTaskGroup in MLIR threading helper to enable nested parallelism

The LLVM ThreadPool recently got the addition of the concept of
ThreadPoolTaskGroup: this is a way to "partition" the threadpool
into a group of tasks and enable nested parallelism through this
grouping at every level of nesting.
We make use of this feature in MLIR threading abstraction to fix a long
lasting TODO and enable nested parallelism.

Reviewed By: rriddle

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

2 years agoApply clang-tidy fixes for llvm-else-after-return in Merger.cpp (NFC)
Mehdi Amini [Thu, 5 May 2022 23:09:44 +0000 (23:09 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in Merger.cpp (NFC)

2 years agoApply clang-tidy fixes for llvm-prefer-isa-or-dyn-cast-in-conditionals in OpenMPDiale...
Mehdi Amini [Thu, 5 May 2022 23:02:38 +0000 (23:02 +0000)]
Apply clang-tidy fixes for llvm-prefer-isa-or-dyn-cast-in-conditionals in OpenMPDialect.cpp (NFC)

2 years ago[clang-tidy][NFC] Fix doc typo for bugprone-unchecked-optional-access
Yitzhak Mandelbaum [Fri, 6 May 2022 19:23:15 +0000 (19:23 +0000)]
[clang-tidy][NFC] Fix doc typo for bugprone-unchecked-optional-access

2 years ago[libc][NFC] add index mode to printf parser
Michael Jones [Thu, 7 Apr 2022 21:22:48 +0000 (14:22 -0700)]
[libc][NFC] add index mode to printf parser

This patch is a followup to the previous patch which implemented the
main printf parsing logic as well as sequential mode. This patch adds
index mode.

Reviewed By: sivachandra

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

2 years ago[clang-tidy] New check for safe usage of `std::optional` and like types.
Yitzhak Mandelbaum [Sun, 6 Mar 2022 19:01:46 +0000 (19:01 +0000)]
[clang-tidy] New check for safe usage of `std::optional` and like types.

This check verifies the safety of access to `std::optional` and related
types (including `absl::optional`). It is based on a corresponding Clang
Dataflow Analysis, which does most of the work. This check merely runs it and
converts its findings into diagnostics.

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

2 years ago[HLSL] add -fcgl option flag.
python3kgae [Thu, 5 May 2022 06:15:40 +0000 (23:15 -0700)]
[HLSL] add -fcgl option flag.

fcgl option will make compilation stop after clang codeGen and output the llvm ir.
It is added to check clang codeGen output for HLSL.

It will be translated into -S -emit-llvm and -disable-llvm-passes.

Reviewed By: aaron.ballman

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

2 years ago[libc] Update windows entrypoint list
Michael Jones [Thu, 5 May 2022 23:40:28 +0000 (16:40 -0700)]
[libc] Update windows entrypoint list

The entrypoint list for windows hasn't been updated in a while, this
adds all of the entrypoints that are working for windows now.

Reviewed By: sivachandra, lntue

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

2 years ago[clangd] Speed up a slow sleeping testcase.
Sam McCall [Fri, 6 May 2022 16:24:48 +0000 (18:24 +0200)]
[clangd] Speed up a slow sleeping testcase.

This testcase runs slowly due to 3.2s of sleeps = 2 + 1 + 0.2s.
After this patch it has 0.55s only.

Reduced by:
 - observed that the last test was bogus: we were sleeping until the queue was
   idle, effectively just a second copy of the first test. This avoids 1s sleep.
 - when waiting for debounce, sleep only until test passes, not for enough
   time to be safe (in practice was 2x debounce time, now 1x debounce time)
 - scaling delays down by a factor of 2 (note: factor of 10 caused bot failures)

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

2 years ago[AArch64] Fix sub with carry
Kazu Hirata [Fri, 6 May 2022 18:04:17 +0000 (11:04 -0700)]
[AArch64] Fix sub with carry

13403a70e45b2d22878ba59fc211f8dba3a8deba introduced a bug where we
generate the outgoing carry inverted, which in turn breaks the
lowering of @llvm.usub.sat.i128, returning the normal difference on
saturation and zero otherwise.

Note that AArch64 has peculiar semantics where the subtraction
instructions generate borrow inverted.  The problem is that we mix the
two forms of semantics -- the normal carry and inverted carry -- in
the area of extended precision subtractions.  Specifically, we have
three problems:

- lowerADDSUBCARRY takes the non-inverted incoming carry from a
  subtraction and feeds it to SBCS without inverting it first.

- lowerADDSUBCARRY makes available the outgoing carry from SBCS
  without inverting it.

- foldOverflowCheck folds:

  (SBC{S} l r (CMP (CSET LO carry) 1)) => (SBC{S} l r carry)

  When the incoming carry flag is set, CSET LO results in zero.  CMP
  in turn generates a borrow, *clearing* the carry flag.  Instead, we
  should fold:

  (SBC{S} l r (CMP 0 (CSET LO carry))) => (SBC{S} l r carry)

  When the incoming carry flag is set, CSET LO results in zero.  CMP
  does not generate a borrow, *setting* the carry flag.

IIUC, we should use the normal (that is, non-inverted) semantics for
carry everywhere.

This patch fixes the three problems above.

This patch does not add any new testcases because we have a plenty of
them covering the instruction in question.  In particular,
@u128_saturating_sub is identical to the testcase in the motivating
issue.

Fixes: #55253

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

2 years ago[DAGCombine] Make combineShuffleOfBitcast LittleEndian specific
David Green [Fri, 6 May 2022 17:42:44 +0000 (18:42 +0100)]
[DAGCombine] Make combineShuffleOfBitcast LittleEndian specific

Something is going wrong with the BigEndian PowerPC bot. It is hard to
tell what is wrong from here, but attempt to fix it by disabling the
combineShuffleOfBitcast combine for bigendian.

2 years ago[mlir][sparse] integration test for zero preserving math op
Aart Bik [Fri, 6 May 2022 16:47:59 +0000 (09:47 -0700)]
[mlir][sparse] integration test for zero preserving math op

Also fixes omission in lowering math ops that require lib support

Reviewed By: bixia

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

2 years ago[riscv] Add strict asserts for VSETVLI insertion algorithm to help catch bugs
Philip Reames [Thu, 5 May 2022 19:50:47 +0000 (12:50 -0700)]
[riscv] Add strict asserts for VSETVLI insertion algorithm to help catch bugs

This assertion should hold for any reasonable data flow algorithm, but is known not to in several cases today. I'd like to go ahead and land this off-by-default, so that we can collaborate on fixes and have a common definition of success.

Differential: https://reviews.llvm.org/D125035

2 years ago[AArch64] Add extra reverse costs.
David Green [Fri, 6 May 2022 17:23:36 +0000 (18:23 +0100)]
[AArch64] Add extra reverse costs.

This adds some extra costs for reverse shuffles under AArch64, filling
in the i16/f16/i8 gaps in the cost model.

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

2 years ago[InstCombine] Add tests for combining AArch64 neon min/max intrinsics.
Florian Hahn [Fri, 6 May 2022 16:59:22 +0000 (17:59 +0100)]
[InstCombine] Add tests for combining AArch64 neon min/max intrinsics.

2 years ago[libc++][NFC] Fix formatting that was incorrectly changed by D124695
Louis Dionne [Fri, 6 May 2022 16:41:07 +0000 (12:41 -0400)]
[libc++][NFC] Fix formatting that was incorrectly changed by D124695

2 years ago[SimplifyLibcalls] Tests for libcall folding of subobjects [NFC]
Martin Sebor [Fri, 6 May 2022 16:34:13 +0000 (10:34 -0600)]
[SimplifyLibcalls] Tests for libcall folding of subobjects [NFC]

Add tests exercising the future enancement of folding library function
calls with arguments involving subobjects such as elements of arrays
or struct members.

2 years ago[SelectionDAG] Improve asserts in SelectionDAG::getSelect.
Craig Topper [Fri, 6 May 2022 16:39:39 +0000 (09:39 -0700)]
[SelectionDAG] Improve asserts in SelectionDAG::getSelect.

The VT passed in must match the type of LHS and RHS.
Previously we only checked that the vectorness matched.

2 years ago[clang-tidy][NFC] Add createChecks method that also checks for LangaugeOptions
Nathan James [Fri, 6 May 2022 16:30:30 +0000 (17:30 +0100)]
[clang-tidy][NFC] Add createChecks method that also checks for LangaugeOptions

This method won't add a check if it isn't supported in the Contexts current LanguageOptions.

Reviewed By: aaron.ballman

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

2 years ago[SelectionDAG] Clear promoted bits before UREM on shift amount in PromoteIntRes_Funne...
Craig Topper [Fri, 6 May 2022 07:04:43 +0000 (00:04 -0700)]
[SelectionDAG] Clear promoted bits before UREM on shift amount in PromoteIntRes_FunnelShift.

Otherwise we have garbage in the upper bits that can affect the
results of the UREM.

Fixes PR55296.

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

2 years agoAutomatically generates several X86/sse tests cases. NFC
Amaury Séchet [Fri, 6 May 2022 15:54:31 +0000 (15:54 +0000)]
Automatically generates several X86/sse tests cases. NFC

2 years agoAutomatically generate CodeGen/X86/sse-align-*.ll test cases. NFC
Amaury Séchet [Fri, 6 May 2022 15:44:50 +0000 (15:44 +0000)]
Automatically generate CodeGen/X86/sse-align-*.ll test cases. NFC

2 years ago[flang] Fix internal error with DATA-statement style initializers
Daniil Dudkin [Fri, 6 May 2022 15:18:33 +0000 (18:18 +0300)]
[flang] Fix internal error with DATA-statement style initializers

The code below causes flang to crash with an exception.
After fixing the crash flang with an internal error "no symbol found for 'bar'"
This change fixes all the issues.

  program name
    implicit none
    integer, parameter :: bar = 1
    integer foo(bar) /bar*2/
  end program name

Reviewed By: kiranchandramohan, klausler

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

2 years ago[OpenMP] Add basic support for properly handling static libraries
Joseph Huber [Fri, 6 May 2022 13:37:08 +0000 (09:37 -0400)]
[OpenMP] Add basic support for properly handling static libraries

Currently we handle static libraries like any other object in the
linker wrapper. However, this does not preserve the sematnics that
dictate static libraries should be lazily loaded as the symbols are
needed. This allows us to ignore linking in architectures that are not
used by the main application being compiled. This patch adds the basic
support for detecting if a file came from a static library, and only
including it in the link job if it's used by other object files.

This patch only adds the basic support, to be more correct we should
check the symbols and only inclue the library if the link job contains
symbols that are needed. Ideally we could just put this on the linker
itself, but nvlink doesn't seem to support `.a` files.

Reviewed By: jdoerfert

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

2 years agoRevert "[clangd] Speed up an unfortunate timer-based test."
Sam McCall [Fri, 6 May 2022 15:18:39 +0000 (17:18 +0200)]
Revert "[clangd] Speed up an unfortunate timer-based test."

This reverts commit 076dd0a763fd803897b0f806e0e350a27d2c087c.

http://45.33.8.238/macm1/34776/step_9.txt