platform/upstream/llvm.git
3 years ago[IRBuilder] Deprecate CreateConstGEP1_32() without element type
Nikita Popov [Sat, 17 Jul 2021 15:09:43 +0000 (17:09 +0200)]
[IRBuilder] Deprecate CreateConstGEP1_32() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[OpaquePtr] Remove uses of CreateConstGEP1_32() without element type
Nikita Popov [Sat, 17 Jul 2021 16:25:31 +0000 (18:25 +0200)]
[OpaquePtr] Remove uses of CreateConstGEP1_32() without element type

Remove uses of to-be-deprecated API. I've fallen back to calling
getPointerElementType() in some cases where the correct type wasn't
immediately obvious to me.

3 years ago[DebugInfo] Remove unnecessary <string> include dependency from DebugInfo headers...
Simon Pilgrim [Sat, 17 Jul 2021 15:55:51 +0000 (16:55 +0100)]
[DebugInfo] Remove unnecessary <string> include dependency from DebugInfo headers. NFC.

At most these use the StringRef/Twine wrappers and don't have any implicit uses of std::string.

Move the include down to any cpp implementation where std::string is actually used.

3 years ago[IRBuilder] Deprecate CreateConstInBoundsGEP1_64() without element type
Nikita Popov [Sat, 17 Jul 2021 14:46:29 +0000 (16:46 +0200)]
[IRBuilder] Deprecate CreateConstInBoundsGEP1_64() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[OpaquePtr] Remove uses of CGF.Builder.CreateConstInBoundsGEP1_64() without type
Nikita Popov [Sat, 17 Jul 2021 15:00:00 +0000 (17:00 +0200)]
[OpaquePtr] Remove uses of CGF.Builder.CreateConstInBoundsGEP1_64() without type

Remove uses of to-be-deprecated API.

3 years ago[IRBuilder] Deprecate CreateConstGEP1_64() without element type
Nikita Popov [Sat, 17 Jul 2021 14:25:55 +0000 (16:25 +0200)]
[IRBuilder] Deprecate CreateConstGEP1_64() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[OpaquePtr] Remove uses of CreateConstGEP1_64() without element type
Nikita Popov [Sat, 17 Jul 2021 14:38:43 +0000 (16:38 +0200)]
[OpaquePtr] Remove uses of CreateConstGEP1_64() without element type

Remove uses of to-be-deprecated API.

3 years ago[IRBuilder] Deprecate CreateConstInBoundsGEP2_64() without element type
Nikita Popov [Sat, 17 Jul 2021 14:06:10 +0000 (16:06 +0200)]
[IRBuilder] Deprecate CreateConstInBoundsGEP2_64() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[OpaquePtr] Remove uses of CreateConstInBoundsGEP2_64() without type
Nikita Popov [Sat, 17 Jul 2021 14:17:39 +0000 (16:17 +0200)]
[OpaquePtr] Remove uses of CreateConstInBoundsGEP2_64() without type

Remove uses of to-be-deprecated API.

3 years ago[IRBuilder] Deprecate CreateConstGEP2_64() without element type
Nikita Popov [Sat, 17 Jul 2021 14:03:14 +0000 (16:03 +0200)]
[IRBuilder] Deprecate CreateConstGEP2_64() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

3 years ago[Analaysis, CodeGen] Remove getHotSucc (NFC)
Kazu Hirata [Sat, 17 Jul 2021 14:31:36 +0000 (07:31 -0700)]
[Analaysis, CodeGen] Remove getHotSucc (NFC)

These functions seem to be unused for at least 5 years.

3 years ago[IR] Don't accept null type in ConstantExpr::getGetElementPtr()
Nikita Popov [Sat, 17 Jul 2021 13:30:55 +0000 (15:30 +0200)]
[IR] Don't accept null type in ConstantExpr::getGetElementPtr()

This is the same change as D105653, but for the constant expression
version of the API.

3 years ago[BPF] Use elementtype attribute for preserve.array/struct.index intrinsics
Nikita Popov [Fri, 16 Jul 2021 18:26:40 +0000 (20:26 +0200)]
[BPF] Use elementtype attribute for preserve.array/struct.index intrinsics

Use the elementtype attribute introduced in D105407 for the
llvm.preserve.array/struct.index intrinsics. It carries the
element type of the GEP these intrinsics effectively encode.

This patch:

 * Adds a verifier check that the attribute is required.
 * Adds it in the IRBuilder methods for these intrinsics.
 * Autoupgrades old bitcode without the attribute.
 * Updates the lowering code to use the attribute rather than
   the pointer element type.
 * Updates lots of tests to specify the attribute.
 * Adds -force-opaque-pointers to the intrinsic-array.ll test
   to demonstrate they work now.

https://reviews.llvm.org/D106184

3 years ago[RISCV] Manually emit the best shift for VSCALE lowering to improve codegen.
Craig Topper [Sat, 17 Jul 2021 07:24:48 +0000 (00:24 -0700)]
[RISCV] Manually emit the best shift for VSCALE lowering to improve codegen.

We assume VLENB is a multiple of 8 and previously relied on shift
pairs being optimized to an AND+SHL/SHR and computeKnownBits
removing the AND. This doesn't happen if (vlenb >> 3) gets CSEd
to have multiple uses. This patch manually emits the best shift
to workaround this.

3 years ago[sanitizers] Fix building on case sensitive mingw platforms
Martin Storsjö [Sat, 17 Jul 2021 06:31:54 +0000 (09:31 +0300)]
[sanitizers] Fix building on case sensitive mingw platforms

Make synchronization.lib all lowercase name for mingw, where casing matters.

This fixes building after 6d160abd7eba73031a2af500981f8ef44bd75ee4.

3 years ago[OpenMP] Codegen aggregate for outlined function captures
Giorgis Georgakoudis [Tue, 15 Jun 2021 17:30:12 +0000 (10:30 -0700)]
[OpenMP] Codegen aggregate for outlined function captures

Parallel regions are outlined as functions with capture variables explicitly generated as distinct parameters in the function's argument list. That complicates the fork_call interface in the OpenMP runtime: (1) the fork_call is variadic since there is a variable number of arguments to forward to the outlined function, (2) wrapping/unwrapping arguments happens in the OpenMP runtime, which is sub-optimal, has been a source of ABI bugs, and has a hardcoded limit (16) in the number of arguments, (3)  forwarded arguments must cast to pointer types, which complicates debugging. This patch avoids those issues by aggregating captured arguments in a struct to pass to the fork_call.

Reviewed By: jdoerfert

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

3 years ago[ORC] Fix typo in declaration
Lang Hames [Sun, 11 Jul 2021 02:21:04 +0000 (12:21 +1000)]
[ORC] Fix typo in declaration

3 years ago[mlir][vector] Remove vector.transfer_read/write to LLVM lowering
Matthias Springer [Sat, 17 Jul 2021 05:01:48 +0000 (14:01 +0900)]
[mlir][vector] Remove vector.transfer_read/write to LLVM lowering

This simplifies the vector to LLVM lowering. Previously, both vector.load/store and vector.transfer_read/write lowered directly to LLVM. With this commit, there is a single path to LLVM vector load/store instructions and vector.transfer_read/write ops must first be lowered to vector.load/store ops.

* Remove vector.transfer_read/write to LLVM lowering.
* Allow non-unit memref strides on all but the most minor dimension for vector.load/store ops.
* Add maxTransferRank option to populateVectorTransferLoweringPatterns.
* vector.transfer_reads with changing element type can no longer be lowered to LLVM. (This functionality is needed only for SPIRV.)

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

3 years ago[mlir][vector] Refactor TransferReadToVectorLoadLowering
Matthias Springer [Sat, 17 Jul 2021 04:52:20 +0000 (13:52 +0900)]
[mlir][vector] Refactor TransferReadToVectorLoadLowering

* TransferReadToVectorLoadLowering no longer generates memref.load ops.
* Add new pattern VectorLoadToMemrefLoadLowering that lowers scalar vector.loads to memref.loads.
* Add vector::BroadcastOp canonicalization pattern that folds broadcast chains.

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

3 years ago[RISCV] Make VLEN no greater than 65536
jacquesguan [Sat, 17 Jul 2021 04:45:34 +0000 (12:45 +0800)]
[RISCV] Make VLEN no greater than 65536

Reviewed By: craig.topper

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

3 years ago[ORC] Remove LLVM-side MachO Platform runtime support.
Lang Hames [Sun, 11 Jul 2021 01:35:55 +0000 (11:35 +1000)]
[ORC] Remove LLVM-side MachO Platform runtime support.

Support for this functionality is moving to the ORC runtime.

3 years ago[AMDGPU] Tidy SReg/SGPR definitions using template class
Carl Ritson [Sat, 17 Jul 2021 02:26:04 +0000 (11:26 +0900)]
[AMDGPU] Tidy SReg/SGPR definitions using template class

Use a multiclass to consistently define SReg/SGPR/TTMP register classes.
Add missing TTMP registers for 96b, 160b, 192b, 224b.

Reviewed By: foad

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

3 years ago[Analysis] Remove isJoinDivergent (NFC)
Kazu Hirata [Sat, 17 Jul 2021 01:23:17 +0000 (18:23 -0700)]
[Analysis] Remove isJoinDivergent (NFC)

The last use was removed on Sep 30, 2020 in commit
05ae04c396519cca9ef50d3b9cafb0cd9c87d1d7.

3 years ago[CSSPGO] Turn on iterative-BFI for CSSPGO
Wenlei He [Sat, 17 Jul 2021 00:04:48 +0000 (17:04 -0700)]
[CSSPGO] Turn on iterative-BFI for CSSPGO

Iterative-BFI produces better count quality and performance when evaluated on internal benchmarks. Turning it on by default now for CSSPGO. We can consider turn it on by default for AutoFDO as well in the future.

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

3 years agoMips/GlobalISel: Remove leftover dead code
Matt Arsenault [Fri, 16 Jul 2021 23:33:49 +0000 (19:33 -0400)]
Mips/GlobalISel: Remove leftover dead code

3 years agoAMDGPU/GlobalISel: Add a few tests for struct arguments
Matt Arsenault [Fri, 16 Jul 2021 22:35:26 +0000 (18:35 -0400)]
AMDGPU/GlobalISel: Add a few tests for struct arguments

Test structs with pointers and vectors of pointers since this stresses
a future patch.

3 years agoAMDGPU/GlobalISel: Fix some incorrect memory types in tests
Matt Arsenault [Fri, 16 Jul 2021 17:15:24 +0000 (13:15 -0400)]
AMDGPU/GlobalISel: Fix some incorrect memory types in tests

3 years ago[NFC][compiler-rt][test] when using ptrauth, strip before checking if poisoned
Emily Shi [Sat, 17 Jul 2021 00:03:47 +0000 (17:03 -0700)]
[NFC][compiler-rt][test] when using ptrauth, strip before checking if poisoned

ptrauth stores info in the address of functions, so it's not the right address we should check if poisoned

rdar://75246928

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

3 years ago[trace][intel pt] Implement the Intel PT cursor
Walter Erquinigo [Tue, 29 Jun 2021 21:03:30 +0000 (14:03 -0700)]
[trace][intel pt] Implement the Intel PT cursor

D104422 added the interface for TraceCursor, which is the main way to traverse instructions in a trace. This diff implements the corresponding cursor class for Intel PT and deletes the now obsolete code.

Besides that, the logic for the "thread trace dump instructions" was adapted to use this cursor (pretty much I ended up moving code from Trace.cpp to TraceCursor.cpp). The command by default traverses the instructions backwards, and if the user passes --forwards, then it's not forwards. More information about that is in the Options.td file.

Regarding the Intel PT cursor. All Intel PT cursors for the same thread share the same DecodedThread instance. I'm not yet implementing lazy decoding because we don't need it. That'll be for later. For the time being, the entire thread trace is decoded when the first cursor for that thread is requested.

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

3 years ago[CSSPGO] Turn on unique linkage name by default for pseudo probe.
Hongtao Yu [Fri, 16 Jul 2021 21:26:03 +0000 (14:26 -0700)]
[CSSPGO] Turn on unique linkage name by default for pseudo probe.

Turning on -funique-internal-linkage-names when -fpseudo-probe-for-profiling is on, unless -fno-unique-internal-linkage-names is specified.

Reviewed By: wenlei

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

3 years ago[ScalarEvolution] Fix overflow in computeBECount.
Eli Friedman [Fri, 9 Jul 2021 21:10:44 +0000 (14:10 -0700)]
[ScalarEvolution] Fix overflow in computeBECount.

The current implementation of computeBECount doesn't account for the
possibility that adding "Stride - 1" to Delta might overflow. For almost
all loops, it doesn't, but it's not actually proven anywhere.

To deal with this, use a variety of tricks to try to prove that the
addition doesn't overflow.  If the proof is impossible, use an alternate
sequence which never overflows.

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

3 years ago[lit] Add --xfail-not/LIT_XFAIL_NOT
Joel E. Denny [Fri, 16 Jul 2021 23:13:34 +0000 (19:13 -0400)]
[lit] Add --xfail-not/LIT_XFAIL_NOT

For example, I need this lately in my CI config:

LIT_XFAIL_NOT='libomptarget :: nvptx64-nvidia-cuda :: unified_shared_memory/api.c'

That test specifies an XFAIL directive, but I get an XPASS result.

Reviewed By: jhenderson

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

3 years agoRevert "Build libSupport with -Werror=global-constructors (NFC)"
Mehdi Amini [Fri, 16 Jul 2021 22:46:17 +0000 (22:46 +0000)]
Revert "Build libSupport with -Werror=global-constructors (NFC)"

This reverts commit 1f71bcabb77df482cc0dc7bab90a73e15f3e347b.

Some platform have global destructors for std::mutex that still
needs to be fixed.

3 years agoAdd a mutex to guard access to the ThreadPlanStack class
Jim Ingham [Fri, 16 Jul 2021 03:39:15 +0000 (20:39 -0700)]
Add a mutex to guard access to the ThreadPlanStack class

We've seen reports of crashes (none we've been able to reproduce
locally) that look like they are caused by concurrent access to a
thread plan stack.  It looks like there are error paths when an
interrupt request to debugserver times out that cause this problem.

The thread plan stack access is never in a hot loop, and there
aren't enough of them for the extra data member to matter, so
there's really no good reason not to protect the access.

Adding the mutex revealed a couple of places where we were
using "auto" in an iteration when we should have been using
"auto &" - we didn't intend to copy the stack - and I fixed
those as well.

Except for preventing crashes this should be NFC.

Differential Revision: https\://reviews.llvm.org/D106122

3 years ago[libcxx][modules] protects users from relying on libc++ detail headers (1/n)
Christopher Di Bella [Tue, 13 Jul 2021 19:44:07 +0000 (19:44 +0000)]
[libcxx][modules] protects users from relying on libc++ detail headers (1/n)

libc++ has started splicing standard library headers into much more
fine-grained content for maintainability. It's very likely that outdated
and naive tooling (some of which is outside of LLVM's scope) will
suggest users include things such as `<__algorithm/find.h>` instead of
`<algorithm>`, and Hyrum's law suggests that users will eventually begin
to rely on this without the help of tooling. As such, this commit
intends to protect users from themselves, by making it a hard error for
anyone outside of the standard library to include libc++ detail headers.

This is the first of four patches. Patch #2 will solve the problem for
pre-processor `#include`s; patches #3 and #4 will solve the problem for
`<__tree>` and `<__hash_table>` (since I've never touched the test cases
that are failing for these two, I want to split them out into their own
commits to be extra careful). Patch #5 will concern itself with
`<__threading_support>`, which intersects with libcxxabi (which I know
even less about).

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

3 years ago[Bazel] Delete blank line to make buildifier happy
Fangrui Song [Fri, 16 Jul 2021 22:33:42 +0000 (15:33 -0700)]
[Bazel] Delete blank line to make buildifier happy

3 years ago[sanitizer] Fix test build on Windows
Vitaly Buka [Fri, 16 Jul 2021 22:28:26 +0000 (15:28 -0700)]
[sanitizer] Fix test build on Windows

3 years agoBuild libSupport with -Werror=global-constructors (NFC)
Mehdi Amini [Fri, 16 Jul 2021 03:32:59 +0000 (03:32 +0000)]
Build libSupport with -Werror=global-constructors (NFC)

Ensure that libSupport does not carry any static global initializer.
libSupport can be embedded in use cases where we don't want to load all
cl::opt unless we want to parse the command line.
ManagedStatic can be used to enable lazy-initialization of globals.

3 years ago[ARM] Fix for matching reductions that are both sext and zext.
David Green [Fri, 16 Jul 2021 22:11:42 +0000 (23:11 +0100)]
[ARM] Fix for matching reductions that are both sext and zext.

Fix a silly mistake that was not making sure that _both_ operands were
the correct extend code.

3 years agoRevert "ThinLTO: Fix inline assembly references to static functions with CFI"
Sami Tolvanen [Fri, 16 Jul 2021 21:47:19 +0000 (14:47 -0700)]
Revert "ThinLTO: Fix inline assembly references to static functions with CFI"

This reverts commit 8e3b5cb39eef462943ed7556469604ce25c07a1d.

Reverting to investigate test failures.

3 years agoThinLTO: Fix inline assembly references to static functions with CFI
Sami Tolvanen [Fri, 16 Jul 2021 20:56:54 +0000 (13:56 -0700)]
ThinLTO: Fix inline assembly references to static functions with CFI

Create an internal alias with the original name for static functions
that are renamed in promoteInternals to avoid breaking inline
assembly references to them. This version uses module inline assembly
to avoid issues with LowerTypeTestsModule.

Link: https://github.com/ClangBuiltLinux/linux/issues/1354
Reviewed By: nickdesaulniers, pcc

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

3 years ago[PowerPC] Implement intrinsics for mtfsf[i]
Nemanja Ivanovic [Fri, 16 Jul 2021 18:54:21 +0000 (13:54 -0500)]
[PowerPC] Implement intrinsics for mtfsf[i]

This provides intrinsics for emitting instructions that set the FPSCR (`mtfsf/mtfsfi`).

The patch also conservatively marks the rounding mode as an implicit def for both since they both may set the rounding mode depending on the operands.

Reviewed By: #powerpc, qiucf

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

3 years agoAdd `lli` as dependency of MLIR integration tests
Mehdi Amini [Fri, 16 Jul 2021 21:06:38 +0000 (21:06 +0000)]
Add `lli` as dependency of MLIR integration tests

This fixes running `ninja check-mlir` from a clean build when
the integration tests are enabled.

3 years ago[Bazel] Add examples to bazelignore
Geoffrey Martin-Noble [Fri, 2 Jul 2021 16:13:19 +0000 (09:13 -0700)]
[Bazel] Add examples to bazelignore

This avoids Bazel recursing into these directories when overlayed, which
will break if someone has run Bazel in these dirs (which would only be
successful with the http_archive example) because of the Bazel directory
symlinks (already gitignored).

Reviewed By: jpienaar

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

3 years ago[Bazel] Make gentbl_test compatible with coverage
Geoffrey Martin-Noble [Fri, 16 Jul 2021 01:05:57 +0000 (18:05 -0700)]
[Bazel] Make gentbl_test compatible with coverage

Add explicit coverage provider. Also remove output_to_genfiles which
isn't necessary for this test (it's just copy-pasta from gentbl_rule,
which needs it for output C++ header files).

Reviewed By: jpienaar

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

3 years ago[Bazel] Use bazel_skylib paths for paths munging
Geoffrey Martin-Noble [Fri, 16 Jul 2021 18:49:50 +0000 (11:49 -0700)]
[Bazel] Use bazel_skylib paths for paths munging

We do a lot of path munging and bazel_sklyib is a pretty reasonable dep.

Reviewed By: jpienaar

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

3 years ago[SLP]Improve calculations of the cost for reused/reordered scalars.
Alexey Bataev [Thu, 15 Jul 2021 12:12:17 +0000 (05:12 -0700)]
[SLP]Improve calculations of the cost for reused/reordered scalars.

Part of D105020. Also, fixed FIXMEs that need to use wider vector type
when trying to calculate the cost of reused scalars. This may cause
regressions unless D100486 is landed to improve the cost estimations
for long vectors shuffling.

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

3 years ago[gn build] Port 0bf4b81d57b0
LLVM GN Syncbot [Fri, 16 Jul 2021 20:32:47 +0000 (20:32 +0000)]
[gn build] Port 0bf4b81d57b0

3 years ago[GlobalISel] Fix non-pow-2 legalization of s56 stores.
Amara Emerson [Fri, 16 Jul 2021 19:56:11 +0000 (12:56 -0700)]
[GlobalISel] Fix non-pow-2 legalization of s56 stores.

s56 stores are broken down into s32 + s24 stores. During this step
both of those new stores use an anyextended s64 value, resulting in
truncating stores. With s56, the s24 requires another lower step to
make it legal, and we were crashing because we didn't expect non-pow-2
stores to also be truncating as well.

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

3 years ago[COFF][test] Fix llvm-readobj tests
Fangrui Song [Fri, 16 Jul 2021 20:28:46 +0000 (13:28 -0700)]
[COFF][test] Fix llvm-readobj tests

3 years ago[NFC][compiler-rt][test] pass through MallocNanoZone to iossim env
Emily Shi [Fri, 16 Jul 2021 18:47:16 +0000 (11:47 -0700)]
[NFC][compiler-rt][test] pass through MallocNanoZone to iossim env

This is required for no-fd.cpp test

rdar://79354597

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

3 years ago[libcxx] [test] Fix experimental/memory.resource.adaptor.mem/db_deallocate on Windows
Martin Storsjö [Tue, 13 Jul 2021 12:38:56 +0000 (12:38 +0000)]
[libcxx] [test] Fix experimental/memory.resource.adaptor.mem/db_deallocate on Windows

The checks within the libc++experimental memory_resource class uses this
limit:

     _MaxAlign = _LIBCPP_ALIGNOF(max_align_t);

Therefore, only use max_align_t for this limit instead of using
`__STDCPP_DEFAULT_NEW_ALIGNMENT__` if available.

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

3 years ago[PATCH] D105827: [SLP]Workaround for InsertSubVector cost.
Alexey Bataev [Fri, 16 Jul 2021 19:42:19 +0000 (12:42 -0700)]
[PATCH] D105827: [SLP]Workaround for InsertSubVector cost.

The cost of the InsertSubvector shuffle kind cost is not complete and
may end up with just extracts + inserts costs in many cases. Added
a workaround to represent it as a generic PermuteSingleSrc, which is
still pessimistic but better than InsertSubvector.

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

3 years ago[gn build] (semi-manually) port 6a4054ef060b
Nico Weber [Fri, 16 Jul 2021 19:54:13 +0000 (15:54 -0400)]
[gn build] (semi-manually) port 6a4054ef060b

3 years ago[RISCV] Compose vector subregs hierarchically
Jon Roelofs [Fri, 16 Jul 2021 17:59:56 +0000 (10:59 -0700)]
[RISCV] Compose vector subregs hierarchically

This fixes the test I broke in: https://reviews.llvm.org/D105953#2883579

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

3 years agoAdd a scalar argument case for the Fortran spread intrinsic unit test.
Mark Leair [Mon, 12 Jul 2021 19:38:55 +0000 (12:38 -0700)]
Add a scalar argument case for the Fortran spread intrinsic unit test.

3 years ago[llvm-readelf/llvm-readobj] Remove one-dash long options
Fangrui Song [Fri, 16 Jul 2021 19:03:08 +0000 (12:03 -0700)]
[llvm-readelf/llvm-readobj] Remove one-dash long options

llvm-readelf is a user-facing tool which emulates GNU readelf. Remove one-dash
long options which are not recognized by GNU style `getopt_long`. This ensures
long options cannot collide with grouped short options.

Note: the documentation (D63719)/help messages have recommended the double-dash
forms since LLVM 9.0.0.
llvm-readobj is intended as an internal tool which has some flexibility.
llvm-readelf/llvm-readobj use the same option parsing code and llvm-readobj's
one-dash long options aren't used after test migration.

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

3 years ago[test] Avoid llvm-readelf/llvm-readobj one-dash long options
Fangrui Song [Fri, 16 Jul 2021 19:02:49 +0000 (12:02 -0700)]
[test] Avoid llvm-readelf/llvm-readobj one-dash long options

3 years ago[ARM] Extra MLA vecreduce tests. NFC
David Green [Fri, 16 Jul 2021 19:01:52 +0000 (20:01 +0100)]
[ARM] Extra MLA vecreduce tests. NFC

3 years ago[X86][SSE] combineX86ShufflesRecursively - bail if constant folding fails due to...
Simon Pilgrim [Fri, 16 Jul 2021 17:50:12 +0000 (18:50 +0100)]
[X86][SSE] combineX86ShufflesRecursively - bail if constant folding fails due to oneuse limits.

Fixes issue reported on D105827 where a single shuffle of a constant (with multiple uses) was caught in an infinite loop where one shuffle (UNPCKL) used an undef arg but then that got recombined to SHUFPS as the constant value had its own undef that confused matching.....

3 years ago[PowerPC] Implement XL compact math builtins
Lei Huang [Tue, 13 Jul 2021 19:32:36 +0000 (14:32 -0500)]
[PowerPC] Implement XL compact math builtins

Implement a subset of builtins required for compatiblilty with AIX XL compiler.

Reviewed By: nemanjai

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

3 years ago[OpenMP][NFC] Update the comment header for optimizations.
Joseph Huber [Fri, 16 Jul 2021 18:12:42 +0000 (14:12 -0400)]
[OpenMP][NFC] Update the comment header for optimizations.

3 years ago[OpenMP] Add remark documentation to the OpenMP webpage
Joseph Huber [Wed, 14 Jul 2021 21:04:54 +0000 (17:04 -0400)]
[OpenMP] Add remark documentation to the OpenMP webpage

This patch begins adding documentation for each remark emitted by
`openmp-opt`. This builds on the IDs introduced in D105939 so that users
can more easily identify each remark in the webpage.

Depends on D105939.

Reviewed By: jdoerfert

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

3 years ago[OpenMP] Add IDs to OpenMP remarks
Joseph Huber [Tue, 13 Jul 2021 19:31:44 +0000 (15:31 -0400)]
[OpenMP] Add IDs to OpenMP remarks

This patch adds unique idenfitiers to the existing OpenMP remarks. This makes
it easier to identify the corresponding documentation for each remark that will
be hosted in the OpenMP webpage.

Depends on D105898

Reviewed By: jdoerfert

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

3 years ago[OpenMP] Rework OpenMP remarks
Joseph Huber [Tue, 13 Jul 2021 14:01:21 +0000 (10:01 -0400)]
[OpenMP] Rework OpenMP remarks

This patch rewrites and reworks a few of the existing remarks to make the mmore
concise and consistent prior to writing the documentation for them.

Reviewed By: jdoerfert

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

3 years agosanitizer_common: link Synchronization.lib on Windows
Dmitry Vyukov [Fri, 16 Jul 2021 17:55:32 +0000 (19:55 +0200)]
sanitizer_common: link Synchronization.lib on Windows

Windows bot failed with:
sanitizer_win.cpp.obj : error LNK2019: unresolved external symbol WaitOnAddress referenced in function "void __cdecl __sanitizer::FutexWait(struct __sanitizer::atomic_uint32_t *,unsigned int)" (?FutexWait@__sanitizer@@YAXPEAUatomic_uint32_t@1@I@Z)
sanitizer_win.cpp.obj : error LNK2019: unresolved external symbol WakeByAddressSingle referenced in function "void __cdecl __sanitizer::FutexWake(struct __sanitizer::atomic_uint32_t *,unsigned int)" (?FutexWake@__sanitizer@@YAXPEAUatomic_uint32_t@1@I@Z)
sanitizer_win.cpp.obj : error LNK2019: unresolved external symbol WakeByAddressAll referenced in function "void __cdecl __sanitizer::FutexWake(struct __sanitizer::atomic_uint32_t *,unsigned int)" (?FutexWake@__sanitizer@@YAXPEAUatomic_uint32_t@1@I@Z)
https://lab.llvm.org/buildbot/#/builders/127/builds/14046

According to MSDN we need to link Synchronization.lib:
https://docs.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitonaddress

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

3 years ago[compiler-rt] change write order of frexpl & frexpf so it doesn't corrupt stack ids
Emily Shi [Fri, 25 Jun 2021 20:32:03 +0000 (13:32 -0700)]
[compiler-rt] change write order of frexpl & frexpf so it doesn't corrupt stack ids

This was fixed in the past for `frexp`, but was not made for `frexpl` & `frexpf` https://github.com/google/sanitizers/issues/321
This patch copies the fix over to `frexpl` because it caused `frexp_interceptor.cpp` test to fail on iPhone and `frexpf` for consistency.

rdar://79652161

Reviewed By: delcypher, vitalybuka

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

3 years ago[tests] Precommit test for D104140
Philip Reames [Fri, 16 Jul 2021 17:57:51 +0000 (10:57 -0700)]
[tests] Precommit test for D104140

3 years ago[mlir][sparse] minor cleanup of Merger
Aart Bik [Fri, 16 Jul 2021 16:02:58 +0000 (09:02 -0700)]
[mlir][sparse] minor cleanup of Merger

Removed inconsistent name prefixes, added consistency checks
on debug strings, added more assertions to verify assumptions
that may be lifted in the future.

Reviewed By: gussmith23

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

3 years ago[Clang] Add an empty builtins.h file.
Stefan Pintilie [Thu, 15 Jul 2021 14:23:23 +0000 (09:23 -0500)]
[Clang] Add an empty builtins.h file.

On Power PC some legacy compilers included a number of builtins in a
builtins.h header file. While this header file is not required to hold
builtins for clang some legacy code does try to include this file and so
this patch provides an empty version of that file.

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

3 years ago[RISCV] Rename the fixed vector vwmacc tests to have the 'm' in their filenames. NFC
Craig Topper [Fri, 16 Jul 2021 17:20:38 +0000 (10:20 -0700)]
[RISCV] Rename the fixed vector vwmacc tests to have the 'm' in their filenames. NFC

3 years ago[RISCV] Use tail agnostic policy for fixed vector vwmacc(u).
Craig Topper [Fri, 16 Jul 2021 17:17:36 +0000 (10:17 -0700)]
[RISCV] Use tail agnostic policy for fixed vector vwmacc(u).

This adds new pseudoinstructions with ForceTailAgnostic set. This
matches what we did for non-widening VMACC. We should move to a
tail policy operand on the pseudos when we expand the intrinsic
interface to include the tail policy.

3 years ago[RISCV] Refactor where in the multiclass hierarchy we add commutable VFMADD/VFMACC...
Craig Topper [Fri, 16 Jul 2021 17:01:05 +0000 (10:01 -0700)]
[RISCV] Refactor where in the multiclass hierarchy we add commutable VFMADD/VFMACC instructions. NFC

I'm preparing to add tail agnostic versions of VWMACC and VFWMACC
so this will make them more consistent.

3 years ago[docs] Update llvm-readelf supported options after D105532
Fangrui Song [Fri, 16 Jul 2021 17:40:30 +0000 (10:40 -0700)]
[docs] Update llvm-readelf supported options after D105532

3 years agosanitizer_common: add Semaphore
Dmitry Vyukov [Thu, 15 Jul 2021 15:15:48 +0000 (17:15 +0200)]
sanitizer_common: add Semaphore

Semaphore is a portable way to park/unpark threads.
The plan is to use it to implement a portable blocking
mutex in subsequent changes. Semaphore can also be used
to efficiently wait for other things (e.g. we currently
spin to synchronize thread creation and start).

Reviewed By: vitalybuka, melver

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

3 years ago[test] Extend negative stride backedge tests to cover signed comparisons
Philip Reames [Fri, 16 Jul 2021 17:24:41 +0000 (10:24 -0700)]
[test] Extend negative stride backedge tests to cover signed comparisons

3 years ago[X86FixupLEAs] Try again to transform the sequence LEA/SUB to SUB/SUB
Guozhi Wei [Fri, 16 Jul 2021 17:16:03 +0000 (10:16 -0700)]
[X86FixupLEAs] Try again to transform the sequence LEA/SUB to SUB/SUB

This patch transforms the sequence
    lea (reg1, reg2), reg3
    sub reg3, reg4
to two sub instructions
    sub reg1, reg4
    sub reg2, reg4

Similar optimization can also be applied to LEA/ADD sequence.

The modifications to TwoAddressInstructionPass is to ensure the operands of ADD
instruction has expected order (the dest register of LEA should be src register
of ADD).

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

3 years ago[SCEV] Add tests for known negative strides in trip count logic
Philip Reames [Fri, 16 Jul 2021 17:08:20 +0000 (10:08 -0700)]
[SCEV] Add tests for known negative strides in trip count logic

3 years ago[ELF][test] Avoid llvm-readelf/llvm-readobj one-dash long options
Fangrui Song [Fri, 16 Jul 2021 17:02:47 +0000 (10:02 -0700)]
[ELF][test] Avoid llvm-readelf/llvm-readobj one-dash long options

3 years agoRevert "[MachineVerifier] Diagnose invalid INSERT_SUBREGs"
Jon Roelofs [Fri, 16 Jul 2021 16:53:16 +0000 (09:53 -0700)]
Revert "[MachineVerifier] Diagnose invalid INSERT_SUBREGs"

This reverts commit dd57ba1a17b93dbe211d04cb2d4de5f6dc898d60.

It broke some tests: http://45.33.8.238/linux/51314/step_12.txt

3 years ago[X86] Regenerate twoaddr-lea.ll test checks.
Simon Pilgrim [Fri, 16 Jul 2021 14:14:05 +0000 (15:14 +0100)]
[X86] Regenerate twoaddr-lea.ll test checks.

3 years ago[DAG] SelectionDAG::MaskedElementsAreZero - assert we're calling with a vector. NFCI.
Simon Pilgrim [Fri, 16 Jul 2021 11:05:05 +0000 (12:05 +0100)]
[DAG] SelectionDAG::MaskedElementsAreZero - assert we're calling with a vector. NFCI.

Add an assertion that we've calling MaskedElementsAreZero with a vector op and that the DemandedElts arg is a matching width.

Makes the error a lot easier to grok when something else accidentally gets used.

3 years ago[MachineVerifier] Diagnose invalid INSERT_SUBREGs
Jon Roelofs [Wed, 14 Jul 2021 00:07:48 +0000 (17:07 -0700)]
[MachineVerifier] Diagnose invalid INSERT_SUBREGs

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

3 years ago[RISCV] Teach constant materialization that it can use zext.w at the end with Zba...
Craig Topper [Fri, 16 Jul 2021 16:23:17 +0000 (09:23 -0700)]
[RISCV] Teach constant materialization that it can use zext.w at the end with Zba to reduce number of instructions.

If the upper 32 bits are zero and bit 31 is set, we might be able to
use zext.w to fill in the zeros after using an lui and/or addi.

Most of this patch is plumbing the subtarget features into the constant
materialization.

Reviewed By: luismarques

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

3 years ago[RISCV] Add curly braces around a case body that declares variables. NFC
Craig Topper [Fri, 16 Jul 2021 01:06:59 +0000 (18:06 -0700)]
[RISCV] Add curly braces around a case body that declares variables. NFC

This is at the end of the switch so doesn't cause any issues now,
but if a new case is added it will break.

3 years ago[Verifier] Require same signature for intrinsic calls
Nikita Popov [Wed, 14 Jul 2021 20:21:06 +0000 (22:21 +0200)]
[Verifier] Require same signature for intrinsic calls

As suggested on D105733, this adds a verifier rule that calls to
intrinsics must match the signature of the intrinsic.

Without opaque pointers this is automatically enforced for all
calls, because the pointer types need to match. If the signatures
don't match, a pointer bitcast has to be inserted. For intrinsics
in particular, such bitcasts are not legal, because the address of
intrinsics cannot be taken.

With opaque pointers, there are no more pointer bitcasts, so it's
generally possible for the call and the callee signature to differ.
However, for intrinsics we still want to enforce that the signatures
must match, the same as was done before through the address taken
check.

We can't enforce this more generally for non-intrinsics, because
calls with mismatched signatures at the very least can legally
occur in unreachable code, and might also be valid in some other
cases, depending on how exactly the signatures differ.

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

3 years ago[NFC] Fix typo intrinisic
madhur13490 [Fri, 16 Jul 2021 16:13:48 +0000 (21:43 +0530)]
[NFC] Fix typo intrinisic

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

3 years ago[libcxx][modularisation] adds several headers to the module map
Christopher Di Bella [Thu, 15 Jul 2021 06:41:17 +0000 (06:41 +0000)]
[libcxx][modularisation] adds several headers to the module map

* <__algorithm/iter_swap.h>
* <__algorithm/swap_ranges.h>
* <__functional/is_transparent.h>
* <__memory/uses_allocator.h>
* <__ranges/drop_view.h>
* <__ranges/transform_view.h>
* <shared_mutex>
* <span>

Also updates header inclusions that were affected.

**NOTE:** This is a proper subset of D105932. Since the content has
already been LGTM'd, I intend to merge this patch without review,
pending green CI. I decided it would be better to move these changes
into their own commit since the former patch has undergone further
changes and will need yet another light review. In the event any of
that gets rolled back (for whatever reason), the changes in this patch
won't be affected.

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

3 years ago[flang][driver] Fix output filename generation in `flang`
Andrzej Warzynski [Fri, 16 Jul 2021 16:06:06 +0000 (17:06 +0100)]
[flang][driver] Fix output filename generation in `flang`

In the `flang` bash script, we need to be careful _when_ to use <output>
from `flang -c -o <output> <input>` when generating the relocatable
output file name.

In particular, we should use it in this case:
```compilation only
flang -c -o <output> <input>
```
but leave it for the final executable here:
```compile, assemble and link
flang  -o <output> <input>
```
This change is implemented in `get_relocatable_name`.

I've also taken the liberty to fix how errors from sub-commands are
reported (without this change, `flang` always returns `0` on failure).
This is implemented in `main`.

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

3 years ago[LoopInterchange] Check lcssa phis in the inner latch in scenarios of multi-level...
Congzhe Cao [Fri, 16 Jul 2021 15:47:11 +0000 (11:47 -0400)]
[LoopInterchange] Check lcssa phis in the inner latch in scenarios of multi-level nested loops

We already know that we need to check whether lcssa
phis are supported in inner loop exit block or in
outer loop exit block, and we have logic to check
them already. Presumably the inner loop latch does
not have lcssa phis and there is no code that deals
with lcssa phis in the inner loop latch. However,
that assumption is not true, when we have loops
with more than two-level nesting. This patch adds
checks for lcssa phis in the inner latch.

Reviewed By: Whitney

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

3 years ago[libc++] ci: Create ~/Library/LaunchAgents if it does not exist yet
Louis Dionne [Fri, 16 Jul 2021 15:46:47 +0000 (11:46 -0400)]
[libc++] ci: Create ~/Library/LaunchAgents if it does not exist yet

3 years agoMips/GlobalISel: Use LLT form of getMachineMemOperand
Matt Arsenault [Fri, 11 Jun 2021 16:17:32 +0000 (12:17 -0400)]
Mips/GlobalISel: Use LLT form of getMachineMemOperand

NFC here since it's just using a scalar anyway.

3 years agoGlobalISel: Preserve memory type for memset expansion
Matt Arsenault [Fri, 16 Jul 2021 15:25:07 +0000 (11:25 -0400)]
GlobalISel: Preserve memory type for memset expansion

3 years agoAArch64/GlobalISel: Update tests to use correct memory types
Matt Arsenault [Fri, 16 Jul 2021 13:19:23 +0000 (09:19 -0400)]
AArch64/GlobalISel: Update tests to use correct memory types

3 years ago[libc++] CI: Setup BuildKite agents through launchd
Louis Dionne [Fri, 16 Jul 2021 15:37:16 +0000 (11:37 -0400)]
[libc++] CI: Setup BuildKite agents through launchd

This makes sure that even if a node goes down, the BuildKite agent will
be started again when it goes back up.

3 years ago[mlir] Remove unused functions in LinalgOps.cpp
Alexander Belyaev [Fri, 16 Jul 2021 15:14:34 +0000 (17:14 +0200)]
[mlir] Remove unused functions in LinalgOps.cpp

3 years ago[Bazel] Delete deprecated gentbl rule
Geoffrey Martin-Noble [Fri, 16 Jul 2021 01:06:21 +0000 (18:06 -0700)]
[Bazel] Delete deprecated gentbl rule

This has been deprecated for a while. There are no users in tree and I'm
not aware of any out of tree users either.

Reviewed By: ftynse

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

3 years ago[PowerPC] Updated the error message of MASSV pass to mention vectorization
Masoud Ataei [Fri, 16 Jul 2021 14:45:09 +0000 (14:45 +0000)]
[PowerPC] Updated the error message of MASSV pass to mention vectorization
 is needed be enable on P8 and later targets.

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

3 years ago[runtimes] Simplify how we set the target triple
Louis Dionne [Wed, 14 Jul 2021 19:54:13 +0000 (15:54 -0400)]
[runtimes] Simplify how we set the target triple

Instead of using TARGET_TRIPLE, which is always set to LLVM_DEFAULT_TARGET_TRIPLE,
use that variable directly to populate the various XXXX_TARGET_TRIPLE
variables in the runtimes.

This re-applies 77396bbc98 and 5099e01568, which were reverted in
850b57c5fbe because they broke the build.

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

3 years ago[PowerPC] Update Refactored Load/Store Implementation, XForm VSX Patterns, and Tests
Amy Kwan [Wed, 14 Jul 2021 01:33:23 +0000 (20:33 -0500)]
[PowerPC] Update Refactored Load/Store Implementation, XForm VSX Patterns, and Tests

This patch includes the following updates to the load/store refactoring effort introduced in D93370:
 - Update various VSX patterns that use to "force" an XForm, to instead just XForm.
   This allows the ability for the patterns to compute the most optimal addressing
   mode (and to produce a DForm instruction when possible)
- Update pattern and test case for the LXVD2X/STXVD2X intrinsics
- Update LIT test cases that use to use the XForm instruction to use the DForm instruction

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