platform/upstream/llvm.git
2 years ago[lldb] Use new dyld SPIs to query the shared cache local symbols
Jonas Devlieghere [Thu, 18 Nov 2021 22:25:23 +0000 (14:25 -0800)]
[lldb] Use new dyld SPIs to query the shared cache local symbols

rdar://85492172

2 years ago[IROutliner] Allowing Phi Nodes in exit blocks
Andrew Litteken [Wed, 22 Dec 2021 21:37:48 +0000 (15:37 -0600)]
[IROutliner] Allowing Phi Nodes in exit blocks

In addition to having multiple exit locations, there can be multiple blocks leading to the same exit location, which results in a potential phi node. If we find that multiple blocks within the region branch to the same block outside the region, resulting in a phi node, the code extractor pulls this phi node into the function and uses it as an output.

We make sure that this phi node is given an output slot, and that the two values are removed from the outputs if they are not used anywhere else outside of the region. Across the extracted regions, the phi nodes are combined into a single block for each potential output block, similar to the previous patch.

Reviewers: paquette

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

2 years agoAdd assert on End iteration distance to Rewriter::getRewrittenText.
Ashley Hedberg [Tue, 25 Jan 2022 15:42:49 +0000 (15:42 +0000)]
Add assert on End iteration distance to Rewriter::getRewrittenText.

I currently have code that is crashing in the second std::advance call,
and it was not straightforward to identify the problem, as the first line
of the stacktrace is in RopePieceBTreeIterator::operator++:

```

*** SIGILL; stack trace: ***
PC: clang/include/clang/Rewrite/Core/RewriteRope.h:119 clang::RopePieceBTreeIterator::operator++()
    ../include/c++/v1/__iterator/advance.h:35 std::__u::__advance<>()
    ../include/c++/v1/__iterator/advance.h:65 std::__u::advance<>()
    clang/lib/Rewrite/Rewriter.cpp:228 clang::Rewriter::getRewrittenText()
    clang/include/clang/Rewrite/Core/Rewriter.h:106 clang::Rewriter::getRewrittenText()
```

Adding an assertion produces a friendlier error message for the caller.

Reviewed By: gribozavr2

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

2 years ago[lld-macho] Move order file and call graph sorting into SectionPriorities
Leonard Grey [Mon, 24 Jan 2022 22:27:56 +0000 (17:27 -0500)]
[lld-macho] Move order file and call graph sorting into SectionPriorities

See https://reviews.llvm.org/D117354 for context and discussion.

2 years ago[lld-macho] Rename CallGraphSort.{h,cpp} to SectionPriorities
Leonard Grey [Mon, 24 Jan 2022 21:51:51 +0000 (16:51 -0500)]
[lld-macho] Rename CallGraphSort.{h,cpp} to SectionPriorities

This is in preparation for moving the code that parses and processes
order files into this file.

See https://reviews.llvm.org/D117354 for context and discussion.

2 years agoAdd missing include diagnosed by moduels build.
Adrian Prantl [Tue, 25 Jan 2022 17:08:13 +0000 (09:08 -0800)]
Add missing include diagnosed by moduels build.

2 years ago[libc][NFC] Workaround clang assertion in inline asm
Alex Brachet [Tue, 25 Jan 2022 16:37:43 +0000 (16:37 +0000)]
[libc][NFC] Workaround clang assertion in inline asm

The clobber list "cc" is added to inline assembly to workaround a clang assertion that triggers when building with a clang built with assertions enabled. See bug [53391](https://github.com/llvm/llvm-project/issues/53391).

See https://godbolt.org/z/z3bc6a9PM showing functionally same output assembly.

Reviewed By: sivachandra, lntue

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

2 years ago[clang][dataflow] Add a transfer function for InitListExpr
Stanislav Gatev [Mon, 24 Jan 2022 16:17:22 +0000 (16:17 +0000)]
[clang][dataflow] Add a transfer function for InitListExpr

This is part of the implementation of the dataflow analysis framework.
See "[RFC] A dataflow analysis framework for Clang AST" on cfe-dev.

Reviewed-by: xazax.hun
Differential Revision: https://reviews.llvm.org/D118119

2 years agoFix running orc-rt tests with LLVM_BUILD_EXTERNAL_COMPILER_RT
Ben Langmuir [Tue, 25 Jan 2022 00:05:49 +0000 (16:05 -0800)]
Fix running orc-rt tests with LLVM_BUILD_EXTERNAL_COMPILER_RT

Add missing dependency on llvm-jitlink when building compiler-rt with
LLVM_BUILD_EXTERNAL_COMPILER_RT. Previously we would
non-deterministically fail the tests due to the missing binary.

rdar://87247681

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

2 years ago[X86] Regenerate avx-vbroadcast.ll
Simon Pilgrim [Tue, 25 Jan 2022 16:23:10 +0000 (16:23 +0000)]
[X86] Regenerate avx-vbroadcast.ll

Remove '' around mattr to stop update script crash and use X86 prefixes instead of X32

2 years ago[SanitizerCoverage] Avoid pointer element type access
Nikita Popov [Tue, 25 Jan 2022 16:20:26 +0000 (17:20 +0100)]
[SanitizerCoverage] Avoid pointer element type access

Use the load/store type instead.

2 years agoAlways use df_iterator_default_set as default set type for [i]df_ext_iterator
serge-sans-paille [Tue, 25 Jan 2022 14:53:09 +0000 (09:53 -0500)]
Always use df_iterator_default_set as default set type for [i]df_ext_iterator

This is consistent with other default values in this file.

2 years ago[NFC] Refine header dependencies of llvm/ADT/Any.h
serge-sans-paille [Tue, 25 Jan 2022 14:52:15 +0000 (09:52 -0500)]
[NFC] Refine header dependencies of llvm/ADT/Any.h

2 years ago[libc] Implement log10f correctly rounded for all rounding modes.
Tue Ly [Tue, 25 Jan 2022 02:35:25 +0000 (21:35 -0500)]
[libc] Implement log10f correctly rounded for all rounding modes.

Based on RLIBM implementation similar to logf and log2f.  Most of the exceptional inputs are the exact powers of 10.

Reviewed By: sivachandra, zimmermann6, santoshn, jpl169

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

2 years ago[PowerPC][AIX] Override markFunctionEnd()
Sean Fertile [Thu, 20 Jan 2022 18:30:42 +0000 (13:30 -0500)]
[PowerPC][AIX] Override markFunctionEnd()

During fast-isel calling 'markFunctionEnd' in the base class will call
tidyLandingPads. This can cause an issue where we have determined that
we need ehinfo and emitted a traceback table with the bits set to
indicate that we will be emitting the ehinfo, but the tidying deletes
all landing pads. In this case we end up emitting a reference to
__ehinfo.N symbol, but not emitting a definition to said symbol and the
resulting file fails to assemble.

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

2 years ago[X86][AVX] Add PR47194 shuffle test case
Simon Pilgrim [Tue, 25 Jan 2022 14:58:20 +0000 (14:58 +0000)]
[X86][AVX] Add PR47194 shuffle test case

2 years ago[clang-tidy] Change code of SignalHandlerCheck (NFC).
Balázs Kéri [Tue, 25 Jan 2022 14:09:31 +0000 (15:09 +0100)]
[clang-tidy] Change code of SignalHandlerCheck (NFC).

Using clang::CallGraph to get the called functions.
This makes a better foundation to improve support for
C++ and print the call chain.

Reviewed By: aaron.ballman

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

2 years ago[GVN] Add tests for loop load PRE through select.
Florian Hahn [Tue, 25 Jan 2022 14:49:17 +0000 (14:49 +0000)]
[GVN] Add tests for loop load PRE through select.

2 years ago[clang-tidy] Pop Files only if FileChangeReason is ExitFile
Jim Lin [Tue, 25 Jan 2022 07:05:43 +0000 (15:05 +0800)]
[clang-tidy] Pop Files only if FileChangeReason is ExitFile

enum FileChangeReason has four possible type EnterFile, ExitFile,
SystemHeaderPragma and RenameFile,
It should pop the back element of Files only if FileChangeReason is ExitFile.

2 years ago[SLC] Fix pointer diff type in sprintf() optimization
Nikita Popov [Tue, 25 Jan 2022 14:20:32 +0000 (15:20 +0100)]
[SLC] Fix pointer diff type in sprintf() optimization

We should always be calculating a byte-wise difference here.
Previously this calculated the pointer difference while taking
the pointer element type into account, which is incorrect.

2 years ago[mlir] Move duplicated BufferizableOpInterface::kBufferLayoutAttrName defs to a singl...
Benjamin Kramer [Tue, 25 Jan 2022 14:17:07 +0000 (15:17 +0100)]
[mlir] Move duplicated BufferizableOpInterface::kBufferLayoutAttrName defs to a single place

2 years ago[AMDGPU] Only match correct type for a16
Sebastian Neubauer [Mon, 24 Jan 2022 17:46:33 +0000 (18:46 +0100)]
[AMDGPU] Only match correct type for a16

Addresses are floats when a sampler is present and unsigned integers
when no sampler is present.

Therefore, only zext instructions, not sext instructions should match.

Also match integer constants that can be truncated.

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

2 years ago[MemProf] Avoid pointer element type access
Nikita Popov [Tue, 25 Jan 2022 13:52:01 +0000 (14:52 +0100)]
[MemProf] Avoid pointer element type access

Determine the masked load/store access type from the value type
of the intrinsics, rather than the pointer element type. For
cleanliness, include the access type in InterestingMemoryAccess.

2 years ago[OpenMPIRBuilderTest] Avoid some pointer element type accesses (NFC)
Nikita Popov [Tue, 25 Jan 2022 13:39:22 +0000 (14:39 +0100)]
[OpenMPIRBuilderTest] Avoid some pointer element type accesses (NFC)

Use isOpaqueOrPointeeTypeMatches() instead, where possible.

2 years agoAdd llvm-dwp to LLVM_TOOLCHAIN_TOOLS
Hans Wennborg [Mon, 24 Jan 2022 14:25:17 +0000 (15:25 +0100)]
Add llvm-dwp to LLVM_TOOLCHAIN_TOOLS

since it qualifies as a toolchain tool rather than "internal llvm tool".
This will make it part of builds which set the
LLVM_INSTALL_TOOLCHAIN_ONLY cmake option, such as the Windows installer.

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

2 years ago[AsmParserTest] Avoid pointer element type accesses (NFC)
Nikita Popov [Tue, 25 Jan 2022 13:31:51 +0000 (14:31 +0100)]
[AsmParserTest] Avoid pointer element type accesses (NFC)

Use isOpaqueOrPointeeTypeEquals() instead.

2 years ago[GlobalISel] Avoid pointer element type access during InlineAsm lowering
Nikita Popov [Tue, 25 Jan 2022 13:25:48 +0000 (14:25 +0100)]
[GlobalISel] Avoid pointer element type access during InlineAsm lowering

Same change as has been made for the SDAG lowering.

2 years ago[NFC][clangd] cleaning up llvm-qualified-auto
Christian Kühnel [Mon, 13 Dec 2021 15:14:31 +0000 (15:14 +0000)]
[NFC][clangd] cleaning up llvm-qualified-auto

This is a cleanup of all llvm-qualified-auto findings.
This patch was created by automatically applying the fixes from
clang-tidy.

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

2 years ago[mlir][linalg][bufferize] Support tensor.from_elements
Matthias Springer [Tue, 25 Jan 2022 13:05:35 +0000 (22:05 +0900)]
[mlir][linalg][bufferize] Support tensor.from_elements

This is mostly a copy of the existing tensor.from_elements bufferization. Once TensorInterfaceImpl.cpp is moved to the tensor dialect, the existing rewrite pattern can be deleted.

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

2 years ago[mlir][linalg][bufferize] Support tensor.generate
Matthias Springer [Tue, 25 Jan 2022 13:05:10 +0000 (22:05 +0900)]
[mlir][linalg][bufferize] Support tensor.generate

This is mostly a copy of the existing tensor.generate bufferization. Once TensorInterfaceImpl.cpp is moved to the tensor dialect, the existing rewrite pattern can be deleted.

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

2 years ago[Evaluator] Simplify handling of bitcasted calls
Nikita Popov [Tue, 25 Jan 2022 13:18:05 +0000 (14:18 +0100)]
[Evaluator] Simplify handling of bitcasted calls

When fetching the function, strip casts. When casting the result,
use the call result type. Don't actually inspect the bitcast.

2 years ago[Visualizers] Fix Optional visualizer.
Marek Kurdej [Tue, 25 Jan 2022 13:12:30 +0000 (14:12 +0100)]
[Visualizers] Fix Optional visualizer.

As discussed in https://reviews.llvm.org/D118105#3268773, OptionalStorage has been changed in commit https://github.com/llvm/llvm-project/commit/fb9730575086b3c2ba38a1aabf3106b01339888b, but the visualizer still tries to use old members.

Reviewed By: RKSimon

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

2 years ago[mlir][linalg][bufferize] Fix build
Matthias Springer [Tue, 25 Jan 2022 12:50:02 +0000 (21:50 +0900)]
[mlir][linalg][bufferize] Fix build

This fixes a linker error related to ModuleBufferization.cpp.

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

2 years ago[lldb] Fix windows build for D117490
Pavel Labath [Tue, 25 Jan 2022 12:51:53 +0000 (13:51 +0100)]
[lldb] Fix windows build for D117490

I forgot to update ProcessWindowsLog to the new API.

2 years ago[lldb] Fix mac build for D117490
Pavel Labath [Tue, 25 Jan 2022 12:41:09 +0000 (13:41 +0100)]
[lldb] Fix mac build for D117490

This is exactly that kind of a API misuse that the patch was meant to
detect.

2 years ago[X86] Add folded load tests to PR46809 tests
Simon Pilgrim [Tue, 25 Jan 2022 12:35:00 +0000 (12:35 +0000)]
[X86] Add folded load tests to PR46809 tests

2 years ago[AArch64] Add patterns for relaxed atomic ld/st into fp registers
Danila Malyutin [Tue, 18 Jan 2022 17:17:22 +0000 (20:17 +0300)]
[AArch64] Add patterns for relaxed atomic ld/st into fp registers

Adds patterns to match integer loads/stores bitcasted to fp values

Fixes https://github.com/llvm/llvm-project/issues/52927

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

2 years ago[SVE] Enable ISD::ABDS/U ISel for scalable vectors.
Paul Walker [Fri, 10 Dec 2021 18:05:38 +0000 (18:05 +0000)]
[SVE] Enable ISD::ABDS/U ISel for scalable vectors.

NOTE: This patch also includes tests that highlight those cases
where the existing DAG combine doesn't yet work well for SVE.

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

2 years ago[ObjCARCOpts] Use standard non-terminator unreachable pattern
Nikita Popov [Tue, 25 Jan 2022 12:05:14 +0000 (13:05 +0100)]
[ObjCARCOpts] Use standard non-terminator unreachable pattern

This is what CreateNonTerminatorUnreachable() in InstCombine uses.
Specific choice here doesn't really matter, but we should pick
one that is pointer element type independent.

2 years ago[ObjCArcOpts] Regenerate test checks (NFC)
Nikita Popov [Tue, 25 Jan 2022 12:07:36 +0000 (13:07 +0100)]
[ObjCArcOpts] Regenerate test checks (NFC)

2 years ago[SCEV] Remove an unnecessary GEP type check
Nikita Popov [Tue, 25 Jan 2022 11:55:02 +0000 (12:55 +0100)]
[SCEV] Remove an unnecessary GEP type check

The code already checked that the addrec step size and type alloc
size are the same. The actual pointer element type is irrelevant
here.

2 years ago[DAG] visitMULHS/MULHU/AND - remove some redundant LHS constant checks
Simon Pilgrim [Tue, 25 Jan 2022 11:54:11 +0000 (11:54 +0000)]
[DAG] visitMULHS/MULHU/AND - remove some redundant LHS constant checks

Now that we constant fold and canonicalize constants to the RHS, we don't need to check both LHS and RHS for specific constants

2 years ago[X86] combineVectorSignBitsTruncation - fix indentation. NFC.
Simon Pilgrim [Tue, 25 Jan 2022 11:41:15 +0000 (11:41 +0000)]
[X86] combineVectorSignBitsTruncation - fix indentation. NFC.

2 years ago[llvm-c] Deprecate LLVMBuildPtrDiff()
Nikita Popov [Tue, 25 Jan 2022 11:47:50 +0000 (12:47 +0100)]
[llvm-c] Deprecate LLVMBuildPtrDiff()

In favor of LLVMBuildPtrDiff2(), which accepts an explicit element
type and is compatible with opaque pointers.

2 years ago[IRBuilder] Require explicit element type in CreatePtrDiff()
Nikita Popov [Tue, 25 Jan 2022 11:23:28 +0000 (12:23 +0100)]
[IRBuilder] Require explicit element type in CreatePtrDiff()

For opaque pointer compatibility, we cannot derive the element
type from the pointer type.

2 years ago[OpenCL] Make read_write images optional for -fdeclare-opencl-builtins
Sven van Haastregt [Tue, 25 Jan 2022 11:40:31 +0000 (11:40 +0000)]
[OpenCL] Make read_write images optional for -fdeclare-opencl-builtins

Ensure any use of a `read_write` image is guarded behind the
`__opencl_c_read_write_images` feature macro.

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

2 years ago[OpenMP] Simplify pointer comparison
Nikita Popov [Tue, 25 Jan 2022 11:36:04 +0000 (12:36 +0100)]
[OpenMP] Simplify pointer comparison

Rather than checking ptrdiff(a, b) != 0, directly check a != b.

2 years ago[mlir][Bazel] Update BUILD.bazel file
Adrian Kuegel [Tue, 25 Jan 2022 11:33:42 +0000 (12:33 +0100)]
[mlir][Bazel] Update BUILD.bazel file

2 years ago[MLIR] [AsyncToLLVM] Use llvm.coro.align intrinsic
Chuanqi Xu [Tue, 25 Jan 2022 11:24:49 +0000 (19:24 +0800)]
[MLIR] [AsyncToLLVM] Use llvm.coro.align intrinsic

Use llvm.coro.align to align coroutine frame properly.

Reviewed By: bkramer

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

2 years ago[DAGCombine] Fold SRA of a load into a narrower sign-extending load
Bjorn Pettersson [Tue, 11 Jan 2022 23:34:11 +0000 (00:34 +0100)]
[DAGCombine] Fold SRA of a load into a narrower sign-extending load

An sra is basically sign-extending a narrower value. Fold away the
shift by doing a sextload of a narrower value, when it is legal to
reduce the load width accordingly.

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

2 years ago[lldb/test] Use abspath when searching for lldb.exe
Pavel Labath [Tue, 25 Jan 2022 11:10:28 +0000 (12:10 +0100)]
[lldb/test] Use abspath when searching for lldb.exe

realpath is too aggressive and does not produce the desired effect if
ones build folder is a symlink farm.

2 years ago[lldb] Make logging machinery type-safe
Pavel Labath [Mon, 17 Jan 2022 14:56:11 +0000 (15:56 +0100)]
[lldb] Make logging machinery type-safe

This patch makes use of c++ type checking and scoped enums to make
logging statements shorter and harder to misuse.

Defines like LIBLLDB_LOG_PROCESS are replaces with LLDBLog::Process.
Because it now carries type information we do not need to worry about
matching a specific enum value with the right getter function -- the
compiler will now do that for us.

The main entry point for the logging machinery becomes the GetLog
(template) function, which will obtain the correct Log object based on
the enum type. It achieves this through another template function
(LogChannelFor<T>), which must be specialized for each type, and should
return the appropriate channel object.

This patch also removes the ability to log a message if multiple
categories are enabled simultaneously as it was unused and confusing.

This patch does not actually remove any of the existing interfaces. The
defines and log retrieval functions are left around as wrappers around
the new interfaces. They will be removed in follow-up patch.

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

2 years ago[SelectionDAG][VP] Add widening support for VP_MERGE
Fraser Cormack [Mon, 24 Jan 2022 11:43:20 +0000 (11:43 +0000)]
[SelectionDAG][VP] Add widening support for VP_MERGE

This patch adds widening support for ISD::VP_MERGE, which widens
identically to VP_SELECT and similarly to other select-like nodes.

Reviewed By: craig.topper

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

2 years ago[clang] Remove some getPointerElementType() uses
Nikita Popov [Tue, 25 Jan 2022 11:04:06 +0000 (12:04 +0100)]
[clang] Remove some getPointerElementType() uses

Same cases where the call can be removed in a straightforward way.

2 years ago[AArch64] Exclude optional features from HasV8_0rOps.
Simon Tatham [Tue, 25 Jan 2022 10:37:19 +0000 (10:37 +0000)]
[AArch64] Exclude optional features from HasV8_0rOps.

The following SubtargetFeatures are removed from the definition of
HasV8_0rOps, on the grounds that they are optional in Armv8.4-A, and
therefore (by the definition of Armv8.0-R) also optional in v8.0-R:

 * performance monitoring: FeaturePerfMon
 * cryptography: FeatureSM4 and FeatureSHA3
 * half-precision FP: FeatureFullFP16, FeatureFP16FML
 * speculation control: FeatureSSBS, FeaturePredRes, FeatureSB,
   FeatureSpecRestrict

This isn't the full set of features that are listed as optional in the
spec. FeatureCCIDX and FeatureTRACEV8_4 are also optional. But LLVM
includes those in HasV8_3aOps and HasV8_4aOps respectively (I think on
the grounds that the system registers they enable are useful to be
able to access after a runtime check), and so for consistency, I've
left those in HasV8_0rOps too.

After this commit, HasV8_0rOps is a strict subset of HasV8_4aOps (but
missing features that are not in Armv8.0-R at all).

The definition of Cortex-R82 is correspondingly updated to add most of
the features that I've removed from base Armv8.0-R (with the exception
of the cryptography ones), since that particular implementation of
v8.0-R does have them.

Reviewed By: dmgreen

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

2 years ago[bazel] Adjust dependencies after a70aa7bb
Benjamin Kramer [Tue, 25 Jan 2022 10:46:02 +0000 (11:46 +0100)]
[bazel] Adjust dependencies after a70aa7bb

These are all picked up transitively, but fail with
--features=layering_check, which enforces header dependencies.

2 years ago[VP] Update CodeGen/RISCV/rvv/vpgather-sdnode.ll test
Victor Perez [Tue, 25 Jan 2022 10:34:58 +0000 (10:34 +0000)]
[VP] Update CodeGen/RISCV/rvv/vpgather-sdnode.ll test

2 years ago[SelectionDAG][VP] Add splitting support for VP_MERGE
Fraser Cormack [Mon, 24 Jan 2022 11:53:29 +0000 (11:53 +0000)]
[SelectionDAG][VP] Add splitting support for VP_MERGE

This patch adds splitting support for ISD::VP_MERGE, which splits
identically to VP_SELECT and similarly to other select-like nodes.

Reviewed By: craig.topper

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

2 years agoRevert "[NFC] Added test with select with unpredictable metadata; regenerate x86...
Dávid Bolvanský [Tue, 25 Jan 2022 10:28:26 +0000 (11:28 +0100)]
Revert "[NFC] Added test with select with unpredictable metadata; regenerate x86-cmov-converter.ll"

This reverts commit e2f8d28afba0a6545284ad3b54a4b7532c3253b6.

2 years ago[NFC] Added test with select with unpredictable metadata; regenerate x86-cmov-convert...
Dávid Bolvanský [Tue, 25 Jan 2022 10:11:14 +0000 (11:11 +0100)]
[NFC] Added test with select with unpredictable metadata; regenerate x86-cmov-converter.ll

2 years ago[docs] There are more than three bit storage containers.
Hsiangkai Wang [Fri, 21 Jan 2022 01:46:34 +0000 (01:46 +0000)]
[docs] There are more than three bit storage containers.

To avoid listing all the bit containers in the title and do not use the
specific number for the number of bit containers.

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

2 years ago[docs] Refine the description in Set-Like and Map-Like container options.
Hsiangkai Wang [Fri, 21 Jan 2022 07:56:08 +0000 (07:56 +0000)]
[docs] Refine the description in Set-Like and Map-Like container options.

In "Other Set-Like Container Options":
* Drops the references to C++ TR1 and SGI and hash_set.
* Drops the worry about portability (this was a problem with hash_set, but
std::unordered_set has worked portably since LLVM started depending
on C++11).

It is similar in "Other Map-Like Container Options" section.

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

2 years ago[LegalizeTypes][VP] Add splitting support for vp.gather and vp.scatter
Victor Perez [Tue, 25 Jan 2022 10:05:50 +0000 (10:05 +0000)]
[LegalizeTypes][VP] Add splitting support for vp.gather and vp.scatter

Split these nodes in a similar way as their masked versions.

Reviewed By: frasercrmck, craig.topper

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

2 years ago[NFC] Move useSVEForFixedLengthVectors into AArch64Subtarget.h
David Sherwood [Fri, 21 Jan 2022 09:56:49 +0000 (09:56 +0000)]
[NFC] Move useSVEForFixedLengthVectors into AArch64Subtarget.h

Given how small the function is and how often it gets used it
makes more sense to live in the header file.

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

2 years ago[OpaquePtrs] Deprecate PointerType::getElementType()
Nikita Popov [Tue, 25 Jan 2022 08:57:26 +0000 (09:57 +0100)]
[OpaquePtrs] Deprecate PointerType::getElementType()

This deprecates PointerType::getElementType() in favor of
Type::getPointerElementType(). The motivation is to make it more
apparent when code accesses the pointer element type, because
getElementType() may also also refer to at least
ArrayType::getElementType() and VectorType::getElementType().

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

2 years ago[NFC] Remove more uses of PointerType::getElementType() (NFC)
Nikita Popov [Tue, 25 Jan 2022 09:07:45 +0000 (10:07 +0100)]
[NFC] Remove more uses of PointerType::getElementType() (NFC)

Replace more uses which I missed in the first pass with
Type::getPointerElementType().

2 years ago[NFC] Remove uses of PointerType::getElementType()
Nikita Popov [Fri, 21 Jan 2022 12:03:15 +0000 (13:03 +0100)]
[NFC] Remove uses of PointerType::getElementType()

Instead use either Type::getPointerElementType() or
Type::getNonOpaquePointerElementType().

This is part of D117885, in preparation for deprecating the API.

2 years ago[NFC] [C++20] [Modules] Update comments for handling friend
Chuanqi Xu [Tue, 25 Jan 2022 08:39:15 +0000 (16:39 +0800)]
[NFC] [C++20] [Modules] Update comments for handling friend

There is a comment contains a FIXME for the Module TS. And now the
Module TS is merged so we should update the comment. I've checked the
implementation.

2 years ago[Dwarf] Optimize getOrCreateSourceID() for repeated calls on same file (NFCI)
Nikita Popov [Mon, 24 Jan 2022 13:29:05 +0000 (14:29 +0100)]
[Dwarf] Optimize getOrCreateSourceID() for repeated calls on same file (NFCI)

DwarfCompileUnit::getOrCreateSourceID() is often called many times
in sequence with the same DIFile. This is currently very expensive,
because it involves creating a string from directory and file name
and looking it up in a string map. This patch remembers the last
DIFile and its ID and directly returns that.

This gives a geomean -1.3% compile-time improvement on CTMark O0-g.

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

2 years ago[X86] [CodeView] Add codeview mappings for registers ST0-ST7
Martin Storsjö [Fri, 21 Jan 2022 23:38:07 +0000 (01:38 +0200)]
[X86] [CodeView] Add codeview mappings for registers ST0-ST7

These can end up needed after https://reviews.llvm.org/D116821.

Suggested by Alexandre Ganea.

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

2 years ago[MLIR][Interfaces] Silence -Wparentheses warning (NFC)
Lorenzo Chelini [Tue, 25 Jan 2022 07:50:52 +0000 (08:50 +0100)]
[MLIR][Interfaces] Silence -Wparentheses warning (NFC)

warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

2 years ago[mlir] Remove unnecessary dependency on Tensor from MemRef
River Riddle [Tue, 25 Jan 2022 06:59:01 +0000 (22:59 -0800)]
[mlir] Remove unnecessary dependency on Tensor from MemRef

2 years ago[mlir][OpenMP] Added omp.atomic.capture operation
Shraiysh Vaishay [Mon, 24 Jan 2022 13:12:39 +0000 (18:42 +0530)]
[mlir][OpenMP] Added omp.atomic.capture operation

This patch supports the atomic construct (capture) following section 2.17.7 of OpenMP 5.0 standard. Also added tests for the same.

Reviewed By: peixin, kiranchandramohan

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

2 years agoFix the wrong value of bit_AVXVNNI
Liu, Chen3 [Tue, 25 Jan 2022 06:08:58 +0000 (14:08 +0800)]
Fix the wrong value of bit_AVXVNNI

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

2 years ago[SCEV] Use lshr in implications
Max Kazantsev [Tue, 25 Jan 2022 06:21:37 +0000 (13:21 +0700)]
[SCEV] Use lshr in implications

This patch adds support for implication inference logic for the
following pattern:
```
  lhs < (y >> z) <= y, y <= rhs --> lhs < rhs
```
We should be able to use the fact that value shifted to right is
not greater than the original value (provided it is non-negative).

Differential Revision: https://reviews.llvm.org/D116150
Reviewed-By: apilipenko
2 years ago[mlir] Add more missing dependencies after D118062
River Riddle [Tue, 25 Jan 2022 06:11:53 +0000 (22:11 -0800)]
[mlir] Add more missing dependencies after D118062

These used to be covered transitively, but now need to be explicit.

2 years ago[MLIR] Improve doc for -mlir-print-local-scope and unhide
Uday Bondhugula [Sun, 23 Jan 2022 02:09:01 +0000 (07:39 +0530)]
[MLIR] Improve doc for -mlir-print-local-scope and unhide

This is a pretty important debugging option to stay hidden. Also,
improve its cmd-line description; the current description gives no hint
that this is the one to use to have locations printed inline.
Out-of-line locations are also unproductive to work with in many cases
where the locations are actually compact, which is also why this option
should be more visible.  This revision doesn't change the default on it
though.

Reviewed By: rriddle, jpienaar

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

2 years ago[mlir] Add more missing dependencies after D118062
River Riddle [Tue, 25 Jan 2022 05:36:31 +0000 (21:36 -0800)]
[mlir] Add more missing dependencies after D118062

These used to be covered transitively, but now need to be explicit.

2 years ago[mlir] Add missing dependencies after D118062
River Riddle [Tue, 25 Jan 2022 05:31:29 +0000 (21:31 -0800)]
[mlir] Add missing dependencies after D118062

These used to be covered transitively, but now need to be explicit.

2 years ago[bazel] Update MLIR deps
Jordan Rupprecht [Tue, 25 Jan 2022 05:21:37 +0000 (21:21 -0800)]
[bazel] Update MLIR deps

I believe this is due to D117839, D117848, maybe others.

Latest build failure: https://buildkite.com/llvm-project/upstream-bazel-rbe/builds/18053

2 years ago[mlir:MLIRAffineUtils] Add missing dependency on MLIRAffineAnalysis
River Riddle [Tue, 25 Jan 2022 05:23:30 +0000 (21:23 -0800)]
[mlir:MLIRAffineUtils] Add missing dependency on MLIRAffineAnalysis

This was missed in a70aa7bb0d9a6066831b339e0a09a2c1bc74fe2b.

2 years agoFix python test to register all passes before using "normalize-memrefs"
Mehdi Amini [Tue, 25 Jan 2022 05:15:08 +0000 (05:15 +0000)]
Fix python test to register all passes before using "normalize-memrefs"

The pass moved from mlir.transforms to the Memref dialect.

2 years ago[mlir:LoopLikeInterface] Add missing dependency on SideEffectInterfaces
River Riddle [Tue, 25 Jan 2022 05:09:19 +0000 (21:09 -0800)]
[mlir:LoopLikeInterface] Add missing dependency on SideEffectInterfaces

This was missed when moveLoopInvariantCode was added.

2 years ago[M68k][Disassembler][NFC] Re-organize test files
Min-Yih Hsu [Tue, 25 Jan 2022 05:07:29 +0000 (13:07 +0800)]
[M68k][Disassembler][NFC] Re-organize test files

Put test cases of each instruction category into their own files. NFC.

2 years ago[ObjCARC] Use "UnsafeClaimRV" to refer to unsafeClaim in enums. NFC.
Ahmed Bougacha [Tue, 25 Jan 2022 01:14:39 +0000 (17:14 -0800)]
[ObjCARC] Use "UnsafeClaimRV" to refer to unsafeClaim in enums. NFC.

This matches the actual runtime function more closely.
I considered also renaming both RetainRV/UnsafeClaimRV to end with
"ARV", for AutoreleasedReturnValue, but there's less potential
for confusion there.

2 years ago[ObjCARC] Remove unused RetainRVDep dependency kind. NFC.
Ahmed Bougacha [Tue, 25 Jan 2022 00:56:02 +0000 (16:56 -0800)]
[ObjCARC] Remove unused RetainRVDep dependency kind. NFC.

2 years ago[mlir] Remove a bunch of unnecessary dialect dependencies
River Riddle [Mon, 24 Jan 2022 19:41:00 +0000 (11:41 -0800)]
[mlir] Remove a bunch of unnecessary dialect dependencies

A lot of dialects have dependencies that are unnecessary, either because of copy/paste
of files when creating things or some other means. This commit cleans up a bunch of
the simple ones:

* Copy/Paste or missed during refactoring
Most of the dependencies cleaned up here look like copy/paste errors when creating
new dialects/transformations, or because the dependency wasn't removed during a
refactoring (e.g. when splitting the standard dialect).

* Unnecessary hard coding of constant operations in matchers
There are a few instances where a dialect had a dependency because it
was hardcoding checks for constant operations instead of using the better m_Constant
approach.

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

2 years ago[mlir:ArmSVE][NFC] Remove dead code and unnecessary dependencies
River Riddle [Fri, 21 Jan 2022 20:35:08 +0000 (12:35 -0800)]
[mlir:ArmSVE][NFC] Remove dead code and unnecessary dependencies

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

2 years ago[mlir:Transforms] Move out the remaining non-dialect independent transforms and utilities
River Riddle [Fri, 21 Jan 2022 01:32:31 +0000 (17:32 -0800)]
[mlir:Transforms] Move out the remaining non-dialect independent transforms and utilities

This has been a major TODO for a very long time, and is necessary for establishing a proper
dialect-free dependency layering for the Transforms library. Code was moved to effectively
two main locations:

* Affine/
There was quite a bit of affine dialect related code in Transforms/ do to historical reasons
(of a time way into MLIR's past). The following headers were moved to:
Transforms/LoopFusionUtils.h -> Dialect/Affine/LoopFusionUtils.h
Transforms/LoopUtils.h -> Dialect/Affine/LoopUtils.h
Transforms/Utils.h -> Dialect/Affine/Utils.h

The following transforms were also moved:
AffineLoopFusion, AffinePipelineDataTransfer, LoopCoalescing

* SCF/
Only one SCF pass was in Transforms/ (likely accidentally placed here): ParallelLoopCollapsing
The SCF specific utilities in LoopUtils have been moved to SCF/Utils.h

* Misc:
mlir::moveLoopInvariantCode was also moved to LoopLikeInterface.h given
that it is a simple utility defined in terms of LoopLikeOpInterface.

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

2 years ago[mlir:Transforms] Move NormalizeMemRefs to MemRef/Transforms/
River Riddle [Thu, 20 Jan 2022 23:16:17 +0000 (15:16 -0800)]
[mlir:Transforms] Move NormalizeMemRefs to MemRef/Transforms/

Transforms/  should only contain transformations that are dialect-independent and
this pass interacts with MemRef operations (making it a better fit for living in that
dialect).

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

2 years ago[mlir] Move the Buffer related source files out of Transforms/
River Riddle [Thu, 20 Jan 2022 22:30:47 +0000 (14:30 -0800)]
[mlir] Move the Buffer related source files out of Transforms/

Transforms/ should only contain dialect-independent transformations,
and these files are a much better fit for the bufferization dialect anyways.

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

2 years agoFix bugs in GPUToNVVM lowering
harsh [Tue, 25 Jan 2022 02:37:52 +0000 (02:37 +0000)]
Fix bugs in GPUToNVVM lowering

The current lowering from GPU to NVVM does
not correctly handle the following cases when
lowering the gpu shuffle op.

1. When the active width is set to 32 (all lanes),
then the current approach computes (1 << 32) -1 which
results in poison values in the LLVM IR. We fix this by
defining the active mask as (-1) >> (32 - width).

2. In the case of shuffle up, the computation of the third
operand c has to be different from the other 3 modes due to
the op definition in the ISA reference.
(https://docs.nvidia.com/cuda/parallel-thread-execution/index.html)
Specifically, the predicate value is computed as j >= maxLane
for up and j <= maxLane for all other modes. We fix this by
computing maskAndClamp as 32 - width for this mode.

TEST: We modify the existing test and add more checks for the up mode.

Reviewed By: ThomasRaoux

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

2 years ago[clang-tools-extra] Fix documentation build (NFC)
Richard [Tue, 25 Jan 2022 03:19:03 +0000 (20:19 -0700)]
[clang-tools-extra] Fix documentation build (NFC)

2 years ago[AA] Refine ModRefInfo for llvm.memcpy.* in presence of operand bundles
Evgeniy Brevnov [Mon, 24 Jan 2022 09:29:46 +0000 (16:29 +0700)]
[AA] Refine ModRefInfo for llvm.memcpy.* in presence of operand bundles

Presence of operand bundles changes semantics in respect to ModRef. In particular, spec says: "From the compilers perspective, deoptimization operand bundles make the call sites theyre attached to at least readonly. They read through all of their pointer typed operands (even if theyre not otherwise escaped) and the entire visible heap. Deoptimization operand bundles do not capture their operands except during deoptimization, in which case control will not be returned to the compiled frame". Fix handling of llvm.memcpy.* according to the spec.

Reviewed By: nikic

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

2 years ago[RISCV][NFC] Rename RequiredExtensions to RequiredFeatures.
jacquesguan [Mon, 24 Jan 2022 07:13:46 +0000 (15:13 +0800)]
[RISCV][NFC] Rename RequiredExtensions to RequiredFeatures.

The field 'RequiredExtensions' is used to specify the constraint for rvv builtin, and it contains something which is not a sub-extension or extension such as 'RV64'. So the word 'extension' is not accurate now, 'feature' seems better.

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

2 years agoRemove null check after dereferencing the pointer (NFC)
Mehdi Amini [Tue, 25 Jan 2022 02:07:57 +0000 (02:07 +0000)]
Remove null check after dereferencing the pointer (NFC)

Flagged by Coverity

2 years ago[mlir][sparse] integration test for sparse output operation
Aart Bik [Mon, 24 Jan 2022 22:23:03 +0000 (14:23 -0800)]
[mlir][sparse] integration test for sparse output operation

Reviewed By: bixia

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

2 years ago[OpenMP] Add more identifier to created shared globals
Joseph Huber [Mon, 24 Jan 2022 20:45:27 +0000 (15:45 -0500)]
[OpenMP] Add more identifier to created shared globals

Currenly we push some variables to a global constant containing shared
memory as an optimization. This generated constant had internal linkage
and should not have collided with any known identifiers in the
translation unit. However, there have been observed cases of this
optimiztaion unintentionally colliding with undocumented PTX
identifiers. This patch adds a suffix to the created globals to
hopefully bypass this.

Depends on D118059

Reviewed By: tianshilei1992

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

2 years ago[OpenMP][Fix] Properly inherit calling convention
Joseph Huber [Mon, 24 Jan 2022 19:02:20 +0000 (14:02 -0500)]
[OpenMP][Fix] Properly inherit calling convention

Previously in OpenMPOpt we did not correctly inherit the calling
convention of the callee when creating new OpenMP runtime calls. This
created issues when the calling convention was changed during
`GlobalOpt` but a new call was creating without the correct calling
convention. This lead to the call being replaced with a poison value in
`InstCombine` due to undefined behaviour and causing large portions of
the program to be incorrectly eliminated. This patch correctly inherits
the existing calling convention from the callee.

Reviewed By: tianshilei1992, jdoerfert

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

2 years ago[lldb] Make PythonDataObjects work with Python 2
Jonas Devlieghere [Tue, 25 Jan 2022 01:18:18 +0000 (17:18 -0800)]
[lldb] Make PythonDataObjects work with Python 2

I considered keeping this change strictly downstream. Since we still
have a bunch of places that check for Python 2, I figured it doesn't
harm to land it upstream and avoid the conflict when I eventually do
remove them (hopefully soon!).