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

2 years ago[PowerPC] Emit warning when SP is clobbered by asm
Quinn Pham [Mon, 29 Nov 2021 15:12:51 +0000 (09:12 -0600)]
[PowerPC] Emit warning when SP is clobbered by asm

This patch emits a warning when the stack pointer register (`R1`) is found in
the clobber list of an inline asm statement. Clobbering the stack pointer is
not supported.

Reviewed By: #powerpc, nemanjai

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

2 years ago[libcxx][test] the domain of == for forward iterators is iterator values from the...
Casey Carter [Thu, 30 Dec 2021 01:21:52 +0000 (17:21 -0800)]
[libcxx][test] the domain of == for forward iterators is iterator values from the same range

* Default-initialized `basic_string` iterators are not portably in the domain of `==`.
* Avoid comparing iterators from non-equal string_views which MSVCSTL considers not to be in the domain of equality.
* Don't test invalid range `[in, out + N)`.

Also silence some truncation warnings by testing with a non-narrowing conversion.

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

2 years ago[lldb/test] Fix `TestScriptedProcess.test_scripted_process_and_scripted_thread`
Med Ismail Bennani [Mon, 24 Jan 2022 20:45:00 +0000 (21:45 +0100)]
[lldb/test] Fix `TestScriptedProcess.test_scripted_process_and_scripted_thread`

This patch updates `dummy_scripted_process.py` to report the dummy
thread correctly to reflect the changes introduced by `d3e0f7e`.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[libc++][CI] Re-enable all CI jobs
Louis Dionne [Sun, 9 Jan 2022 14:36:08 +0000 (09:36 -0500)]
[libc++][CI] Re-enable all CI jobs

This essentially reverts commit 89f4a18f371d8 now that our CI is back
online at full capacity.

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

2 years ago[libc++] Make sure basic_string::reserve(n) never shrinks in all Standard modes
Louis Dionne [Fri, 14 Jan 2022 17:30:22 +0000 (12:30 -0500)]
[libc++] Make sure basic_string::reserve(n) never shrinks in all Standard modes

Since basic_string::reserve(n) is instantiated in the shared library but also
available to the compiler for inlining, its definition should not depend on
things like the Standard mode in use. Indeed, that flag may not match between
how the shared library is compiled and how users are compiling their own code,
resulting in ODR violations.

However, note that we retain the behavior of basic_string::reserve() to
shrink the string for backwards compatibility reasons. While it would
technically be conforming to not shrink, we believe user expectation is
for it to shrink, and so existing code might have been written based on
that assumption. We prefer to not break such code, even though that makes
basic_string::reserve() and basic_string::reserve(0) not equivalent anymore.

Fixes llvm-project#53170

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

2 years ago[BOLT] Add missing <memory> in InstrumentationRuntimeLibrary.h
Amir Ayupov [Mon, 24 Jan 2022 20:03:35 +0000 (12:03 -0800)]
[BOLT] Add missing <memory> in InstrumentationRuntimeLibrary.h

<memory> is no longer included as a result of 5f290c090a24
("Move STLFunctionalExtras out of STLExtras").

Reviewed By: maksfb

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

2 years ago[InstCombine] add tests for icmp with masked mul operand; NFC
Sanjay Patel [Mon, 24 Jan 2022 19:16:23 +0000 (14:16 -0500)]
[InstCombine] add tests for icmp with masked mul operand; NFC

More coverage for D114272

2 years ago[test] Fix no-undef-type-md.ll.
Jordan Rupprecht [Mon, 24 Jan 2022 20:01:25 +0000 (12:01 -0800)]
[test] Fix no-undef-type-md.ll.

There are two test issues:
- The test assumes the current directory is writeable, but it may not be. Use `%t.o`-like paths instead of implicit `a.out`.
- The `RUN llvm-nm` line is missing a colon, so the test was not being exercised.

2 years ago[DAGCombine] Remove unused param in combineCarryDiamond(). NFC
Paweł Bylica [Mon, 24 Jan 2022 18:22:56 +0000 (19:22 +0100)]
[DAGCombine] Remove unused param in combineCarryDiamond(). NFC

2 years ago[AMDGPU] Make v8i16/v8f16 legal
Stanislav Mekhanoshin [Wed, 19 Jan 2022 20:51:04 +0000 (12:51 -0800)]
[AMDGPU] Make v8i16/v8f16 legal

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

2 years ago[lldb/Interpreter] Make `ScriptedInterface::ErrorWithMessage` static (NFC)
Med Ismail Bennani [Tue, 18 Jan 2022 11:56:42 +0000 (12:56 +0100)]
[lldb/Interpreter] Make `ScriptedInterface::ErrorWithMessage` static (NFC)

This patch changes the `ScriptedInterface::ErrorWithMessage` method to
make it `static` which makes it easier to call.

The patch also updates its various call sites to reflect this change.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/Plugins] Fix ScriptedThread IndexID reporting
Med Ismail Bennani [Tue, 18 Jan 2022 11:52:24 +0000 (12:52 +0100)]
[lldb/Plugins] Fix ScriptedThread IndexID reporting

When listing all the Scripted Threads of a ScriptedProcess, we can see that all
have the thread index set to 1. This is caused by the lldb_private::Thread
constructor, which sets the m_index_id member using the provided thread id `tid`.

Because the call to the super constructor is done before instantiating
the `ScriptedThreadInterface`, lldb can't fetch the thread id from the
script instance, so it uses `LLDB_INVALID_THREAD_ID` instead.

To mitigate this, this patch takes advantage of the `ScriptedThread::Create`
fallible constructor idiom to defer calling the `ScriptedThread` constructor
(and the `Thread` super constructor with it), until we can fetch a valid
thread id `tid` from the `ScriptedThreadInterface`.

rdar://87432065

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/Plugins] Enrich ScriptedThreads Stop Reasons with Exceptions
Med Ismail Bennani [Tue, 18 Jan 2022 11:46:17 +0000 (12:46 +0100)]
[lldb/Plugins] Enrich ScriptedThreads Stop Reasons with Exceptions

This patch adds Exceptions to the list of supported stop reasons for
Scripted Threads.

The main motivation for this is that breakpoints are triggered as a
special exception class on ARM platforms, so adding it as a stop reason
allows the ScriptedProcess to selected the ScriptedThread that stopped at
a breakpoint (or crashed :p).

rdar://87430376

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/Plugins] Add support of multiple ScriptedThreads in a ScriptedProcess
Med Ismail Bennani [Tue, 18 Jan 2022 11:45:57 +0000 (12:45 +0100)]
[lldb/Plugins] Add support of multiple ScriptedThreads in a ScriptedProcess

This patch adds support of multiple Scripted Threads in a ScriptedProcess.

This is done by fetching the Scripted Threads info dictionary at every
ScriptedProcess::DoUpdateThreadList and iterate over each element to
create a new ScriptedThread using the object instance, if it was not
already available.

This patch also adds the ability to pass a pointer of a script interpreter
object instance to initialize a ScriptedInterface instead of having to call
the script object initializer in the ScriptedInterface constructor.

This is used to instantiate the ScriptedThreadInterface from the
ScriptedThread constructor, to be able to perform call on that script
interpreter object instance.

Finally, the patch also updates the scripted process test to check for
multiple threads.

rdar://84507704

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/Plugins] Move ScriptedThreadInterface to ScriptedThread
Med Ismail Bennani [Tue, 18 Jan 2022 11:45:27 +0000 (12:45 +0100)]
[lldb/Plugins] Move ScriptedThreadInterface to ScriptedThread

Since we can have multiple Scripted Threads per Scripted Process, having
only a single ScriptedThreadInterface (with a single object instance)
will cause the method calls to be done on the wrong object.

Instead, this patch creates a separate ScriptedThreadInterface for each
new lldb_private::ScriptedThread to make sure we interact with the right
instance.

rdar://87427911

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/Plugins] Add ScriptedProcess::GetThreadsInfo interface
Med Ismail Bennani [Tue, 18 Jan 2022 11:44:48 +0000 (12:44 +0100)]
[lldb/Plugins] Add ScriptedProcess::GetThreadsInfo interface

This patch adds a new method to the Scripted Process interface to
retrive a dictionary of Scripted Threads. It uses the thread ID as a key
and the Scripted Thread instance as the value.

This dictionary will be used to create Scripted Threads in lldb and
perform calls to the python scripted thread object.

rdar://87427126

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[AMDGPU] Remove cndmask from readsExecAsData
Stanislav Mekhanoshin [Fri, 21 Jan 2022 17:55:34 +0000 (09:55 -0800)]
[AMDGPU] Remove cndmask from readsExecAsData

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

2 years ago[NFC][MLGO] Simplify conditional compilation
Mircea Trofin [Mon, 24 Jan 2022 19:18:02 +0000 (11:18 -0800)]
[NFC][MLGO] Simplify conditional compilation

Most of the code that's shared between 'release' and 'development'
modes doesn't depend on anything special.

2 years ago[libc++][format] Finish P0645 Text Formatting.
Mark de Wever [Sat, 18 Dec 2021 14:03:26 +0000 (15:03 +0100)]
[libc++][format] Finish P0645 Text Formatting.

This adjust the version macro and sets it as completed. All parts of the paper
have been implemented, except for the parts replaced by later papers and
LWG-issues.

Adjusted the synopsis to match the synopsis in the Standard. Not yet
implemented parts of P2216 and P2418 still use the P0645 wording.

Completes:
- P0645 Text Formatting

Depends on D115991

Reviewed By: ldionne, #libc

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

2 years ago[libc++] Fix bugs in common_iterator; add test coverage.
Arthur O'Dwyer [Sat, 15 Jan 2022 18:29:26 +0000 (13:29 -0500)]
[libc++] Fix bugs in common_iterator; add test coverage.

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