platform/upstream/llvm.git
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!).

2 years ago[libc++] Fix LWG3422 "Issues of seed_seq's constructors"
Arthur O'Dwyer [Sat, 22 Jan 2022 20:13:13 +0000 (15:13 -0500)]
[libc++] Fix LWG3422 "Issues of seed_seq's constructors"

https://cplusplus.github.io/LWG/issue3422

Also add a static_assert to check the "Mandates:" on the
iterator-pair constructor. Oddly, the `InputIterator` parameter
itself is merely preconditioned, not constrained, to satisfy the
input iterator requirements.

Also drive-by rename `init` to `__init`.

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

2 years ago[llvm-profgen] Support to load debug info from a second binary
wlei [Tue, 25 Jan 2022 00:55:05 +0000 (16:55 -0800)]
[llvm-profgen] Support to load debug info from a second binary

For reducing binary size purpose, the binary's debug info and executable segment can be separated(like using objcopy --only-keep-debug). Here add support in llvm-profgen to use two binaries as input. The original one is executable binary and added for debug info only binary. Adding a flag `--debug-binary=file-path`, with this, the binary will load debug info from debug binary.

Reviewed By: hoy, wenlei

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

2 years ago[tests] Refresh autogen tests for SLP
Philip Reames [Sun, 23 Jan 2022 15:51:24 +0000 (07:51 -0800)]
[tests] Refresh autogen tests for SLP

2 years ago[RISCV] Add missing space to 'clang-format on' directive. NFC
Craig Topper [Tue, 25 Jan 2022 00:56:29 +0000 (16:56 -0800)]
[RISCV] Add missing space to 'clang-format on' directive. NFC

Without a space after the comment characters it seems to be ignored.

2 years ago[X86] combinePredicateReduction - generalize allof(cmpeq(x,0)) handling to allof...
Simon Pilgrim [Tue, 25 Jan 2022 00:24:06 +0000 (00:24 +0000)]
[X86] combinePredicateReduction - generalize allof(cmpeq(x,0)) handling to allof(cmpeq(x,y))

There's no further reasons to limit this to cmpeq-with-zero, the outstanding regressions with lowering to PTEST have now been addressed

Improves codegen for Issue #53379

2 years ago[clang][dataflow] Avoid MaxIterations overflow
Jan Korous [Sat, 22 Jan 2022 01:11:05 +0000 (17:11 -0800)]
[clang][dataflow] Avoid MaxIterations overflow

unsigned is technically guaranteed to be only 16 bits in which case 1 << 16 would wrap around to zero.

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

2 years ago[clang][Driver] use DWARF4 for wasm
Derek Schuff [Mon, 24 Jan 2022 22:59:54 +0000 (14:59 -0800)]
[clang][Driver] use DWARF4 for wasm

Opt into the old default of DWARF4 for now.

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

2 years ago[mlir] Add support for ExpM1 to GLSL/OpenCL SPIRV Backends
Rob Suderman [Mon, 24 Jan 2022 23:38:30 +0000 (15:38 -0800)]
[mlir] Add support for ExpM1 to GLSL/OpenCL SPIRV Backends

Adding a similar decomposition for exponential minus one to the SPIRV
backends along with the necessary tests.

Reviewed By: antiagainst

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

2 years ago[mlir] NFC control-flow sink cleanup
Mogball [Mon, 24 Jan 2022 23:31:00 +0000 (23:31 +0000)]
[mlir] NFC control-flow sink cleanup

2 years ago[libc] Let header generator generate the type header inclusion boiler plate.
Siva Chandra Reddy [Fri, 21 Jan 2022 06:23:59 +0000 (06:23 +0000)]
[libc] Let header generator generate the type header inclusion boiler plate.

Reviewed By: michaelrj

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

2 years ago[libc++] Remove std::basic_string's base class in ABIv2
Nikolas Klauser [Mon, 24 Jan 2022 18:44:34 +0000 (19:44 +0100)]
[libc++] Remove std::basic_string's base class in ABIv2

Remove `std::basic_string`'s base class in ABI version 2

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

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

2 years ago[libc++][NFC] remove this-> when calling member functions in <string>
Nikolas Klauser [Tue, 28 Dec 2021 12:09:40 +0000 (13:09 +0100)]
[libc++][NFC] remove this-> when calling member functions in <string>

remove `this->` when calling member functions

Reviewed By: Quuxplusone, Mordante, ldionne, #libc

Spies: libcxx-commits

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

2 years ago[lldb] Add ConstString memory usage statistics
Jonas Devlieghere [Mon, 24 Jan 2022 23:12:18 +0000 (15:12 -0800)]
[lldb] Add ConstString memory usage statistics

Add statistics about the memory usage of the string pool. I'm
particularly interested in the memory used by the allocator, i.e. the
number of bytes actually used by the allocator it self as well as the
number of bytes allocated through the allocator.

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

2 years agoDWARFv5 default: Switch bolt tests to use DWARFv4 since Bolt doesn't support v5 yet
David Blaikie [Mon, 24 Jan 2022 23:02:49 +0000 (15:02 -0800)]
DWARFv5 default: Switch bolt tests to use DWARFv4 since Bolt doesn't support v5 yet

Rough attempt to fix these, since I don't have bolt building locally.
Will see how the buildbots go with it...

2 years ago[mlir] Add a ControlFlowSink pass.
Mogball [Mon, 24 Jan 2022 23:00:39 +0000 (23:00 +0000)]
[mlir] Add a ControlFlowSink pass.

Control-Flow Sink moves operations whose only uses are in conditionally-executed regions into those regions so that paths in which their results are not needed do not perform unnecessary computation.

Depends on D115087

Reviewed By: jpienaar, rriddle, bondhugula

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

2 years ago[ObjC Availability] Add missing const to getVersion function of ObjCAvailabilityCheck...
Chaoshuai Lu [Mon, 24 Jan 2022 22:51:37 +0000 (14:51 -0800)]
[ObjC Availability] Add missing const to getVersion function of ObjCAvailabilityCheckExpr class

Add missing const to `getVersion` function of `ObjCAvailabilityCheckExpr` class.

This feels like a bug on the original change D22171. We cannot really call this function from a const object pointer because the function is not marked as const.

This diff adds the missing const specifier to fix the issue.

Reviewed By: manmanren

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

2 years ago[Fuchsia] Remove i386 from iossim architectures
Petr Hosek [Mon, 24 Jan 2022 21:31:58 +0000 (13:31 -0800)]
[Fuchsia] Remove i386 from iossim architectures

This is no longer supported in newer SDK versions.

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

2 years ago[MLIR][Presburger] use braces for single-line loop when inner if uses braces [NFC]
Arjun P [Mon, 24 Jan 2022 22:38:14 +0000 (04:08 +0530)]
[MLIR][Presburger] use braces for single-line loop when inner if uses braces [NFC]

2 years ago[MLIR][Presburger] LinearTransform: rename multiplication functions to be more intuitive
Arjun P [Mon, 24 Jan 2022 22:17:02 +0000 (03:47 +0530)]
[MLIR][Presburger] LinearTransform: rename multiplication functions to be more intuitive

2 years ago[SystemZ][z/OS]: fix lit tmp_dir to use - instead of _
Nancy Wang [Mon, 24 Jan 2022 22:44:17 +0000 (17:44 -0500)]
[SystemZ][z/OS]: fix lit tmp_dir to use - instead of _

Latest upstream change in https://reviews.llvm.org/D117179 causes lit regressions on z/OS, when TMPDIR is exported and contains _, ld linker fails, it doesnt recognize _ specified in SYSLIN. this seems a limitation on z/OS. we need to fix lit.

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

2 years ago[X86] combinePredicateReduction - split vXi16 allof(cmpeq()) to vXi8 allof(cmpeq())
Simon Pilgrim [Mon, 24 Jan 2022 22:43:16 +0000 (22:43 +0000)]
[X86] combinePredicateReduction - split vXi16 allof(cmpeq()) to vXi8 allof(cmpeq())

vXi16 patterns allof(cmp()) reduction patterns will have to be pack the comparison results to vXi8 to use PMOVMSKB.

If we're reducing cmpeq(), then we can compare the vXi8 halves directly - similar to what we already do for vXi64 -> vXi32 for cases without PCMPEQQ.

2 years ago[AMDGPU][NFC] Update to AMDGPUUsage for default Code Object Version
Changpeng Fang [Mon, 24 Jan 2022 22:33:12 +0000 (14:33 -0800)]
[AMDGPU][NFC] Update to AMDGPUUsage for default Code Object Version

Summary:
  Update the documentation for default code object version (from v3 to v4).

Reviewers:
  kzhuravl

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

2 years ago[CMake] Pass CMAKE_C/CXX_COMPILER_LAUNCHER down to cross-compile and runtime build
Yuanfang Chen [Mon, 24 Jan 2022 21:42:47 +0000 (13:42 -0800)]
[CMake] Pass CMAKE_C/CXX_COMPILER_LAUNCHER down to cross-compile and runtime build

Similar to D59032.

Reviewed By: dexonsmith

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

2 years ago[CMake] Fixes /INCREMENTAL detection when considering adding /Brepro
Yuanfang Chen [Mon, 24 Jan 2022 21:42:39 +0000 (13:42 -0800)]
[CMake] Fixes /INCREMENTAL detection when considering adding /Brepro

/INCREMENTAL is the linker default (lld-link and MSVC link). Specifying
"/INCREMENTAL:NO" is the only way to disable it. So checking for the
negative flag instead and check exe/module/shared link flags
independently.

Reviewed By: rnk

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

2 years ago[NFC][clangd] Use table to collect option aliases
Yuanfang Chen [Mon, 24 Jan 2022 21:42:04 +0000 (13:42 -0800)]
[NFC][clangd] Use table to collect option aliases

* Suppress a lot of `-Wtautological-compare` warning
* Speed up file build a little bit

Reviewed By: kadircet

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

2 years ago[X86] combineSetCCMOVMSK - detect and(pcmpeq(),pcmpeq()) ptest pattern.
Simon Pilgrim [Mon, 24 Jan 2022 21:41:57 +0000 (21:41 +0000)]
[X86] combineSetCCMOVMSK - detect and(pcmpeq(),pcmpeq()) ptest pattern.

Handle cases where we've split an allof(cmpeq()) pattern to a legal vector type

2 years ago[MLIR] Add generic walk support to OpState
Rahul Joshi [Sat, 22 Jan 2022 14:00:29 +0000 (06:00 -0800)]
[MLIR] Add generic walk support to OpState

- This allows calling the generic walkers on specific operation instances.

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

2 years ago[LoopVectorize] Add tests with reductions that are stored in invariant address
Igor Kirillov [Thu, 13 Jan 2022 12:57:50 +0000 (12:57 +0000)]
[LoopVectorize] Add tests with reductions that are stored in invariant address

This patch adds tests for functionality that is to be implemented in D110235.

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