platform/upstream/llvm.git
3 years ago[lldb] Print the load command that wasn't found in TestSimulatorPlatform
Jonas Devlieghere [Wed, 19 Aug 2020 19:40:53 +0000 (12:40 -0700)]
[lldb] Print the load command that wasn't found in TestSimulatorPlatform

Print which load command we were looking for when the sanity check
fails:

  AssertionError: 0 != 1 : wrong number of load commands for
  LC_VERSION_MIN_MACOSX

3 years ago[PGO][PGSO][LV] Fix loop not vectorized issue under profile guided size opts.
Hiroshi Yamauchi [Tue, 11 Aug 2020 21:10:30 +0000 (14:10 -0700)]
[PGO][PGSO][LV] Fix loop not vectorized issue under profile guided size opts.

D81345 appears to accidentally disables vectorization when explicitly
enabled. As PGSO isn't currently accessible from LoopAccessInfo, revert back to
the vectorization with versioning-for-unit-stride for PGSO.

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

3 years ago[lldb] Code sign binaries with entitlements
Jonas Devlieghere [Wed, 19 Aug 2020 17:19:03 +0000 (10:19 -0700)]
[lldb] Code sign binaries with entitlements

Binaries need to be code signed with entitlements to run on device.

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

3 years ago[CMake] Always mark terminfo as unavailable on Windows
Petr Hosek [Wed, 19 Aug 2020 18:06:19 +0000 (11:06 -0700)]
[CMake] Always mark terminfo as unavailable on Windows

This addresses the issue introduced by D86134.

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

3 years agoGlobalISel: Add TargetLowering member to LegalizerHelper
Matt Arsenault [Fri, 31 Jul 2020 15:41:05 +0000 (11:41 -0400)]
GlobalISel: Add TargetLowering member to LegalizerHelper

3 years ago[lldb] Extend Darwin builder to pass the ARCH_CFLAGS spec to Make.
Jonas Devlieghere [Wed, 19 Aug 2020 01:48:18 +0000 (18:48 -0700)]
[lldb] Extend Darwin builder to pass the ARCH_CFLAGS spec to Make.

Construct the ARCH_CFLAGS in Python rather than in Make by disassembling
the TRIPLE.

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

3 years ago[DSE] Remove dead argument from removePartiallyOverlappedStores (NFC).
Florian Hahn [Wed, 19 Aug 2020 18:32:49 +0000 (19:32 +0100)]
[DSE] Remove dead argument from removePartiallyOverlappedStores (NFC).

The argument is unused and can be removed.

3 years agoAMDGPU: Fix wrong type mangling in intrinsic test
Matt Arsenault [Mon, 17 Aug 2020 12:50:11 +0000 (08:50 -0400)]
AMDGPU: Fix wrong type mangling in intrinsic test

The generic address space used to be 4, but the string here seems to
not matter.

3 years ago[index-while-building] PathIndexer
Jan Korous [Tue, 14 Jul 2020 02:38:58 +0000 (19:38 -0700)]
[index-while-building] PathIndexer

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

3 years agoGlobalISel: Don't check for verifier enforced constraint
Matt Arsenault [Wed, 19 Aug 2020 18:06:17 +0000 (14:06 -0400)]
GlobalISel: Don't check for verifier enforced constraint

Loads are always required to have a single memory operand.

3 years agoAMDGPU/GlobalISel: Remove hack for combines forming illegal extloads
Matt Arsenault [Wed, 19 Aug 2020 17:59:11 +0000 (13:59 -0400)]
AMDGPU/GlobalISel: Remove hack for combines forming illegal extloads

Previously we weren't adding the LegalizerInfo to the post-legalizer
combiner. Since that's fixed, we don't need to try to filter out the
one case that was breaking.

3 years agosanitizer_common: Use void* for madvise first argument on Solaris.
Peter Collingbourne [Tue, 18 Aug 2020 20:06:41 +0000 (13:06 -0700)]
sanitizer_common: Use void* for madvise first argument on Solaris.

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

3 years ago[InstCombine] add tests for shifted xor; NFC
Sanjay Patel [Wed, 19 Aug 2020 16:46:53 +0000 (12:46 -0400)]
[InstCombine] add tests for shifted xor; NFC

3 years agoGlobalISel: Use Register
Matt Arsenault [Wed, 19 Aug 2020 16:10:32 +0000 (12:10 -0400)]
GlobalISel: Use Register

3 years ago[CMake] Fix OCaml build failure because of absolute path in system libs
Petr Hosek [Wed, 19 Aug 2020 17:33:03 +0000 (10:33 -0700)]
[CMake] Fix OCaml build failure because of absolute path in system libs

D85820 introduced a full path in the LLVM_SYSTEM_LIBS property of the
LLVMSupport target, which made the OCaml bindings fail to build, since
they use -l [system_lib] flags for every lib in LLVM_SYSTEM_LIBS, which
cannot work with absolute paths.

This patch solves the issue in a similar vain as ZLIB does it: it adds
the full library path to imported_libs, and adds a stripped down version
without directories, lib prefix and lib suffix to system_libs

In the future we should probably make some changes to LLVM_SYSTEM_LIBS,
since both zlib and ncurses do not necessarily have to be system libs
anymore due to the find_package / find_library bits introduced in
D85820 and D79219.

Patch By: haampie

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

3 years ago[CMake] Don't look for terminfo libs when LLVM_ENABLE_TERMINFO=OFF
Petr Hosek [Wed, 19 Aug 2020 17:30:32 +0000 (10:30 -0700)]
[CMake] Don't look for terminfo libs when LLVM_ENABLE_TERMINFO=OFF

D85820 introduced a bug where LLVM_ENABLE_TERMINFO was set to true when
the library was found, even when the user had set
-DLLVM_ENABLE_TERMINFO=OFF.

Patch By: haampie

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

3 years ago[mlir][VectorToSCF] Fix of broken build - missing link to MLIRLinalgUtils
Jakub Lichman [Wed, 19 Aug 2020 17:28:22 +0000 (17:28 +0000)]
[mlir][VectorToSCF] Fix of broken build - missing link to MLIRLinalgUtils

3 years agoRevert "Revert "[NFC][llvm] Make the contructors of `ElementCount` private.""
Mehdi Amini [Wed, 19 Aug 2020 17:26:36 +0000 (17:26 +0000)]
Revert "Revert "[NFC][llvm] Make the contructors of `ElementCount` private.""

Was reverted because MLIR/Flang builds were broken, these APIs have been
fixed in the meantime.

3 years agoFix flang test after MLIR API changes
Mehdi Amini [Wed, 19 Aug 2020 17:19:49 +0000 (17:19 +0000)]
Fix flang test after MLIR API changes

3 years agoRevert "[NFC][llvm] Make the contructors of `ElementCount` private."
Mehdi Amini [Wed, 19 Aug 2020 17:13:28 +0000 (17:13 +0000)]
Revert "[NFC][llvm] Make the contructors of `ElementCount` private."

This reverts commit 264afb9e6aebc98c353644dd0700bec808501cab.
(and dependent 6b742cc48 and fc53bd610f)

MLIR/Flang are broken.

3 years ago[GlobalISel] Add combine for (x & mask) -> x when (x & mask) == x
Jessica Paquette [Thu, 6 Aug 2020 17:40:46 +0000 (10:40 -0700)]
[GlobalISel] Add combine for (x & mask) -> x when (x & mask) == x

If we have a mask, and a value x, where (x & mask) == x, we can drop the AND
and just use x.

This is about a 0.4% geomean code size improvement on CTMark at -O3 for AArch64.

In AArch64, this is most useful post-legalization. Patterns like this often
show up when legalizing s1s, which must be extended to larger types.

e.g.

```
%cmp:_(s32) = G_ICMP ...
%and:_(s32) = G_AND %cmp, 1
```

Since G_ICMP only produces a single bit, there's no reason to mask it with the
G_AND.

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

3 years ago[Clang] Fix BZ47169, loader_uninitialized on incomplete types
Jon Chesterfield [Wed, 19 Aug 2020 17:11:34 +0000 (18:11 +0100)]
[Clang] Fix BZ47169, loader_uninitialized on incomplete types

[Clang] Fix BZ47169, loader_uninitialized on incomplete types

Reported by @erichkeane. Fix proposed by @erichkeane works, tests included.
Bug introduced in D74361. Crash was on querying a CXXRecordDecl for
hasTrivialDefaultConstructor on an incomplete type. Fixed by calling
RequireCompleteType in the right place.

Reviewed By: erichkeane

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

3 years ago[clang][driver]Add quotation mark in test/fortran.f95 to avoid false positive
Caroline Concatto [Wed, 19 Aug 2020 16:53:29 +0000 (17:53 +0100)]
[clang][driver]Add quotation mark in test/fortran.f95  to avoid false positive

If a folder's name, where the test fortran.f95 is running, has cc1 the test
fails because of  CHECK-ASM-NOT: cc1.
The solution used in this patch is to add quotation mark around cc1 and cc1as
because the driver returns these flags with quotation marks ("")

Reviewed By: DavidTruby, echristo

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

3 years ago[mlir] expose standard attributes to C API
Alex Zinenko [Wed, 19 Aug 2020 16:38:56 +0000 (18:38 +0200)]
[mlir] expose standard attributes to C API

Provide C API for MLIR standard attributes. Since standard attributes live
under lib/IR in core MLIR, place the C APIs in the IR library as well (standard
ops will go in a separate library).

Affine map and integer set attributes are only exposed as placeholder types
with IsA support due to the lack of C APIs for the corresponding types.

Integer and floating point attribute APIs expecting APInt and APFloat are not
exposed pending decision on how to support APInt and APFloat.

Reviewed By: stellaraccident

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

3 years ago[mlir] fix build after llvm made ElementCount constructor private
Alex Zinenko [Wed, 19 Aug 2020 16:46:53 +0000 (18:46 +0200)]
[mlir] fix build after llvm made ElementCount constructor private

The original patch (264afb9e6aebc98c353644dd0700bec808501cab) did not
update subprojects.

3 years ago[lldb] Add getExtraMakeArgs to Builder (NFC)
Jonas Devlieghere [Wed, 19 Aug 2020 16:25:41 +0000 (09:25 -0700)]
[lldb] Add getExtraMakeArgs to Builder (NFC)

Instead of a new method for each variable any subclass might want to
set, have a method getExtraMakeArgs that each subclass can use to return
whatever extra Make arguments it wants.

As per Pavel's suggestion in D85539.

3 years ago[lldb] Fix buildDsym signature in Builder base class
Jonas Devlieghere [Wed, 19 Aug 2020 16:08:40 +0000 (09:08 -0700)]
[lldb] Fix buildDsym signature in Builder base class

The method was missing the optional argument `testname`.

3 years ago[OpenMPOpt][HideMemTransfersLatency] Moving the 'wait' counterpart of __tgt_target_da...
Hamilton Tobon Mosquera [Wed, 19 Aug 2020 16:03:23 +0000 (11:03 -0500)]
[OpenMPOpt][HideMemTransfersLatency] Moving the 'wait' counterpart of __tgt_target_data_begin_mapper

canBeMovedDownwards checks if the "wait" counterpart of __tgt_target_data_begin_mapper can be moved downwards, returning a pointer to the instruction that might require/modify the data transferred, and returning null it the movement is not possible or not worth it. The function splitTargetDataBeginRTC receives that returned instruction and instead of moving the "wait" it creates it at that point.

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

3 years ago[clang] Replace call to private ctor with ElementCount::getScalable (2/2)
Jonas Devlieghere [Wed, 19 Aug 2020 16:39:44 +0000 (09:39 -0700)]
[clang] Replace call to private ctor with ElementCount::getScalable (2/2)

Update the code for D86120 which made the constructors of `ElementCount`
private. Apparently I missed another instance in the macro just below.

3 years ago[docs] Clarify ENABLE_MODULES uses Clang Header Modules.
Florian Hahn [Wed, 19 Aug 2020 16:37:20 +0000 (17:37 +0100)]
[docs] Clarify ENABLE_MODULES uses Clang Header Modules.

Suggested post-commit by @dblaikie, thanks!

3 years ago[clang] Replace call to private ctor with ElementCount::getScalable
Jonas Devlieghere [Wed, 19 Aug 2020 16:34:57 +0000 (09:34 -0700)]
[clang] Replace call to private ctor with ElementCount::getScalable

Update the code for D86120 which made the constructors of `ElementCount`
private.

3 years ago[NFC][llvm] Make the contructors of `ElementCount` private.
Francesco Petrogalli [Mon, 17 Aug 2020 22:48:15 +0000 (22:48 +0000)]
[NFC][llvm] Make the contructors of `ElementCount` private.

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

3 years agoAdd python bindings for Type and IntegerType.
Stella Laurenzo [Wed, 19 Aug 2020 00:23:46 +0000 (17:23 -0700)]
Add python bindings for Type and IntegerType.

* The binding for Type is trivial and should be non-controversial.
* The way that I define the IntegerType should serve as a pattern for what I want to do next.
* I propose defining the rest of the standard types in this fashion and then generalizing for dialect types as necessary.
* Essentially, creating/accessing a concrete Type (vs interacting with the string form) is done by "casting" to the concrete type (i.e. IntegerType can be constructed with a Type and will throw if the cast is illegal).
* This deviates from some of our previous discussions about global objects but I think produces a usable API and we should go this way.

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

3 years ago[InstCombine] avoid 'tmp' names in tests; NFC
Sanjay Patel [Wed, 19 Aug 2020 16:07:28 +0000 (12:07 -0400)]
[InstCombine] avoid 'tmp' names in tests; NFC

They may conflict with update_test_checks.py regexes.

3 years ago[lldb] Move builders under lldbsuite.test as they import lldbtest (NFC)
Jonas Devlieghere [Wed, 19 Aug 2020 16:05:11 +0000 (09:05 -0700)]
[lldb] Move builders under lldbsuite.test as they import lldbtest (NFC)

3 years ago[InstCombine] reduce code duplication; NFC
Sanjay Patel [Wed, 19 Aug 2020 16:04:53 +0000 (12:04 -0400)]
[InstCombine] reduce code duplication; NFC

3 years ago[lldb] Convert builders to use inheritance (NFC)
Jonas Devlieghere [Wed, 19 Aug 2020 15:27:54 +0000 (08:27 -0700)]
[lldb] Convert builders to use inheritance (NFC)

Rather than have different modules for different platforms, use
inheritance so we can have a Builer base class and optional child
classes that override platform specific methods.

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

3 years ago[mlir][VectorToSCF] Bug in TransferRead lowering fixed
Jakub Lichman [Wed, 19 Aug 2020 15:13:19 +0000 (15:13 +0000)]
[mlir][VectorToSCF] Bug in TransferRead lowering fixed

If Memref has rank > 1 this pass emits N-1 loops around
TransferRead op and transforms the op itself to 1D read. Since vectors
must have static shape while memrefs don't the pass emits if condition
to prevent out of bounds accesses in case some memref dimension is smaller
than the corresponding dimension of targeted vector. This logic is fine
but authors forgot to apply `permutation_map` on loops upper bounds and
thus if condition compares induction variable to incorrect loop upper bound
(dimension of the memref) in case `permutation_map` is not identity map.
This commit aims to fix that.

3 years ago[libomptarget][amdgpu] Support building with static rocm libraries
Jon Chesterfield [Wed, 19 Aug 2020 14:44:30 +0000 (15:44 +0100)]
[libomptarget][amdgpu] Support building with static rocm libraries

3 years agoAMDGPU/GlobalISel: Add some bitcast tests
Matt Arsenault [Wed, 19 Aug 2020 14:07:57 +0000 (10:07 -0400)]
AMDGPU/GlobalISel: Add some bitcast tests

3 years ago[NFC] Fix typo in AMDGPU doc
madhur13490 [Wed, 19 Aug 2020 11:18:52 +0000 (11:18 +0000)]
[NFC] Fix typo in AMDGPU doc

Reviewed By: t-tye, arsenm

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

3 years agoAMDGPU/GlobalISel: Add selection tests for pointer constants
Matt Arsenault [Tue, 18 Aug 2020 18:45:05 +0000 (14:45 -0400)]
AMDGPU/GlobalISel: Add selection tests for pointer constants

3 years agoMake helpers static. NFC.
Benjamin Kramer [Wed, 19 Aug 2020 13:59:39 +0000 (15:59 +0200)]
Make helpers static. NFC.

3 years agoRevert "[InstCombine] Lower infinite combine loop detection thresholds"
Roman Lebedev [Wed, 19 Aug 2020 13:52:09 +0000 (16:52 +0300)]
Revert "[InstCombine] Lower infinite combine loop detection thresholds"

And as being reported by Florian Hahn, there's a hit
in MultiSource/Benchmarks/mafft from the test-suite on X86 with -O3 -flto,
so reverting until addressed.

This reverts commit 71e0b82c9f5039cb3987c91075e78733ef044c07.

3 years agoFix MSVC implicit truncation narrowing conversion warning.
Simon Pilgrim [Wed, 19 Aug 2020 13:41:40 +0000 (14:41 +0100)]
Fix MSVC implicit truncation narrowing conversion warning.

3 years ago[X86][AVX] lowerShuffleWithVPMOV - minor refactor to more closely match lowerShuffleA...
Simon Pilgrim [Wed, 19 Aug 2020 13:34:12 +0000 (14:34 +0100)]
[X86][AVX] lowerShuffleWithVPMOV - minor refactor to more closely match lowerShuffleAsVTRUNC

Replace isBuildVectorAllZeros check by using the Zeroable bitmask instead.

3 years agoFix unused variable warnings. NFCI.
Simon Pilgrim [Wed, 19 Aug 2020 13:14:44 +0000 (14:14 +0100)]
Fix unused variable warnings. NFCI.

3 years ago[CodeGen] Use existing EmitLambdaVLACapture (NFC)
Aaron Puchert [Wed, 19 Aug 2020 13:04:44 +0000 (15:04 +0200)]
[CodeGen] Use existing EmitLambdaVLACapture (NFC)

3 years ago[obj2yaml] Refactor the .debug_pub* sections dumper.
Xing GUO [Wed, 19 Aug 2020 13:13:46 +0000 (21:13 +0800)]
[obj2yaml] Refactor the .debug_pub* sections dumper.

It's good to reuse the DWARF parser in lib/DebugInfo so that we don't
need to maintain a separate parser in client side (obj2yaml). Besides,
A test case is added whose length field is a very huge value which makes
obj2yaml stuck when parsing the section.

Reviewed By: jhenderson

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

3 years ago[lldb] Clean up DW_AT_declaration-with-children.s test
Pavel Labath [Wed, 19 Aug 2020 12:58:50 +0000 (14:58 +0200)]
[lldb] Clean up DW_AT_declaration-with-children.s test

Address some post-commit feedback on D85968.

3 years ago[lldb] Add typedefs to the DeclContext they are created in
Pavel Labath [Tue, 18 Aug 2020 13:46:26 +0000 (15:46 +0200)]
[lldb] Add typedefs to the DeclContext they are created in

TypeSystemClang::CreateTypedef was creating a typedef in the right
DeclContext, but it was not actually adding it as a child of the
context. The resulting inconsistent state meant that we would be unable
to reference the typedef from an expression directly, but we could use
them if they end up being pulled in by some previous subexpression
(because the ASTImporter will set up the correct links in the expression
ast).

This patch adds the typedef to the decl context it is created in.

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

3 years ago[X86] lowerShuffleWithVPMOV - remove unnecessary shuffle commutation. NFCI.
Simon Pilgrim [Wed, 19 Aug 2020 12:28:59 +0000 (13:28 +0100)]
[X86] lowerShuffleWithVPMOV - remove unnecessary shuffle commutation. NFCI.

canonicalizeShuffleMaskWithCommute should have already ensured the lower elements are from V1, we do have test coverage for this already.

3 years ago[X86][AVX] getAVX512TruncNode - don't truncate from illegal vector widths.
Simon Pilgrim [Wed, 19 Aug 2020 12:00:09 +0000 (13:00 +0100)]
[X86][AVX] getAVX512TruncNode - don't truncate from illegal vector widths.

Thanks to @fhahn for the test case.

3 years ago[InstCombine] update stale comments in test files; NFC
Sanjay Patel [Wed, 19 Aug 2020 11:40:10 +0000 (07:40 -0400)]
[InstCombine] update stale comments in test files; NFC

I missed updating these with:
rG23bd33c6acc4

3 years ago[InstCombine] Lower infinite combine loop detection thresholds
Roman Lebedev [Wed, 19 Aug 2020 11:36:47 +0000 (14:36 +0300)]
[InstCombine] Lower infinite combine loop detection thresholds

It's been a month since 2f3862eb9f21e8a0d48505637fefe6e5e295c18c,
and no new bug reports about the threshold were filled,
so let's bump it again and wait again.

3 years ago[lldb] Make error messages in TestQueues more helpfull
Raphael Isemann [Wed, 19 Aug 2020 11:30:31 +0000 (13:30 +0200)]
[lldb] Make error messages in TestQueues more helpfull

3 years ago[ARM] Change target triple to arm-none-none-eabi. NFC
David Green [Wed, 19 Aug 2020 10:58:50 +0000 (11:58 +0100)]
[ARM] Change target triple to arm-none-none-eabi. NFC

3 years ago[LLDB] Minor fix in TestSVERegisters.py for AArch64/Linux buildbot
Muhammad Omair Javaid [Wed, 19 Aug 2020 10:47:46 +0000 (15:47 +0500)]
[LLDB] Minor fix in TestSVERegisters.py for AArch64/Linux buildbot

This adds a minor test case fix to previously submitted AArch64 SVE
ptrace support. This was failing on LLDB/AArch64 Linux buildbot.

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

3 years ago[X86][AVX] computeKnownBitsForTargetNode - add VTRUNC/VTRUNCS/VTRUNCUS known zero...
Simon Pilgrim [Wed, 19 Aug 2020 10:39:12 +0000 (11:39 +0100)]
[X86][AVX] computeKnownBitsForTargetNode - add VTRUNC/VTRUNCS/VTRUNCUS known zero upper elements handling.

Like many of the AVX512 conversion ops, the VTRUNC ops guarantee the upper destination elements are zero.

3 years ago[SVE] Add tests for fixed length vector integer operations with immediate operands.
Paul Walker [Tue, 18 Aug 2020 16:47:10 +0000 (17:47 +0100)]
[SVE] Add tests for fixed length vector integer operations with immediate operands.

3 years ago[LLDB] Add ptrace register access for AArch64 SVE registers
Muhammad Omair Javaid [Wed, 19 Aug 2020 07:38:30 +0000 (12:38 +0500)]
[LLDB] Add ptrace register access for AArch64 SVE registers

This patch adds NativeRegisterContext_arm64 ptrace routines to access
AArch64 SVE register set. This patch also adds a test-case to test
AArch64 SVE register access and dynamic size configuration capability.

Reviewed By: labath

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

3 years ago[X86][AVX] Fold store(extract_element(vtrunc)) to truncated store
Simon Pilgrim [Wed, 19 Aug 2020 09:48:22 +0000 (10:48 +0100)]
[X86][AVX] Fold store(extract_element(vtrunc)) to truncated store

Add handling for storing the extracted lower (truncated bits) element from a X86ISD::VTRUNC node - this can be lowered to a generic truncated store directly.

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

3 years ago[Clang][SVE] NFC: Move info about ACLE types into separate function.
Sander de Smalen [Wed, 19 Aug 2020 09:34:25 +0000 (10:34 +0100)]
[Clang][SVE] NFC: Move info about ACLE types into separate function.

This function returns a struct `BuiltinVectorTypeInfo` that contains
the builtin vector's element type, element count and number of vectors
(used for vector tuples).

Reviewed By: c-rhodes

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

3 years ago[GlobalISel] Untabify InstructionSelectorImpl.h. NFC
Bjorn Pettersson [Wed, 19 Aug 2020 09:36:03 +0000 (11:36 +0200)]
[GlobalISel] Untabify InstructionSelectorImpl.h. NFC

3 years ago[OpenMPOpt] ICV tracking for calls
sstefan1 [Wed, 12 Aug 2020 10:20:53 +0000 (12:20 +0200)]
[OpenMPOpt] ICV tracking for calls

Introduce two new AAs. AAICVTrackerFunctionReturned which checks if a
function can have a unique ICV value after it is finished, and
AAICVCallSiteReturned which checks AAICVTrackerFunctionReturned for a
call site. This enables us to check the value of a call and if it
changes the ICV. This also changes the approach in
`getReplacementValues()` to a worklist-based approach so we can explore
all relevant BBs.

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

3 years ago[IR] Intrinsics default attributes and opt-out flag
sstefan1 [Mon, 17 Aug 2020 17:43:55 +0000 (19:43 +0200)]
[IR] Intrinsics default attributes and opt-out flag

Intrinsic properties can now be set to default and applied to all
intrinsics. If the attributes are not needed, the user can opt-out by
setting the DisableDefaultAttributes flag to true.

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

3 years ago[ARM] Enabled VMLAV and Add instructions to use VMLAVA
Meera Nakrani [Wed, 19 Aug 2020 08:36:49 +0000 (08:36 +0000)]
[ARM] Enabled VMLAV and Add instructions to use VMLAVA

Used InstCombine to enable VMLAV and Add instructions to generate VMLAVA instead with tests.

3 years ago[RISCV] add the assemble and disassemble support of Zvlsseg instructions
luxufan [Thu, 23 Jul 2020 05:45:14 +0000 (13:45 +0800)]
[RISCV] add the assemble and disassemble support of Zvlsseg instructions

This implements the assemble and disassemble support of RISCV Vector
extension Zvlsseg instructions, base on the 0.9 spec version.

Reviewed  by HsiangKai

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

3 years ago[utils] Fix regexp in llvm/utils/extract_vplan.py to extract VPlans.
Mauri Mustonen [Wed, 19 Aug 2020 07:54:52 +0000 (08:54 +0100)]
[utils] Fix regexp in llvm/utils/extract_vplan.py to extract VPlans.

Regarding this bug in Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=46451

I went ahead and fixed the regexp pattern and now Python script is able
to extract vplan graphs from the log files. Additionally some test for
this would be nice to have but I'm not sure are Python scripts tested
in LLVM and if so where they live.

Reviewed By: fhahn

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

3 years ago[GlobalISel] Don't skip adding predicate matcher
madhur13490 [Thu, 2 Jul 2020 09:08:06 +0000 (09:08 +0000)]
[GlobalISel] Don't skip adding predicate matcher

This patch fixes a bug which skipped
adding predicate matcher for a pattern in many cases.
For example, if predicate is Load and
its memoryVT is non-null then the loop
continues and never reaches to the end which
adds the predicate matcher. This patch moves the
matcher addition to the top of the loop
so that it gets added regardless of contextual checks
later in the loop.
Other way to fix this issue is to remove all "continue" statements
in checks and let the loop continue till end.

Reviewed By: arsenm

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

3 years ago[DSE,MemorySSA] Use NumRedundantStores instead of NumNoopStores.
Florian Hahn [Wed, 19 Aug 2020 07:47:03 +0000 (08:47 +0100)]
[DSE,MemorySSA] Use NumRedundantStores instead of NumNoopStores.

Legacy DSE uses NumRedundantStores, while MemorySSA DSE uses
NumNoopStores. We should just use the same counter.

3 years agoRevert "[AMDGPU] Support disassembly for AMDGPU kernel descriptors"
Ronak Chauhan [Wed, 19 Aug 2020 07:37:40 +0000 (13:07 +0530)]
Revert "[AMDGPU] Support disassembly for AMDGPU kernel descriptors"

This reverts commit cacfb02d28a3cabd4e45d2535cb0686cef48a2c9.

Reverting due to buildbot failures.

3 years ago[clang] Remove stray semicolons, fixing GCC warnings. NFC.
Martin Storsjö [Wed, 19 Aug 2020 07:40:27 +0000 (10:40 +0300)]
[clang] Remove stray semicolons, fixing GCC warnings. NFC.

3 years ago[LLDB] NativeThreadLinux invalidate register cache on stop
Muhammad Omair Javaid [Wed, 19 Aug 2020 07:29:16 +0000 (12:29 +0500)]
[LLDB] NativeThreadLinux invalidate register cache on stop

In our discussion D79699 SVE ptrace register access support we decide to
invalidate register context cached data on every stop instead of doing
at before Step/Resume.

InvalidateAllRegisters was added to facilitate flushing of SVE register
context configuration and cached register values. It now makes more
sense to move invalidation after every stop where we initiate SVE
configuration update if needed by calling ConfigureRegisterContext.

Reviewed By: labath

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

3 years agoConvert SVE macros into c++ constants and inlines
Muhammad Omair Javaid [Wed, 19 Aug 2020 07:27:02 +0000 (12:27 +0500)]
Convert SVE macros into c++ constants and inlines

This patch updates LLDB's in house version of SVE ptrace/sig macros by
converting them into constants and inlines. They are housed under sve
namespace and are used by process elf-core for reading SVE register data.

Reviewed By: labath

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

3 years ago[AST] Fix a crash on mangling a binding decl from a DeclRefExpr.
Haojian Wu [Wed, 19 Aug 2020 07:04:31 +0000 (09:04 +0200)]
[AST] Fix a crash on mangling a binding decl from a DeclRefExpr.

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

3 years ago[SVE][CodeGen] Fix scalable vector issues in DAGTypeLegalizer::GenWidenVectorLoads
David Sherwood [Wed, 12 Aug 2020 13:16:22 +0000 (14:16 +0100)]
[SVE][CodeGen] Fix scalable vector issues in DAGTypeLegalizer::GenWidenVectorLoads

In DAGTypeLegalizer::GenWidenVectorLoads the algorithm assumes it only
ever deals with fixed width types, hence the offsets for each individual
store never take 'vscale' into account. I've changed the code in that
function to use TypeSize instead of unsigned for tracking the remaining
load amount. In addition, I've changed the load loop to use the new
IncrementPointer helper function for updating the addresses in each
iteration, since this handles scalable vector types.

Also, I've added report_fatal_errors in GenWidenVectorExtLoads,
TargetLowering::scalarizeVectorLoad and TargetLowering::scalarizeVectorStores,
since these functions currently use a sequence of element-by-element
scalar loads/stores. In a similar vein, I've also added a fatal error
report in FindMemType for the case when we decide to return the element
type for a scalable vector type.

I've added new tests in

  CodeGen/AArch64/sve-split-load.ll
  CodeGen/AArch64/sve-ld-addressing-mode-reg-imm.ll

for the changes in GenWidenVectorLoads.

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

3 years ago[X86][Driver] Remove code that forced a core2 mtune from MachO::TranslateArgs.
Craig Topper [Wed, 19 Aug 2020 06:43:15 +0000 (23:43 -0700)]
[X86][Driver] Remove code that forced a core2 mtune from MachO::TranslateArgs.

mtune was previously ignored by the compiler so I'm not sure this
did anything. But after D85384 we're starting to support mtune
and this code is now causing a couple test failures on MacOS.

3 years ago[Attributor][NFC] Add tests to range.ll
Shinji Okumura [Wed, 19 Aug 2020 06:01:14 +0000 (15:01 +0900)]
[Attributor][NFC] Add tests to range.ll

Reviewed By: jdoerfert

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

3 years agoFix test hip-target-id.hip
Yaxun (Sam) Liu [Wed, 19 Aug 2020 04:21:54 +0000 (00:21 -0400)]
Fix test hip-target-id.hip

Some build bot has lld in the directory name, which caused pattern match
issue in the list test.

3 years ago[gn build] Port 7546b29e761
LLVM GN Syncbot [Wed, 19 Aug 2020 03:44:19 +0000 (03:44 +0000)]
[gn build] Port 7546b29e761

3 years ago[HIP] Support target id by --offload-arch
Yaxun (Sam) Liu [Tue, 5 May 2020 03:22:06 +0000 (23:22 -0400)]
[HIP] Support target id by --offload-arch

This patch introduces support of target id by
-offload-arch.

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

3 years ago[AMDGPU] Support disassembly for AMDGPU kernel descriptors
Ronak Chauhan [Fri, 19 Jun 2020 10:25:26 +0000 (15:55 +0530)]
[AMDGPU] Support disassembly for AMDGPU kernel descriptors

Decode AMDGPU Kernel descriptors as assembler directives.

Reviewed By: scott.linder

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

3 years ago[mlir] [VectorOps] Cleanup mask 1-d test on constants
aartbik [Wed, 19 Aug 2020 01:50:33 +0000 (18:50 -0700)]
[mlir] [VectorOps] Cleanup mask 1-d test on constants

I forgot to address this in previous CL. Sorry about that.

Reviewed By: rriddle

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

3 years ago[TSan][libdispatch] Guard test execution on old platforms
Julian Lettner [Fri, 14 Aug 2020 20:42:50 +0000 (13:42 -0700)]
[TSan][libdispatch] Guard test execution on old platforms

`dispatch_async_and_wait()` was introduced in macOS 10.14.  Let's
forward declare it to ensure we can compile the test with older SDKs and
guard execution by checking if the symbol is available.  (We can't use
`__builtin_available()`, because that itself requires a higher minimum
deployment target.)  We also need to specify the `-undefined
dynamic_lookup` compiler flag.

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

3 years ago[TSan][libdispatch] Ensure TSan dylib works on old systems
Julian Lettner [Mon, 17 Aug 2020 19:41:18 +0000 (12:41 -0700)]
[TSan][libdispatch] Ensure TSan dylib works on old systems

`dispatch_async_and_wait()` was introduced in macOS 10.14, which is
greater than our minimal deployment target.  We need to forward declare
it as a "weak import" to ensure we generate a weak reference so the TSan
dylib continues to work on older systems.  We cannot simply `#include
<dispatch.h>` or use the Darwin availability macros since this file is
multi-platform.

In addition, we want to prevent building these interceptors at all when
building with older SDKs because linking always fails.

Before:
```
➤ dyldinfo -bind ./lib/clang/12.0.0/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib | grep dispatch_async_and_wait
__DATA  __interpose      0x000F5E68    pointer      0 libSystem        _dispatch_async_and_wait_f
```

After:
```
➤ dyldinfo -bind ./lib/clang/12.0.0/lib/darwin/libclang_rt.tsan_osx_dynamic.dylib | grep dispatch_async_and_wait
__DATA  __got            0x000EC0A8    pointer      0 libSystem        _dispatch_async_and_wait (weak import)
__DATA  __interpose      0x000F5E78    pointer      0 libSystem        _dispatch_async_and_wait (weak import)
```

This is a follow-up to D85854 and should fix:
https://reviews.llvm.org/D85854#2221529

Reviewed By: kubamracek

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

3 years agoReland "[TSan][libdispatch] Add interceptors for dispatch_async_and_wait()"
Julian Lettner [Tue, 11 Aug 2020 22:01:20 +0000 (15:01 -0700)]
Reland "[TSan][libdispatch] Add interceptors for dispatch_async_and_wait()"

The linker errors caused by this revision have been addressed.

Add interceptors for `dispatch_async_and_wait[_f]()` which was added in
macOS 10.14.  This pair of functions is similar to `dispatch_sync()`,
but does not force a context switch of the queue onto the caller thread
when the queue is active (and hence is more efficient).  For TSan, we
can apply the same semantics as for `dispatch_sync()`.

From the header docs:
> Differences with dispatch_sync()
>
> When the runtime has brought up a thread to invoke the asynchronous
> workitems already submitted to the specified queue, that servicing
> thread will also be used to execute synchronous work submitted to the
> queue with dispatch_async_and_wait().
>
> However, if the runtime has not brought up a thread to service the
> specified queue (because it has no workitems enqueued, or only
> synchronous workitems), then dispatch_async_and_wait() will invoke the
> workitem on the calling thread, similar to the behaviour of functions
> in the dispatch_sync family.

Additional context:
> The guidance is to use `dispatch_async_and_wait()` instead of
> `dispatch_sync()` when it is necessary to mix async and sync calls on
> the same queue. `dispatch_async_and_wait()` does not guarantee
> execution on the caller thread which allows to reduce context switches
> when the target queue is active.
> https://gist.github.com/tclementdev/6af616354912b0347cdf6db159c37057

rdar://35757961

Reviewed By: kubamracek

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

3 years agoSeparate the Registration from Loading dialects in the Context
Mehdi Amini [Tue, 18 Aug 2020 20:01:19 +0000 (20:01 +0000)]
Separate the Registration from Loading dialects in the Context

This changes the behavior of constructing MLIRContext to no longer load globally
registered dialects on construction. Instead Dialects are only loaded explicitly
on demand:
- the Parser is lazily loading Dialects in the context as it encounters them
during parsing. This is the only purpose for registering dialects and not load
them in the context.
- Passes are expected to declare the dialects they will create entity from
(Operations, Attributes, or Types), and the PassManager is loading Dialects into
the Context when starting a pipeline.

This changes simplifies the configuration of the registration: a compiler only
need to load the dialect for the IR it will emit, and the optimizer is
self-contained and load the required Dialects. For example in the Toy tutorial,
the compiler only needs to load the Toy dialect in the Context, all the others
(linalg, affine, std, LLVM, ...) are automatically loaded depending on the
optimization pipeline enabled.

To adjust to this change, stop using the existing dialect registration: the
global registry will be removed soon.

1) For passes, you need to override the method:

virtual void getDependentDialects(DialectRegistry &registry) const {}

and registery on the provided registry any dialect that this pass can produce.
Passes defined in TableGen can provide this list in the dependentDialects list
field.

2) For dialects, on construction you can register dependent dialects using the
provided MLIRContext: `context.getOrLoadDialect<DialectName>()`
This is useful if a dialect may canonicalize or have interfaces involving
another dialect.

3) For loading IR, dialect that can be in the input file must be explicitly
registered with the context. `MlirOptMain()` is taking an explicit registry for
this purpose. See how the standalone-opt.cpp example is setup:

  mlir::DialectRegistry registry;
  registry.insert<mlir::standalone::StandaloneDialect>();
  registry.insert<mlir::StandardOpsDialect>();

Only operations from these two dialects can be in the input file. To include all
of the dialects in MLIR Core, you can populate the registry this way:

  mlir::registerAllDialects(registry);

4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in
the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()

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

3 years agoRevert "Separate the Registration from Loading dialects in the Context"
Mehdi Amini [Wed, 19 Aug 2020 00:32:30 +0000 (00:32 +0000)]
Revert "Separate the Registration from Loading dialects in the Context"

This reverts commit d14cf45735b0d09d7d3caf0824779520dd20ef10.
The build is broken with GCC-5.

3 years ago[mlir] Update the documentation for defining types
River Riddle [Wed, 19 Aug 2020 00:32:24 +0000 (17:32 -0700)]
[mlir] Update the documentation for defining types

The documentation needs a refresh now that "kinds" are no longer a concept. This revision also adds mentions to a few other new concepts, e.g. traits and interfaces.

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

3 years agoWCharType and WIntType are always signed int on OpenBSD.
Brad Smith [Tue, 18 Aug 2020 23:56:19 +0000 (19:56 -0400)]
WCharType and WIntType are always signed int on OpenBSD.

3 years agoAMDGPU: Implement waterfall loop for MIMG instructions with 256-bit SRsrc
Changpeng Fang [Tue, 18 Aug 2020 23:27:36 +0000 (16:27 -0700)]
AMDGPU: Implement waterfall loop for MIMG instructions with 256-bit SRsrc

Summary:
  When the resource descriptor is of vgpr, we need a waterfall loop
to read into a sgpr. In this patchm we generalized the  implementation
to work for any regster class sizes, and extend the work to MIMG
instructions.

Fixes: SWDEV-223405

Reviewers:
  arsenm, nhaehnle

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

3 years agoSeparate the Registration from Loading dialects in the Context
Mehdi Amini [Tue, 18 Aug 2020 20:01:19 +0000 (20:01 +0000)]
Separate the Registration from Loading dialects in the Context

This changes the behavior of constructing MLIRContext to no longer load globally
registered dialects on construction. Instead Dialects are only loaded explicitly
on demand:
- the Parser is lazily loading Dialects in the context as it encounters them
during parsing. This is the only purpose for registering dialects and not load
them in the context.
- Passes are expected to declare the dialects they will create entity from
(Operations, Attributes, or Types), and the PassManager is loading Dialects into
the Context when starting a pipeline.

This changes simplifies the configuration of the registration: a compiler only
need to load the dialect for the IR it will emit, and the optimizer is
self-contained and load the required Dialects. For example in the Toy tutorial,
the compiler only needs to load the Toy dialect in the Context, all the others
(linalg, affine, std, LLVM, ...) are automatically loaded depending on the
optimization pipeline enabled.

To adjust to this change, stop using the existing dialect registration: the
global registry will be removed soon.

1) For passes, you need to override the method:

virtual void getDependentDialects(DialectRegistry &registry) const {}

and registery on the provided registry any dialect that this pass can produce.
Passes defined in TableGen can provide this list in the dependentDialects list
field.

2) For dialects, on construction you can register dependent dialects using the
provided MLIRContext: `context.getOrLoadDialect<DialectName>()`
This is useful if a dialect may canonicalize or have interfaces involving
another dialect.

3) For loading IR, dialect that can be in the input file must be explicitly
registered with the context. `MlirOptMain()` is taking an explicit registry for
this purpose. See how the standalone-opt.cpp example is setup:

  mlir::DialectRegistry registry;
  registry.insert<mlir::standalone::StandaloneDialect>();
  registry.insert<mlir::StandardOpsDialect>();

Only operations from these two dialects can be in the input file. To include all
of the dialects in MLIR Core, you can populate the registry this way:

  mlir::registerAllDialects(registry);

4) For `mlir-translate` callback, as well as frontend, Dialects can be loaded in
the context before emitting the IR: context.getOrLoadDialect<ToyDialect>()

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

3 years ago[NFC][StackSafety] Test that StackLifetime looks through stripPointerCasts
Chuanqi Xu [Tue, 18 Aug 2020 21:30:03 +0000 (14:30 -0700)]
[NFC][StackSafety] Test that StackLifetime looks through stripPointerCasts

StackLifetime class collects lifetime marker of an `alloca` by collect
the user of `BitCast` who is the user of the `alloca`. However, either
the `alloca` itself could be used with the lifetime marker or the `BitCast`
of the `alloca` could be transformed to other instructions. (e.g.,
it may be transformed to all zero reps in `InstCombine` pass).
This patch tries to fix this process in `collectMarkers` functions.

Reviewed By: vitalybuka

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

3 years ago[mlir] Remove the use of "kinds" from Attributes and Types
River Riddle [Tue, 18 Aug 2020 22:59:53 +0000 (15:59 -0700)]
[mlir] Remove the use of "kinds" from Attributes and Types

This greatly simplifies a large portion of the underlying infrastructure, allows for lookups of singleton classes to be much more efficient and always thread-safe(no locking). As a result of this, the dialect symbol registry has been removed as it is no longer necessary.

For users broken by this change, an alert was sent out(https://llvm.discourse.group/t/removing-kinds-from-attributes-and-types) that helps prevent a majority of the breakage surface area. All that should be necessary, if the advice in that alert was followed, is removing the kind passed to the ::get methods.

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

3 years agold128 demangle: allow space for 'L' suffix.
Elliott Hughes [Sat, 11 Apr 2020 00:42:00 +0000 (17:42 -0700)]
ld128 demangle: allow space for 'L' suffix.

Summary:
Caught by HWASAN on arm64 Android (which uses ld128 for long double). This
was running the existing fuzzer.

The specific minimized fuzz input to reproduce this is:

  __cxa_demangle("1\006ILeeeEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE", 0, 0, 0);

Reviewers: eugenis, srhines, #libc_abi!

Subscribers: kristof.beyls, danielkiss, libcxx-commits

Tags: #libc_abi

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

3 years agoHook up OpenBSD 64-bit RISC-V support
Brad Smith [Tue, 18 Aug 2020 22:59:55 +0000 (18:59 -0400)]
Hook up OpenBSD 64-bit RISC-V support

3 years ago[lldb] Remove unused function getArchFlag (NFC)
Jonas Devlieghere [Tue, 18 Aug 2020 22:20:46 +0000 (15:20 -0700)]
[lldb] Remove unused function getArchFlag (NFC)

3 years agoRevert "Separate the Registration from Loading dialects in the Context"
Mehdi Amini [Tue, 18 Aug 2020 22:15:59 +0000 (22:15 +0000)]
Revert "Separate the Registration from Loading dialects in the Context"

This reverts commit e1de2b75501e5eaf8777bd5248382a7c55a44fd6.
Broke a build bot.

3 years ago[X86] Add basic support for -mtune command line option in clang
Craig Topper [Tue, 18 Aug 2020 21:52:44 +0000 (14:52 -0700)]
[X86] Add basic support for -mtune command line option in clang

Building on the backend support from D85165. This parses the command line option in the driver, passes it on to CC1 and adds a function attribute.

-Still need to support tune on the target attribute.
-Need to use "generic" as the tuning by default. But need to change generic in the backend first.
-Need to set tune if march is specified and mtune isn't.
-May need to disable getHostCPUName's ability to guess CPU name from features when it doesn't have a family/model match for mtune=native. That's what gcc appears to do.

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