platform/upstream/llvm.git
3 years agoUnsupported sanitize-coverage-old-pm.c on 32 bit Arm
Muhammad Omair Javaid [Fri, 25 Jun 2021 00:55:25 +0000 (00:55 +0000)]
Unsupported sanitize-coverage-old-pm.c on 32 bit Arm

sanitize-coverage-old-pm.c is passing intermittently on different
arm v7 machines. This patch moves it to unsupported on all arm 32
targets reporting armv8l core.

3 years agoRevert "[hwasan] print exact mismatch offset for short granules."
Vitaly Buka [Fri, 25 Jun 2021 00:30:03 +0000 (17:30 -0700)]
Revert "[hwasan] print exact mismatch offset for short granules."

Breaks sanitizer-x86_64-linux-android and sanitizer-x86_64-linux-qemu bots.

This reverts commit 7e3f8b8affd0392c997564b5f34c61d6115a3516.

3 years ago[scudo] Clang-format tests
Vitaly Buka [Fri, 25 Jun 2021 00:28:01 +0000 (17:28 -0700)]
[scudo] Clang-format tests

3 years ago[gn build] Port 69d5a6662115
LLVM GN Syncbot [Fri, 25 Jun 2021 00:29:34 +0000 (00:29 +0000)]
[gn build] Port 69d5a6662115

3 years ago[libcxx][modularisation] splits `<utility>` into self-contained headers
Christopher Di Bella [Wed, 9 Jun 2021 23:10:17 +0000 (23:10 +0000)]
[libcxx][modularisation] splits `<utility>` into self-contained headers

* moves `std::hash` and `std::unary_function` into `__functional`
* Everything else goes into `__utility/${NAME}.h`

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

3 years agoChange the flang reshape runtime routine interface to use a result
Mark Leair [Thu, 24 Jun 2021 23:55:45 +0000 (16:55 -0700)]
Change the flang reshape runtime routine interface to use a result
argument instead of a result result object.

Change the reshape flang unit test to use the new interface. Also, add an
order argument to exercise the order subscript code in the rehsape runtime
routine.

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

3 years agoRevert "[Clang] XFAIL sanitize-coverage-old-pm.c on 32bit Armv8l"
Muhammad Omair Javaid [Thu, 24 Jun 2021 23:59:32 +0000 (04:59 +0500)]
Revert "[Clang] XFAIL sanitize-coverage-old-pm.c on 32bit Armv8l"

This reverts commit c5028f3473ed50a7433fe278984cd1a755b338b9.

3 years ago[PowerPC] Fix vec_add for 64-bit on pre-Power7 subtargets
Nemanja Ivanovic [Thu, 24 Jun 2021 23:41:12 +0000 (18:41 -0500)]
[PowerPC] Fix vec_add for 64-bit on pre-Power7 subtargets

The shift of the carry was actually incorrect.

3 years agoUpdate Bazel build for 744146f60b
Geoffrey Martin-Noble [Thu, 24 Jun 2021 23:33:13 +0000 (16:33 -0700)]
Update Bazel build for 744146f60b

Updates Bazel build files to match
https://github.com/llvm/llvm-project/commit/744146f60b

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

3 years ago[PowerPC] Fix bswap combine for big endian systems
Nemanja Ivanovic [Thu, 24 Jun 2021 23:03:06 +0000 (18:03 -0500)]
[PowerPC] Fix bswap combine for big endian systems

Commit 0464586ac515e8cfebe4c7615387fd625c8869f5 added a combine
for a 64-bit load feeding a bswap but the implementation is only
correct for little endian systems.
This fixes it for big endian systems.

3 years ago[MLIR][Sparse] Refactor lattice code into its own file
Gus Smith [Thu, 24 Jun 2021 22:18:40 +0000 (22:18 +0000)]
[MLIR][Sparse] Refactor lattice code into its own file

Moves iteration lattice/merger code into new SparseTensor/Utils directory. A follow-up CL will add lattice/merger unit tests.

Reviewed By: aartbik

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

3 years ago[OpenMP][NFC] libomp: fix wrong debug assertion.
AndreyChurbanov [Thu, 24 Jun 2021 23:02:14 +0000 (02:02 +0300)]
[OpenMP][NFC] libomp: fix wrong debug assertion.

Normalized bounds of chunk of iterations to steal from are inclusive,
so upper bound should not be decremented in expression to check.
Problem was in attempt to steal iterations 0:0, that caused assertion after
wrong decrement. Reported in comment to https://reviews.llvm.org/D103648.

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

3 years ago[AMDGPU] Reserve AMDGPU ELF e_flags machine 0x43
Tony Tye [Thu, 24 Jun 2021 02:01:24 +0000 (02:01 +0000)]
[AMDGPU] Reserve AMDGPU ELF e_flags machine 0x43

Reviewed By: kzhuravl, rampitec

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

3 years agoDisable TestAArch64UnwindPAC.py for non PAC targets
Muhammad Omair Javaid [Thu, 24 Jun 2021 22:49:05 +0000 (22:49 +0000)]
Disable TestAArch64UnwindPAC.py for non PAC targets

TestAArch64UnwindPAC.py started failing on LLDB buildbot as underlying
hardware does not support PAC. This patch skips this test for targets
which do not support PAC feature.

3 years ago[mlir][VectorToGPU] Add conversion for scf::For op with Matrix operands
thomasraoux [Thu, 24 Jun 2021 22:42:28 +0000 (15:42 -0700)]
[mlir][VectorToGPU] Add conversion for scf::For op with Matrix operands

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

3 years ago[mlir][VectorToGPU] Add conversion for splat constant to MMA const matrix
thomasraoux [Thu, 24 Jun 2021 22:29:49 +0000 (15:29 -0700)]
[mlir][VectorToGPU] Add conversion for splat constant to MMA const matrix

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

3 years agoDisable check_qmemtags unit tests
Muhammad Omair Javaid [Thu, 24 Jun 2021 22:30:06 +0000 (22:30 +0000)]
Disable check_qmemtags unit tests

check_qmemtags tests are broken on Arm 32 bits. This patch disables
these tests.

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

3 years ago[ELF] Fix .rela.llvm.call-graph-profile detection after D104080
Fangrui Song [Thu, 24 Jun 2021 22:21:28 +0000 (15:21 -0700)]
[ELF] Fix .rela.llvm.call-graph-profile detection after D104080

A SHT_SYMTAB section's sh_info is the number of local symbols.
sh_info may coincide with the section header index of SHT_LLVM_CALL_GRAPH_PROFILE.

3 years agoFix typo in TestMemoryTag.py
Muhammad Omair Javaid [Thu, 24 Jun 2021 22:17:50 +0000 (22:17 +0000)]
Fix typo in TestMemoryTag.py

TestMemoryTag.py should fail if underlying target doesnt support MTE.

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

3 years ago[OptTable] Rename PrintHelp to printHelp
Fangrui Song [Thu, 24 Jun 2021 21:47:03 +0000 (14:47 -0700)]
[OptTable] Rename PrintHelp to printHelp

To be consistent with other member functions and match the coding standard.

3 years ago[LLDB] Fix broken LLDB build due MemoryTagManager.h
Muhammad Omair Javaid [Thu, 24 Jun 2021 21:35:10 +0000 (02:35 +0500)]
[LLDB] Fix broken LLDB build due MemoryTagManager.h

Commit e0f2744a115c41e8d295b93dd74b39535c852390 broke LLDB build.
This patch fixes the build. Tested on Arm/AArch64 Linux.

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

3 years ago[ADT] Complete the StringRef case insensitive method renaming
Martin Storsjö [Wed, 23 Jun 2021 20:22:25 +0000 (23:22 +0300)]
[ADT] Complete the StringRef case insensitive method renaming

Remove the old name for the methods. These were only left behind to
ease the transition for downstreams.

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

3 years ago[mlir] Rename StringRef _lower() method calls to _insensitive()
Martin Storsjö [Thu, 24 Jun 2021 08:06:49 +0000 (11:06 +0300)]
[mlir] Rename StringRef _lower() method calls to _insensitive()

3 years ago[lldb] Rename StringRef _lower() method calls to _insensitive()
Martin Storsjö [Thu, 24 Jun 2021 08:06:42 +0000 (11:06 +0300)]
[lldb] Rename StringRef _lower() method calls to _insensitive()

3 years ago[lld] Rename StringRef _lower() method calls to _insensitive()
Martin Storsjö [Thu, 24 Jun 2021 08:06:35 +0000 (11:06 +0300)]
[lld] Rename StringRef _lower() method calls to _insensitive()

3 years ago[clang-tools-extra] Rename StringRef _lower() method calls to _insensitive()
Martin Storsjö [Thu, 24 Jun 2021 08:04:01 +0000 (11:04 +0300)]
[clang-tools-extra] Rename StringRef _lower() method calls to _insensitive()

3 years ago[clang] Rename StringRef _lower() method calls to _insensitive()
Martin Storsjö [Wed, 23 Jun 2021 11:52:36 +0000 (14:52 +0300)]
[clang] Rename StringRef _lower() method calls to _insensitive()

This is mostly a mechanical change, but a testcase that contains
parts of the StringRef class (clang/test/Analysis/llvm-conventions.cpp)
isn't touched.

3 years ago[llvm] Rename StringRef _lower() method calls to _insensitive()
Martin Storsjö [Wed, 23 Jun 2021 11:52:36 +0000 (14:52 +0300)]
[llvm] Rename StringRef _lower() method calls to _insensitive()

This is a mechanical change. This actually also renames the
similarly named methods in the SmallString class, however these
methods don't seem to be used outside of the llvm subproject, so
this doesn't break building of the rest of the monorepo.

3 years ago[ADT] Rename StringRef case insensitive methods for clarity
Martin Storsjö [Wed, 23 Jun 2021 11:52:36 +0000 (14:52 +0300)]
[ADT] Rename StringRef case insensitive methods for clarity

Rename functions with the `xx_lower()` names to `xx_insensitive()`.
This was requested during the review of D104218.

Test names and variables in llvm/unittests/ADT/StringRefTest.cpp
that refer to "lower" are renamed to "insensitive" correspondingly.

Unused function aliases with the former method names are left
in place (without any deprecation attributes) for transition purposes.

All references within the monorepo will be changed (with essentially
mechanical changes), and then the old names will be removed in a
later commit.

Also remove the superfluous method names at the start of doxygen
comments, for the methods that are touched here. (There are more
occurrances of this left in other methods though.) Also remove
duplicate doxygen comments from the implementation file.

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

3 years ago[Hexagon] Opaquify pointer usage in GEP commoning
Krzysztof Parzyszek [Thu, 24 Jun 2021 15:50:06 +0000 (10:50 -0500)]
[Hexagon] Opaquify pointer usage in GEP commoning

3 years ago[LangRef] clarify the meaning of noimplicitfloat
Bob Haarman [Thu, 10 Jun 2021 19:03:16 +0000 (12:03 -0700)]
[LangRef] clarify the meaning of noimplicitfloat

Adds some more text to the documentation for the noimplicitfloat
function attribute. Hopefully, this makes it clearer what
qualifies an implicit vs. explicit float, without becoming overly
long or going into target-specific details.

Reviewed By: rnk, craig.topper

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

3 years ago[lld-macho] Align all cstrings to 16 bytes when deduplicating
Jez Ng [Thu, 24 Jun 2021 20:22:49 +0000 (16:22 -0400)]
[lld-macho] Align all cstrings to 16 bytes when deduplicating

We previously did this only for x86_64, but it turns out that
arm64 needs this too -- see PR50791.

Ultimately this is a hack, and we should avoid over-aligning strings
that don't need it. I'm just having a hard time figuring out how ld64 is
determining the right alignment.

No new test for this since we were already testing this behavior for
x86_64, and extending it to arm64 seems too trivial.

Reviewed By: #lld-macho, thakis

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

3 years ago[Polly][ScopInliner] Indicate if the IR has changed.
Michael Kruse [Thu, 24 Jun 2021 20:17:21 +0000 (15:17 -0500)]
[Polly][ScopInliner] Indicate if the IR has changed.

Return true to indicate that the IR has changed if the nested pass
manager has changed it.

Fixes the ScopInliner tests in the LLVM_ENABLE_EXPENSIVE_CHECKS=ON
configuration.

Thanks to Alexandre Ganea for reporting.

3 years ago[compiler-rt][test] fix zero_page_pc on arm64e
Emily Shi [Thu, 24 Jun 2021 01:11:51 +0000 (18:11 -0700)]
[compiler-rt][test] fix zero_page_pc on arm64e

on arm64e, pointer auth would catch this access violation before asan.
sign the function pointer so pointer auth will ignore this violation and let asan catch it in this test case.

rdar://79652167

Reviewed By: delcypher

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

3 years ago[InstCombine] Make indexed compare fold opaque ptr compatible
Nikita Popov [Thu, 24 Jun 2021 20:31:06 +0000 (22:31 +0200)]
[InstCombine] Make indexed compare fold opaque ptr compatible

Rather than relying on pointer type equality (which, for a change,
is silently incorrect with opaque pointers) check that the GEP
source element types match.

3 years ago[OpaquePtr] Introduce option to force all pointers to be opaque pointers
Arthur Eubanks [Thu, 24 Jun 2021 15:21:24 +0000 (08:21 -0700)]
[OpaquePtr] Introduce option to force all pointers to be opaque pointers

We don't want to start updating tests to use opaque pointers until we're
close to the opaque pointer transition. However, before the transition
we want to run tests as if pointers are opaque pointers to see if there
are any crashes.

At some point when we have a flag to only create opaque pointers in the
bitcode and textual IR readers, and when we have fixed all places that
try to read a pointee type, this flag will be useless. However, until
then, this can help us find issues more easily.

Since the cl::opt is read into LLVMContext, we need to make sure
LLVMContext is created after cl::ParseCommandLineOptions().

Previously ValueEnumerator would visit the value types of global values
via the pointer type, but with opaque pointers we have to manually visit
the value type.

Reviewed By: nikic, dexonsmith

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

3 years ago[WPD] Don't optimize calls more than once
Arthur Eubanks [Wed, 23 Jun 2021 01:53:12 +0000 (18:53 -0700)]
[WPD] Don't optimize calls more than once

WPD currently assumes that there is a one to one correspondence between
type test assume sequences and virtual calls. However, with
-fstrict-vtable-pointers this may not be true. This ends up causing
crashes when we try to optimize a virtual call more than once (
applyUniformRetValOpt()/applyUniqueRetValOpt()/applyVirtualConstProp()/applySingleImplDevirt()).

applySingleImplDevirt() actually didn't previous crash because it would
replace the devirtualized call with the same direct call. Adding an
assert that the call is indirect causes the corresponding test to crash
with the rest of the patch.

This makes Chrome successfully build with -fstrict-vtable-pointers + WPD.

Reviewed By: tejohnson

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

3 years ago[Clang-Format] Add ReferenceAlignment directive
Seraphime Kirkovski [Thu, 24 Jun 2021 19:24:59 +0000 (21:24 +0200)]
[Clang-Format] Add ReferenceAlignment directive

This introduces ReferenceAlignment style option modeled around
PointerAlignment.
Style implementors can specify Left, Right, Middle or Pointer to
follow whatever the PointerAlignment option specifies.

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

3 years ago[PowerPC] Combine 64-bit bswap(load) without LDBRX
Nemanja Ivanovic [Thu, 24 Jun 2021 19:44:17 +0000 (14:44 -0500)]
[PowerPC] Combine 64-bit bswap(load) without LDBRX

When targeting CPUs that don't have LDBRX, we end up producing code that is
very inefficient and large for this common idiom. This patch just
optimizes it two 32-bit LWBRX instructions along with a merge.

This fixes https://bugs.llvm.org/show_bug.cgi?id=49610

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

3 years ago[InstCombine] Make varargs cast transform compatible with opaque ptrs
Nikita Popov [Thu, 24 Jun 2021 19:46:55 +0000 (21:46 +0200)]
[InstCombine] Make varargs cast transform compatible with opaque ptrs

The whole transform can be dropped once we have fully transitioned
to opaque pointers (as it's purpose is to remove no-op pointer
casts). For now, make sure that it handles opaque pointers correctly.

3 years ago[BuildLibCalls/SimplifyLibCalls] Fix attributes on created CallInst instructions.
Jonas Paulsson [Wed, 9 Jun 2021 21:35:22 +0000 (23:35 +0200)]
[BuildLibCalls/SimplifyLibCalls]  Fix attributes on created CallInst instructions.

- When emitting libcalls, do not only pass the calling convention from the
  function prototype but also the attributes.

- Do not pass attributes from e.g. libc memcpy to llvm.memcpy.

Review: Reid Kleckner, Eli Friedman, Arthur Eubanks

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

3 years ago[clang-format][NFC] Fix documentation
Björn Schäpers [Thu, 24 Jun 2021 19:19:14 +0000 (21:19 +0200)]
[clang-format][NFC] Fix documentation

This amends 64cf5eba06bd4f81954253b1e7a10be6fe92403e.

3 years ago[CodeGen] Don't create fake FunctionDecls when generating block/byref
Akira Hatanaka [Thu, 24 Jun 2021 18:45:52 +0000 (11:45 -0700)]
[CodeGen] Don't create fake FunctionDecls when generating block/byref
copy/dispose helper functions

We found out that these fake functions would cause clang to crash if the
changes proposed in https://reviews.llvm.org/D98799 were made.

The original patch was reverted in f681fd927e883301658dcac9a78109ee0aba12a8
because debug locations were missing in the body of the block byref
helper functions. This patch fixes the bug by calling CreateArtificial
after the calls to StartFunction.

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

3 years ago[NFC][Codegen] Autogenerate Thumb2/setjmp_longjmp.ll test
Roman Lebedev [Thu, 24 Jun 2021 18:33:43 +0000 (21:33 +0300)]
[NFC][Codegen] Autogenerate Thumb2/setjmp_longjmp.ll test

3 years ago[AMDGPU] Add gfx1035 target
Aakanksha Patil [Thu, 24 Jun 2021 18:32:41 +0000 (14:32 -0400)]
[AMDGPU] Add gfx1035 target

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

3 years ago[SimplifyCFG] Tail-merging all blocks with `resume` terminator
Roman Lebedev [Thu, 24 Jun 2021 18:25:06 +0000 (21:25 +0300)]
[SimplifyCFG] Tail-merging all blocks with `resume` terminator

Similar to what we already do for `ret` terminators.
As noted by @rnk, clang seems to already generate a single `ret`/`resume`,
so this isn't likely to cause widespread changes.

Reviewed By: rnk

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

3 years ago[libcxx][nfc] Update the synopsis comment in <ranges> to include drop_view.
zoecarver [Thu, 24 Jun 2021 18:05:50 +0000 (11:05 -0700)]
[libcxx][nfc] Update the synopsis comment in <ranges> to include drop_view.

3 years ago[libcxx][ranges] Enable borrowed range for drop view when T has borrowing enabled.
zoecarver [Thu, 24 Jun 2021 18:05:14 +0000 (11:05 -0700)]
[libcxx][ranges] Enable borrowed range for drop view when T has borrowing enabled.

3 years ago[gn build] Port 6adbc83ee9e4
LLVM GN Syncbot [Thu, 24 Jun 2021 18:02:44 +0000 (18:02 +0000)]
[gn build] Port 6adbc83ee9e4

3 years ago[libcxx][modularisation] moves <utility> content out of <type_traits>
Christopher Di Bella [Sat, 5 Jun 2021 02:47:47 +0000 (02:47 +0000)]
[libcxx][modularisation] moves <utility> content out of <type_traits>

Moves:

* `std::move`, `std::forward`, `std::declval`, and `std::swap` into
  `__utility/${FUNCTION_NAME}`.
* `std::swap_ranges` and `std::iter_swap` into
  `__algorithm/${FUNCTION_NAME}`

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

3 years ago[libcxx][NFC] removes `swap`'s dependency on `swap_ranges`
Christopher Di Bella [Wed, 23 Jun 2021 01:25:31 +0000 (01:25 +0000)]
[libcxx][NFC] removes `swap`'s dependency on `swap_ranges`

Under the as-if rule, we can directly implement the array overload for
`std::swap`. By removing this circular dependency where `swap` is
implemented in terms of `swap_ranges` and `swap_ranges` is defined in
terms of `swap`, we can split them into their own headers. This will:

* limit the surface area in which Hyrum's law can bite us;
* force users to include the correct headers;
* make finding the definitions trivial (`swap` is a utility;
  `swap_ranges` is an algorithm).

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

3 years agoAttempt to disable MLIR JIT tests on PowerPC to unbreak the bot
Mehdi Amini [Thu, 24 Jun 2021 17:47:50 +0000 (17:47 +0000)]
Attempt to disable MLIR JIT tests on PowerPC to unbreak the bot

This is until we figure how to turn on the large code size model.

3 years ago[libcxx][nfc] Add one more test case for contiguous_range.
zoecarver [Thu, 24 Jun 2021 17:45:25 +0000 (10:45 -0700)]
[libcxx][nfc] Add one more test case for contiguous_range.

If the `data` member function is different enough, `ranges::data` won't pick it, so the range remains a contiguous_range.

3 years ago[libcxx][ranges] Add contiguous_range.
zoecarver [Mon, 14 Jun 2021 20:08:15 +0000 (16:08 -0400)]
[libcxx][ranges] Add contiguous_range.

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

3 years ago[NFC][SimplifyCFG] Revisit tail-merge-resume.ll test
Roman Lebedev [Thu, 24 Jun 2021 17:31:28 +0000 (20:31 +0300)]
[NFC][SimplifyCFG] Revisit tail-merge-resume.ll test

Add an already somewhat-common resume block

3 years ago[AArch64][v8.3A] Avoid inserting implicit landing pads (PACI*SP)
Pablo Barrio [Tue, 15 Jun 2021 14:04:15 +0000 (15:04 +0100)]
[AArch64][v8.3A] Avoid inserting implicit landing pads (PACI*SP)

PACI*SP have the advantage that they are in HINT space, meaning
they can be run successfully in hardware without PAuth support -
they will just behave as a NOP. However, PACI*SP are also implicit
landing pads (think of an extra BTI jc). Therefore, they allow
indirect jumps of all kinds into them, potentially inserting new
gadgets. This patch replaces PACI*SP by PACI* LR, SP when
compiling explicitly for hardware with full PAuth support. PACI*
is not in the HINT space, therefore it will fault when run in
hardware without PAuth support, but it is also not a landing pad,
making programs safer in newer HW.

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

3 years ago[InstSimplify] move extract with undef index fold; NFC
Sanjay Patel [Thu, 24 Jun 2021 17:19:07 +0000 (13:19 -0400)]
[InstSimplify] move extract with undef index fold; NFC

This puts it closer to the other undef query check and
will avoid a potential ordering problem if we allow
folding non-constant-int indexes.

3 years agoPrecommit tests for context senstive attribute dropping
Anna Thomas [Thu, 24 Jun 2021 17:09:40 +0000 (13:09 -0400)]
Precommit tests for context senstive attribute dropping

Precommit tests from D104641.
The patch will fix the callsites by dropping the context-sensitive
attributes.

Reviewed-By: Self
3 years ago[MLIR][SCF] Inline single block ExecuteRegionOp
William S. Moses [Thu, 24 Jun 2021 16:33:54 +0000 (12:33 -0400)]
[MLIR][SCF] Inline single block ExecuteRegionOp

This commit adds a canonicalization pass which inlines any single block execute region

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

3 years ago[InstSimplify][test] add test for extract of splat; NFC
Sanjay Patel [Thu, 24 Jun 2021 16:51:45 +0000 (12:51 -0400)]
[InstSimplify][test] add test for extract of splat; NFC

This is shown in:
https://llvm.org/PR50817

3 years ago[InstSimplify][test] move tests that don't require InstCombine; NFC
Sanjay Patel [Thu, 24 Jun 2021 16:44:41 +0000 (12:44 -0400)]
[InstSimplify][test] move tests that don't require InstCombine; NFC

These are existing/missing simplifications, so the tests
don't need the full power of InstCombine.

3 years ago[TargetLowering][ARM] Don't alter opaque constants in TargetLowering::ShrinkDemandedC...
Craig Topper [Thu, 24 Jun 2021 16:08:57 +0000 (09:08 -0700)]
[TargetLowering][ARM] Don't alter opaque constants in TargetLowering::ShrinkDemandedConstant.

We don't constant fold based on demanded bits elsewhere in
SimplifyDemandedBits, so I don't think we should shrink them either.

The affected ARM test changes because a constant become non-opaque
and eventually enabled some constant folding. This no longer happens.
I checked and InstCombine is able to simplify this test. I'm not sure exactly
what it was trying to test.

Reviewed By: lebedev.ri, dmgreen

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

3 years ago[CMake] Don't LTO optimize targets on Darwin either
Petr Hosek [Fri, 21 May 2021 06:58:07 +0000 (23:58 -0700)]
[CMake] Don't LTO optimize targets on Darwin either

This is a follow up to D102732 which also expands the logic to Darwin.

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

3 years ago[AsmParser][SystemZ][z/OS] Support for emitting labels in upper case
Anirudh Prasad [Thu, 24 Jun 2021 16:49:38 +0000 (12:49 -0400)]
[AsmParser][SystemZ][z/OS] Support for emitting labels in upper case

- Currently, the emitting of labels in the parsePrimaryExpr function is case independent. It just takes the identifier and emits it.
- However, for HLASM the emitting of labels is case independent. We are emitting them in the upper case only, to enforce case independency. So we need to ensure that at the time of parsing the label we are emitting the upper case (in `parseAsHLASMLabel`), but also, when we are processing a PC-relative relocatable expression, we need to ensure we emit it in upper case (in `parsePrimaryExpr`)
- To achieve this a new MCAsmInfo attribute has been introduced which corresponding targets can override if needed.

Reviewed By: abhina.sreeskantharajan, uweigand

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

3 years agoUpdate Bazel build for 929189a499
Geoffrey Martin-Noble [Thu, 24 Jun 2021 16:42:14 +0000 (09:42 -0700)]
Update Bazel build for 929189a499

Updates Bazel build files to match
https://github.com/llvm/llvm-project/commit/929189a499

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

3 years ago[lldb][AArch64] Add "memory tag read" command
David Spickett [Fri, 19 Feb 2021 16:31:46 +0000 (16:31 +0000)]
[lldb][AArch64] Add "memory tag read" command

This new command looks much like "memory read"
and mirrors its basic behaviour.

(lldb) memory tag read new_buf_ptr new_buf_ptr+32
Logical tag: 0x9
Allocation tags:
[0x900fffff7ffa000, 0x900fffff7ffa010): 0x9
[0x900fffff7ffa010, 0x900fffff7ffa020): 0x0

Important proprties:
* The end address is optional and defaults to reading
  1 tag if ommitted
* It is an error to try to read tags if the architecture
  or process doesn't support it, or if the range asked
  for is not tagged.
* It is an error to read an inverted range (end < begin)
  (logical tags are removed for this check so you can
  pass tagged addresses here)
* The range will be expanded to fit the tagging granule,
  so you can get more tags than simply (end-begin)/granule size.
  Whatever you get back will always cover the original range.

Reviewed By: omjavaid

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

3 years ago[mlir] remove repeated use of TypeToLLVM.cpp in cmake targets
Alex Zinenko [Thu, 24 Jun 2021 16:34:49 +0000 (18:34 +0200)]
[mlir] remove repeated use of TypeToLLVM.cpp in cmake targets

3 years ago[lldb][AArch64] Add MTE memory tag reading to lldb
David Spickett [Fri, 19 Feb 2021 15:57:29 +0000 (15:57 +0000)]
[lldb][AArch64] Add MTE memory tag reading to lldb

This adds GDB client support for the qMemTags packet
which reads memory tags. Following the design
which was recently committed to GDB.

https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets
(look for qMemTags)

lldb commands will use the new Process methods
GetMemoryTagManager and ReadMemoryTags.

The former takes a range and checks that:
* The current process architecture has an architecture plugin
* That plugin provides a MemoryTagManager
* That the range of memory requested lies in a tagged range
  (it will expand it to granules for you)

If all that was true you get a MemoryTagManager you
can give to ReadMemoryTags.

This two step process is done to allow commands to get the
tag manager without having to read tags as well. For example
you might just want to remove a logical tag, or error early
if a range with tagged addresses is inverted.

Note that getting a MemoryTagManager doesn't mean that the process
or a specific memory range is tagged. Those are seperate checks.
Having a tag manager just means this architecture *could* have
a tagging feature enabled.

An architecture plugin has been added for AArch64 which
will return a MemoryTagManagerAArch64MTE, which was added in a
previous patch.

Reviewed By: omjavaid

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

3 years ago[LLD][LLVM] CG Graph profile using relocations
Alexander Yermolovich [Thu, 24 Jun 2021 15:02:45 +0000 (08:02 -0700)]
[LLD][LLVM] CG Graph profile using relocations

Currently when .llvm.call-graph-profile is created by llvm it explicitly encodes the symbol indices. This section is basically a black box for post processing tools. For example, if we run strip -s on the object files the symbol table changes, but indices in that section do not. In non-visible behavior indices point to wrong symbols. The visible behavior indices point outside of Symbol table: "invalid symbol index".

This patch changes the format by using R_*_NONE relocations to indicate the from/to symbols. The Frequency (Weight) will still be in the .llvm.call-graph-profile, but symbol information will be in relocation section. In LLD information from both sections is used to reconstruct call graph profile. Relocations themselves will never be applied.

With this approach post processing tools that handle relocations correctly work for this section also. Tools can add/remove symbols and as long as they handle relocation sections with this approach information stays correct.

Doing a quick experiment with clang-13.
The size went up from 107KB to 322KB, aggregate of all the input sections. Size of clang-13 binary is ~118MB. For users of -fprofile-use/-fprofile-sample-use the size of object files will go up slightly, it will not impact final binary size.

Reviewed By: jhenderson, MaskRay

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

3 years ago[MLIR][LLVM] Expose type translator from LLVM to MLIR Type
William S. Moses [Tue, 22 Jun 2021 17:57:04 +0000 (13:57 -0400)]
[MLIR][LLVM] Expose type translator from LLVM to MLIR Type

This commit moves the type translator from LLVM to MLIR to a public header for use by external projects or other code.

Unlike a previous attempt (https://reviews.llvm.org/D104726), this patch moves the type conversion into separate files which remedies the linker error which was only caught by CI.

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

3 years ago[lldb][AArch64] Add memory tag reading to lldb-server
David Spickett [Fri, 19 Feb 2021 15:57:59 +0000 (15:57 +0000)]
[lldb][AArch64] Add memory tag reading to lldb-server

This adds memory tag reading using the new "qMemTags"
packet and ptrace on AArch64 Linux.

This new packet is following the one used by GDB.
(https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html)

On AArch64 Linux we use ptrace's PEEKMTETAGS to read
tags and we assume that lldb has already checked that the
memory region actually has tagging enabled.

We do not assume that lldb has expanded the requested range
to granules and expand it again to be sure.
(although lldb will be sending aligned ranges because it happens
to need them client side anyway)
Also we don't assume untagged addresses. So for AArch64 we'll
remove the top byte before using them. (the top byte includes
MTE and other non address data)

To do the ptrace read NativeProcessLinux will ask the native
register context for a memory tag manager based on the
type in the packet. This also gives you the ptrace numbers you need.
(it's called a register context but it also has non register data,
so it saves adding another per platform sub class)

The only supported platform for this is AArch64 Linux and the only
supported tag type is MTE allocation tags. Anything else will
error.

Ptrace can return a partial result but for lldb-server we will
be treating that as an error. To succeed we need to get all the tags
we expect.

(Note that the protocol leaves room for logical tags to be
read via qMemTags but this is not going to be implemented for lldb
at this time.)

Reviewed By: omjavaid

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

3 years ago[VPlan] Fix indentation of check lines in sinking test (NFC).
Florian Hahn [Thu, 24 Jun 2021 15:38:33 +0000 (16:38 +0100)]
[VPlan] Fix indentation of check lines in sinking test (NFC).

3 years ago[gn build] Fix a comment typo and a comment copy-pasto
Nico Weber [Thu, 24 Jun 2021 15:06:15 +0000 (11:06 -0400)]
[gn build] Fix a comment typo and a comment copy-pasto

3 years ago[mlir][Linalg] Add support for scf::ForOp in comprehensive bufferization (7/n)
Nicolas Vasilache [Thu, 24 Jun 2021 14:39:50 +0000 (14:39 +0000)]
[mlir][Linalg] Add support for scf::ForOp in comprehensive bufferization (7/n)

scf::ForOp bufferization analysis proceeds just like for any other op (including FuncOp) at its boundaries; i.e. if:

1. The tensor operand is inplaceable.
2. The matching result has no subsequent read (i.e. all reads dominate the scf::ForOp).
3. In  and does not create a RAW interference.

then it can bufferize inplace.

Still there are a few differences:

1. bbArgs for an scf::ForOp are always considered inplaceable when seen from ops inside the body. This is because a) either the matching tensor operand is not inplaceable and an alloc will be inserted (which makes bbArg itself inplaceable); or b) the tensor operand and bbArg are both already inplaceable.
2. Bufferization within the scf::ForOp body has implications to the outside world : the scf.yield terminator may well ping-pong values of the same type. This muddies the water for alias analysis and is not supported atm. Such cases result in a pass failure.

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

3 years ago[AArch64] Precommit extending load tests for D104782. NFC.
Sjoerd Meijer [Wed, 23 Jun 2021 12:40:46 +0000 (13:40 +0100)]
[AArch64] Precommit extending load tests for D104782. NFC.

3 years ago[lldb][AArch64] Fix unpack tags test case
David Spickett [Thu, 24 Jun 2021 14:52:02 +0000 (15:52 +0100)]
[lldb][AArch64] Fix unpack tags test case

Use %zu to print size_t vars.

3 years agoAdd documentation for compound assignment and type conversion of matrix types
Saurabh Jha [Wed, 23 Jun 2021 14:47:01 +0000 (15:47 +0100)]
Add documentation for compound assignment and type conversion of matrix types

3 years ago[lldb][AArch64] Add memory-tagging qSupported feature
David Spickett [Fri, 19 Feb 2021 15:32:09 +0000 (15:32 +0000)]
[lldb][AArch64] Add memory-tagging qSupported feature

This feature "memory-tagging+" indicates that lldb-server
supports memory tagging packets. (added in a later patch)

We check HWCAP2_MTE to decide whether to enable this
feature for Linux.

Reviewed By: omjavaid

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

3 years ago[gn build] Remove an unneeded -I flag
Nico Weber [Thu, 24 Jun 2021 14:17:13 +0000 (10:17 -0400)]
[gn build] Remove an unneeded -I flag

Everything includes clang/Config/config.h by qualified "clang/Config/config.h"
path, so there's no need for `-Igen/clang/include/clang/Config/clang/include`.

No behavior change.

3 years ago[mlir][linalg][python] Add shape-only tensor support to OpDSL.
Tobias Gysi [Thu, 24 Jun 2021 13:45:18 +0000 (13:45 +0000)]
[mlir][linalg][python] Add shape-only tensor support to OpDSL.

Add an index_dim annotation to specify the shape to loop mapping of shape-only tensors. A shape-only tensor serves is not accessed withing the body of the operation but is required to span the iteration space of certain operations such as pooling.

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

3 years ago[lldb][AArch64] Add class for managing memory tags
David Spickett [Fri, 19 Feb 2021 13:37:37 +0000 (13:37 +0000)]
[lldb][AArch64] Add class for managing memory tags

This adds the MemoryTagManager class and a specialisation
of that class for AArch64 MTE tags. It provides a generic
interface for various tagging operations.
Adding/removing tags, diffing tagged pointers, etc.

Later patches will use this manager to handle memory tags
in generic code in both lldb and lldb-server.
Since it will be used in both, the base class header is in
lldb/Target.
(MemoryRegionInfo is another example of this pattern)

Reviewed By: omjavaid

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

3 years ago[GlobalISel] Describe undefined values for G_SBFX/G_UBFX operands
Brendon Cahoon [Mon, 14 Jun 2021 17:10:50 +0000 (13:10 -0400)]
[GlobalISel] Describe undefined values for G_SBFX/G_UBFX operands

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

3 years ago[LV] Support sinking recipe in replicate region after another region.
Florian Hahn [Thu, 24 Jun 2021 12:55:08 +0000 (13:55 +0100)]
[LV] Support sinking recipe in replicate region after another region.

This patch handles sinking a replicate region after another replicate
region. In that case, we can connect the sink region after the target
region. This properly handles the case for which an assertion has been
added in 337d7652823f.

Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=34842.

Reviewed By: Ayal

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

3 years ago[mlir][linalg][python] Add attribute support to the YAML codegen.
Tobias Gysi [Thu, 24 Jun 2021 09:56:16 +0000 (09:56 +0000)]
[mlir][linalg][python] Add attribute support to the YAML codegen.

Extend the yaml code generation to support the index attributes that https://reviews.llvm.org/D104711 added to the OpDSL.

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

3 years ago[DebugInfo] Enable variadic debug value salvaging
Stephen Tozer [Wed, 23 Jun 2021 14:04:37 +0000 (15:04 +0100)]
[DebugInfo] Enable variadic debug value salvaging

This patch enables the salvaging of debug values that may be calculated
from more than one SSA value, such as with binary operators that do not
use a constant argument. The actual functionality for this behaviour is
added in a previous commit (c7270567), but with the ability to actually
emit the resulting debug values switched off.

The reason for this is that the prior patch has been reverted several
times due to issues discovered downstream, some time after the actual
landing of the patch. The patch in question is rather large and touches
several widely used header files, and all issues discovered are more
related to the handling of variadic debug values as a whole rather than
the details of the patch itself. Therefore, to minimize the build time
impact and risk of conflicts involved in any potential future
revert/reapply of that patch, this significantly smaller patch (that
touches no header files) will instead be used as the capstone to enable
variadic debug value salvaging.

The review linked to this patch is mostly implemented by the previous
commit, c7270567, but also contains the changes in this patch.

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

3 years ago[ARM] Extend narrow values to allow using truncating scatters
David Green [Thu, 24 Jun 2021 12:09:11 +0000 (13:09 +0100)]
[ARM] Extend narrow values to allow using truncating scatters

As a minor adjustment to the existing lowering of offset scatters, this
extends any smaller-than-legal vectors into full vectors using a zext,
so that the truncating scatters can be used. Due to the way MVE
legalizes the vectors this should be cheap in most situations, and will
prevent the vector from being scalarized.

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

3 years ago[NFC][SimplifyCFG] Add basic test for tail-merging `resume` function terminators
Roman Lebedev [Thu, 24 Jun 2021 12:08:20 +0000 (15:08 +0300)]
[NFC][SimplifyCFG] Add basic test for tail-merging `resume` function terminators

3 years ago[MCA] Allow unlimited cycles in the timeline view
Jay Foad [Thu, 24 Jun 2021 10:00:13 +0000 (11:00 +0100)]
[MCA] Allow unlimited cycles in the timeline view

Change --max-timeline-cycles=0 to mean no limit on the number of cycles.
Use this in AMDGPU tests to show all instructions in the timeline view
instead of having it arbitrarily truncated.

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

3 years ago[X86] Exclude invalid element types for bitcast/broadcast folding.
Florian Hahn [Thu, 24 Jun 2021 11:24:04 +0000 (12:24 +0100)]
[X86] Exclude invalid element types for bitcast/broadcast folding.

It looks like the fold introduced in 63f3383ece25efa can cause crashes
if the type of the bitcasted value is not a valid vector element type,
like x86_mmx.

To resolve the crash, reject invalid vector element types. The way it is
done in the patch is a bit clunky. Perhaps there's a better way to
check?

Reviewed By: RKSimon

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

3 years ago[SCEV] Generalize MatchBinaryAddToConst to support non-add expressions.
Florian Hahn [Thu, 24 Jun 2021 09:00:27 +0000 (10:00 +0100)]
[SCEV] Generalize MatchBinaryAddToConst to support non-add expressions.

This patch generalizes MatchBinaryAddToConst to support matching
(A + C1), (A + C2), instead of just matching (A + C1), A.

The existing cases can be handled by treating non-add expressions A as
A + 0.

Reviewed By: mkazantsev

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

3 years ago[CostModel][AArch64] Improve cost model for vector reduction intrinsics
Rosie Sumpter [Tue, 15 Jun 2021 09:29:27 +0000 (10:29 +0100)]
[CostModel][AArch64] Improve cost model for vector reduction intrinsics

OR, XOR and AND entries are added to the cost table. An extra cost
is added when vector splitting occurs.

This is done to address the issue of a missed SLP vectorization
opportunity due to unreasonably high costs being attributed to the vector
Or reduction (see: https://bugs.llvm.org/show_bug.cgi?id=44593).

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

3 years ago[mlir][Linalg] Add basic lowering test to library calls
Nicolas Vasilache [Thu, 24 Jun 2021 06:41:07 +0000 (06:41 +0000)]
[mlir][Linalg] Add basic lowering test to library calls

This test shows how convert-linalg-to-std rewrites named linalg ops as library calls.
This can be coupled with a C++ shim to connect to existing libraries such as https://gist.github.com/nicolasvasilache/691ef992404c49dc9b5d543c4aa6db38.
Everything can then be linked together with mlir-cpu-runner and MLIR can call C++ (which can itself call MLIR if needed).

This should evolve into specific rewrite patterns that can be applied on op instances independently rather than having to use a full conversion.

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

3 years ago[Clang] XFAIL sanitize-coverage-old-pm.c on 32bit Armv8l
Muhammad Omair Javaid [Thu, 24 Jun 2021 10:46:41 +0000 (15:46 +0500)]
[Clang] XFAIL sanitize-coverage-old-pm.c on 32bit Armv8l

sanitize-coverage-old-pm.c started failing on arm 32 bit where
underlying architecture reported is armv8l fore 32bit arm.
This patch XFAILS sanitize-coverage-old-pm.c on armv8l similar
to armv7 and thumbv7.

3 years ago[X86] Fold nested select_cc to select (cmp*ge/le Cond0, Cond1), LHS, Y)
Simon Pilgrim [Thu, 24 Jun 2021 10:15:44 +0000 (11:15 +0100)]
[X86] Fold nested select_cc to select (cmp*ge/le Cond0, Cond1), LHS, Y)

select (cmpeq Cond0, Cond1), LHS, (select (cmpugt Cond0, Cond1), LHS, Y) --> (select (cmpuge Cond0, Cond1), LHS, Y)
etc,

We already perform this fold in DAGCombiner for MVT::i1 comparison results, but these can still appear after legalization (in x86 case with MVT::i8 results), where we need to be more careful about generating new comparison codes.

Pulled out of D101074 to help address the remaining regressions.

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

3 years ago[GlobalISel] NFC: Change LLT::vector to take ElementCount.
Sander de Smalen [Thu, 24 Jun 2021 08:58:21 +0000 (09:58 +0100)]
[GlobalISel] NFC: Change LLT::vector to take ElementCount.

This also adds new interfaces for the fixed- and scalable case:
* LLT::fixed_vector
* LLT::scalable_vector

The strategy for migrating to the new interfaces was as follows:
* If the new LLT is a (modified) clone of another LLT, taking the
  same number of elements, then use LLT::vector(OtherTy.getElementCount())
  or if the number of elements is halfed/doubled, it uses .divideCoefficientBy(2)
  or operator*. That is because there is no reason to specifically restrict
  the types to 'fixed_vector'.
* If the algorithm works on the number of elements (as unsigned), then
  just use fixed_vector. This will need to be fixed up in the future when
  modifying the algorithm to also work for scalable vectors, and will need
  then need additional tests to confirm the behaviour works the same for
  scalable vectors.
* If the test used the '/*Scalable=*/true` flag of LLT::vector, then
  this is replaced by LLT::scalable_vector.

Reviewed By: aemerson

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

3 years ago[SimplifyCFG] Tail-merging all blocks with `ret` terminator
Roman Lebedev [Thu, 24 Jun 2021 10:15:39 +0000 (13:15 +0300)]
[SimplifyCFG] Tail-merging all blocks with `ret` terminator

Based ontop of D104598, which is a NFCI-ish refactoring.
Here, a restriction, that only empty blocks can be merged, is lifted.

Reviewed By: rnk

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

3 years ago[NFC][AArch64] Un-autogenerate swifterror.ll tests
Roman Lebedev [Thu, 24 Jun 2021 09:50:41 +0000 (12:50 +0300)]
[NFC][AArch64] Un-autogenerate swifterror.ll tests

It appears the change needed in D104597 is minimal and obvious,
so let's not make them so verbose.

3 years ago[mlir][linalg][python] Add attribute support to the OpDSL.
Tobias Gysi [Thu, 24 Jun 2021 09:21:12 +0000 (09:21 +0000)]
[mlir][linalg][python] Add attribute support to the OpDSL.

Extend the OpDSL with index attributes. After tensors and scalars, index attributes are the third operand type. An index attribute represents a compile-time constant that is limited to index expressions. A use cases are the strides and dilations defined by convolution and pooling operations.

The patch only updates the OpDSL. The C++ yaml codegen is updated by a followup patch.

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

3 years ago[analyzer] Added a test case for PR46264
Denys Petrov [Wed, 16 Jun 2021 13:44:36 +0000 (16:44 +0300)]
[analyzer] Added a test case for PR46264

Summary: It's not able to reproduce the issue (https://bugs.llvm.org/show_bug.cgi?id=46264) for the latest sources. Add a reported test case to try to catch the problem if occur es.

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

Prevent: https://bugs.llvm.org/show_bug.cgi?id=46264

3 years ago[RISCV] Lower RVV vector SELECTs to VSELECTs
Fraser Cormack [Wed, 23 Jun 2021 09:11:13 +0000 (10:11 +0100)]
[RISCV] Lower RVV vector SELECTs to VSELECTs

This patch optimizes the code generation of vector-type SELECTs (LLVM
select instructions with scalar conditions) by custom-lowering to
VSELECTs (LLVM select instructions with vector conditions) by splatting
the condition to a vector. This avoids the default expansion path which
would either introduce control flow or fully scalarize.

Reviewed By: craig.topper

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