platform/upstream/llvm.git
2 years agoRegenerate acle_st1*.c tests
Matt Devereau [Mon, 15 Nov 2021 15:02:46 +0000 (15:02 +0000)]
Regenerate acle_st1*.c tests

Regenerate acle_st1*.c tests using update_cc_test_checks.py

2 years ago[NFC][InstSimplify] add test cases with base results for or-xor fold
Mehrnoosh Heidarpour [Mon, 15 Nov 2021 15:02:09 +0000 (10:02 -0500)]
[NFC][InstSimplify] add test cases with base results for or-xor fold

This patch adds tests with baseline results as a pre-commit for D113861

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

2 years ago[SLP][NFC]Use `isa_and_nonnull` and fix comment, NFC.
Alexey Bataev [Mon, 15 Nov 2021 14:49:07 +0000 (06:49 -0800)]
[SLP][NFC]Use `isa_and_nonnull` and fix comment, NFC.

2 years agoFix an unused variable warning
Kirstóf Umann [Mon, 15 Nov 2021 14:45:01 +0000 (15:45 +0100)]
Fix an unused variable warning

2 years agoRevert "[GVN][NFC] Remove redundant check"
ksyx [Mon, 15 Nov 2021 14:03:15 +0000 (09:03 -0500)]
Revert "[GVN][NFC] Remove redundant check"

This reverts commit c35e8185d8c170c20e28956e0c9f3c1be895fefb.

mstorsjo reported in the revision thread that one VNCoercion assertion
is violated and seemly in relate to this commit. As per "If a test case
that demonstrates a problem is reported in the commit thread, please
revert and investigate offline", this commit is reverted.

2 years ago[SLP]Do not create unused gather nodes for scalar arguments of vector intrinsics.
Alexey Bataev [Fri, 12 Nov 2021 21:34:32 +0000 (13:34 -0800)]
[SLP]Do not create unused gather nodes for scalar arguments of vector intrinsics.

If the vector intrinsic has scalar argument, we currently still create
a tree entry for this argument. This entry is not used, just consumes
resources and increases the cost of the tree.

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

2 years ago[CMake] Allow passing extra options to extract_symbols.py.
Simon Tatham [Mon, 15 Nov 2021 14:01:21 +0000 (14:01 +0000)]
[CMake] Allow passing extra options to extract_symbols.py.

When cross-compiling LLVM in an environment where there //is// an
objdump binary available but it does not understand the target
platform's object file format, extract_symbols.py fails, because its
initial check for tool availability decides that the existence of
objdump at all is good enough to settle on it as the tool of choice.

In such an environment it's useful to work around this by telling
extract_symbols.py to use llvm-readobj instead. The script itself has
an option for that, but its invocation in AddLLVM.cmake wasn't
providing a mechanism to add extra options passed through for the
cmake command line.

Reviewed By: DavidSpickett

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

2 years ago[lldb] Unwrap the type when dereferencing the value
Andy Yankovsky [Thu, 11 Nov 2021 14:39:49 +0000 (15:39 +0100)]
[lldb] Unwrap the type when dereferencing the value

The value type can be a typedef of a reference (e.g. `typedef int& myint`).
In this case `GetQualType(type)` will return `clang::Typedef`, which cannot
be casted to `clang::ReferenceType`.

Fix a regression introduced in https://reviews.llvm.org/D103532.

Reviewed By: teemperor

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

2 years ago[fir] Add fir.select_type conversion placeholder
Valentin Clement [Mon, 15 Nov 2021 13:35:44 +0000 (14:35 +0100)]
[fir] Add fir.select_type conversion placeholder

As for D113662, this patch just add a place holder for
the `fir.select_type` operation conversion. This operation
is part of F20xx and is not implemented yet.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan

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

2 years ago[IVDescriptor] Make sure the sign is included for negative extension.
Florian Hahn [Mon, 15 Nov 2021 10:31:07 +0000 (10:31 +0000)]
[IVDescriptor] Make sure the sign is included for negative extension.

At the moment, computeRecurrenceType does not include any sign bits in
the maximum bit width. If the value can be negative, this means the sign
bit will be missing and the sext won't properly extend the value.

If the value can be negative, increment the bitwidth by one to make sure
there is at least one sign bit in the result value.

Note that the increment is also needed *if* the value is *known* to be
negative, as a sign bit needs to be preserved for the sext to work.

Note that this at the moment prevents vectorization, because the
analysis computes i1 as type for the recurrence when looking through the
AND in lookThroughAnd.

Fixes PR51794, PR52485.

Reviewed By: spatel

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

2 years ago[libcxx] Fix enable_if condition of std::reverse_iterator::operator=
Mikhail Maltsev [Mon, 15 Nov 2021 13:08:36 +0000 (13:08 +0000)]
[libcxx] Fix enable_if condition of std::reverse_iterator::operator=

The template std::is_assignable<T, U> checks that T is assignable from
U. Hence, the order of operands in the instantiation of
std::is_assignable in the std::reverse_iterator::operator= condition
should be reversed.

This issue remained unnoticed because std::reverse_iterator has an
implicit conversion constructor. This patch adds a test to check that
the assignment operator is used directly, without any implicit
conversions. The patch also adds a similar test for
std::move_iterator.

Reviewed By: Quuxplusone, ldionne, #libc

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

2 years ago[llvm-nm][test] Move X86 lit.local.cfg into the X86 subfolder
James Henderson [Mon, 15 Nov 2021 11:49:47 +0000 (11:49 +0000)]
[llvm-nm][test] Move X86 lit.local.cfg into the X86 subfolder

The file seems to have been put in the wrong place in its original
commit. This had the effect of marking all llvm-nm tests as unsupported,
unless X86 was enabled, even for tests that weren't X86 specific.

Fixes https://bugs.llvm.org/show_bug.cgi?id=52506.

Reviewed by: mstorsjo

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

2 years ago[mlir][Linalg] Fix and improve vectorization of depthwise convolutions.
Nicolas Vasilache [Mon, 15 Nov 2021 12:47:18 +0000 (12:47 +0000)]
[mlir][Linalg] Fix and improve vectorization of depthwise convolutions.

When trying to connect the vectorization of depthwise convolutions to e2e execution
a number of problems surfaced.
Fix an off-by-one error on the size of the input vector (similary to what was previously done for regular conv).
Rewrite the lowering to vector.fma instead of vector.contract: the KW reduction dimension has already been unrolled and vector.contract requires a reduction dimension to be valid.

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

2 years ago[mlir][Linalg] Add bounded recursion declaration to FMAOp -> LLVM conversion.
Nicolas Vasilache [Mon, 15 Nov 2021 12:19:00 +0000 (12:19 +0000)]
[mlir][Linalg] Add bounded recursion declaration to FMAOp -> LLVM conversion.

FMAOp -> LLVM conversion is done progressively by peeling off 1 dimension from FMAOp at each pattern iteration. Add the recursively bounded property declaration to the pattern so that the rewriter can apply it multiple times.

Without this, FMAOps with 3+D do not lower to LLVM.

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

2 years ago[mlir] Move min/max ops from Std to Arith.
Alexander Belyaev [Mon, 15 Nov 2021 11:52:37 +0000 (12:52 +0100)]
[mlir] Move min/max ops from Std to Arith.

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

2 years ago[clang-tidy] Fix a crash in modernize-loop-convert around conversion operators
Kristóf Umann [Thu, 14 Oct 2021 12:30:58 +0000 (14:30 +0200)]
[clang-tidy] Fix a crash in modernize-loop-convert around conversion operators

modernize-loop-convert checks and fixes when a loop that iterates over the
elements of a container can be rewritten from a for(...; ...; ...) style into
the "new" C++11 for-range format. For that, it needs to parse the elements of
that loop, like its init-statement, such as ItType it = cont.begin().
modernize-loop-convert checks whether the loop variable is initialized by a
begin() member function.

When an iterator is initialized with a conversion operator (e.g. for
(const_iterator it = non_const_container.begin(); ...), attempts to retrieve the
name of the initializer expression resulted in an assert, as conversion
operators don't have a valid IdentifierInfo.

I fixed this by making digThroughConstructors dig through conversion operators
as well.

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

2 years ago[mlir] DialectConversion: fix OperationLegalizer::isIllegal result when legality...
Butygin [Thu, 28 Oct 2021 16:04:35 +0000 (19:04 +0300)]
[mlir] DialectConversion: fix OperationLegalizer::isIllegal result when legality callback returns None

OperationLegalizer::isIllegal returns false if operation legality wasn't
registered by user and we expect same behaviour when dynamic legality
callback return None, but instead true was returned.

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

2 years ago[mlir][Linalg] Fix off-by-one error in conv vector size computation.
Nicolas Vasilache [Mon, 15 Nov 2021 10:58:47 +0000 (10:58 +0000)]
[mlir][Linalg] Fix off-by-one error in conv vector size computation.

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

2 years agoRevert "[x86] fold vector (X > -1) & Y to shift+andn"
Hans Wennborg [Mon, 15 Nov 2021 11:07:02 +0000 (12:07 +0100)]
Revert "[x86] fold vector (X > -1) & Y to shift+andn"

This casued assertion failures:

  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:9446:
  void llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode *, llvm::SDNode *):
  Assertion `(!From->hasAnyUseOfValue(i) || From->getValueType(i) == To->getValueType(i))
  && "Cannot use this version of ReplaceAllUsesWith!"' failed.

See comment on the code review.

(Had to update some expectations in test/CodeGen/X86/vselect-zero.ll
 manually due to other changes having landed after the reverted one.)

> and (pcmpgt X, -1), Y --> pandn (vsrai X, BitWidth-1), Y
>
> This avoids the -1 constant vector in favor of an arithmetic shift
> instruction if it exists (the ISA is still not complete after all
> these years...).
>
> We catch this pattern late in combining by matching PCMPGT, so it
> should not interfere with more general folds.
>
> Differential Revision: https://reviews.llvm.org/D113603

This reverts commit bf5748a1af0d2f6f9396d9dc6ac89d15de41eee7.

2 years ago[cmake] use project relative paths when generating ASTNodeAPI.json
Matheus Izvekov [Thu, 11 Nov 2021 12:48:43 +0000 (13:48 +0100)]
[cmake] use project relative paths when generating ASTNodeAPI.json

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: stephenneuendorffer

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

2 years ago[flang][CodeGen] Transform `fir.emboxchar` to a sequence of LLVM MLIR
Andrzej Warzynski [Thu, 11 Nov 2021 13:14:01 +0000 (13:14 +0000)]
[flang][CodeGen] Transform `fir.emboxchar` to a sequence of LLVM MLIR

This patch extends the `FIRToLLVMLowering` pass in Flang by adding a
hook to transform `fir.emboxchar` to a sequence of LLVM MLIR
instructions.

This is part of the upstreaming effort from the `fir-dev` branch in [1].

[1] https://github.com/flang-compiler/f18-llvm-project

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

Patch originally written by:
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[DAG] SimplifyVBinOp - add SDLoc() argument
Simon Pilgrim [Fri, 12 Nov 2021 18:52:00 +0000 (18:52 +0000)]
[DAG] SimplifyVBinOp - add SDLoc() argument

Pass in SDLoc instead of (repeated) local creations in SimplifyVBinOp and scalarizeBinOpOfSplats

2 years ago[DAG] SimplifyVBinOp - pull out repeated getValueType() call. NFC.
Simon Pilgrim [Fri, 12 Nov 2021 18:20:15 +0000 (18:20 +0000)]
[DAG] SimplifyVBinOp - pull out repeated getValueType() call. NFC.

2 years ago[mlir][linalg][bufferize] Allow non-tensor mappings in BufferizationState
Matthias Springer [Mon, 15 Nov 2021 10:34:58 +0000 (19:34 +0900)]
[mlir][linalg][bufferize] Allow non-tensor mappings in BufferizationState

This change makes it possible to set up custom mappings in a PostAnalysisStep. Some users of Comprehensive Bufferize have custom tensor types and it is most convenient to just reuse the same bvm.

Also add some more assertions.

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

2 years ago[mlir] NFC - Add VectorType::Builder to more easily build vector types from existing...
Nicolas Vasilache [Mon, 15 Nov 2021 10:29:25 +0000 (10:29 +0000)]
[mlir] NFC - Add VectorType::Builder to more easily build vector types from existing ones

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

2 years ago[mlir][linalg][bufferize] Fix insertion point of result buffers
Matthias Springer [Mon, 15 Nov 2021 10:27:03 +0000 (19:27 +0900)]
[mlir][linalg][bufferize] Fix insertion point of result buffers

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

2 years ago[MachineVerifier] Live interval for a subreg must have subranges
Jay Foad [Tue, 26 Oct 2021 16:17:19 +0000 (17:17 +0100)]
[MachineVerifier] Live interval for a subreg must have subranges

MachineVerifier verified the subranges of a live interval if
they existed, but did not complain if they did not exist.

This patch changes the verifier to complain if there are no
subranges in the live interval for a subreg operand (so long
as MachineRegisterInfo says we should be tracking subreg
liveness for that register). This matches the conditions for
LiveIntervalCalc to create subranges in the first place.

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

2 years ago[lldb/test] Fix std-module vector tests to work with both kinds of vector layouts
Pavel Labath [Mon, 15 Nov 2021 10:07:43 +0000 (11:07 +0100)]
[lldb/test] Fix std-module vector tests to work with both kinds of vector layouts

D112976 changed the layout and 0d62e31c45 andjusted the test
expectations to match.

This patch changes the tests to expect both versions, so that one can
run the test suite against older libc++ versions as well.

2 years ago[AMDGPU][MC][GFX10] Corrected global_atomic_fcmpswap*
Dmitry Preobrazhensky [Mon, 15 Nov 2021 09:45:39 +0000 (12:45 +0300)]
[AMDGPU][MC][GFX10] Corrected global_atomic_fcmpswap*

Corrected src data size of global_atomic_fcmpswap and global_atomic_fcmpswap_x2 opcodes.

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

2 years ago[ARM] Fix GatherScatter AddLikeOr condition
David Green [Mon, 15 Nov 2021 09:44:41 +0000 (09:44 +0000)]
[ARM] Fix GatherScatter AddLikeOr condition

2 years agoFix a deadlock in __cxa_guard_abort in tsan
Matt Kulukundis [Mon, 15 Nov 2021 09:31:19 +0000 (10:31 +0100)]
Fix a deadlock in __cxa_guard_abort in tsan

hat tip: @The_Whole_Daisy for helping to isolate

Reviewed By: dvyukov, fowles

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

2 years ago[fir] Add !fir.len type conversion
Valentin Clement [Mon, 15 Nov 2021 09:17:50 +0000 (10:17 +0100)]
[fir] Add !fir.len type conversion

This patch adds the !fir.len type conversion. The type is converted
to the a 32 bits integer.

This patch is part of the upstreaming effort from fir-dev branch.

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Reviewed By: kiranchandramohan

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

2 years ago[AArch64][SVE] Break false dependencies for inactive lanes of FP unary operations
Peter Waller [Mon, 15 Nov 2021 09:02:52 +0000 (09:02 +0000)]
[AArch64][SVE] Break false dependencies for inactive lanes of FP unary operations

Follow up to D105889, covering instructions using sve_fp_2op_p_zd_HSD:
frintn, frintp, frintm, frintz, frinta, frintx, frinti, frecpx and
fsqrt.

Reviewed By: bsmith

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

2 years ago[Flang] Fixup some comments. NFC
Diana Picus [Thu, 11 Nov 2021 08:13:46 +0000 (08:13 +0000)]
[Flang] Fixup some comments. NFC

Clarify some comments as discussed here:
https://github.com/flang-compiler/f18-llvm-project/pull/1210

2 years ago[ELF] Do not try to assign a memory region to a non-allocatable section
Igor Kudrin [Mon, 15 Nov 2021 08:59:39 +0000 (15:59 +0700)]
[ELF] Do not try to assign a memory region to a non-allocatable section

Non-allocatable sections are not part of the memory image of the
program, so there is no need to find memory regions for them either
matching properties or handling explicit assignments. The early test
and return help to simplify LinkerScript::findMemoryRegion() a bit.

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

2 years ago[VE] Fix SDNode user loop after efa896e5f7
Simon Moll [Mon, 15 Nov 2021 08:53:09 +0000 (09:53 +0100)]
[VE] Fix SDNode user loop after efa896e5f7

Rewriting SDNode user loops broke VEISelLowering (commit efa896e5f7).
This fixes it.

2 years ago[LV] Rename blockNeedsPredication to blockNeedsPredicationForAnyReason.
Sander de Smalen [Mon, 15 Nov 2021 08:03:52 +0000 (08:03 +0000)]
[LV] Rename blockNeedsPredication to blockNeedsPredicationForAnyReason.

The interface is a convenience function to ask if a block requires
predication when widening, but it's important that there are two
separate concepts to consider:
(A) The block was predicated in the original loop.
(B) The block was unpredicated in the original loop, but requires
    predication because of tail folding.

In the case of (B) we know that at least one lane of the vector will
be executed, which means we can implementing a load from a uniform address
with a scalar load + splat (D112552). In the case of predication because
of (A), we cannot do this, because the scalar load itself requires
predication.

The name 'blockNeedsPredication' does not make the distinction between
(A) and (B), hence the reason to rename it.

Reviewed By: david-arm

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

2 years ago[mlir][Linalg] Make depthwise convolution naming scheme consistent.
Nicolas Vasilache [Mon, 15 Nov 2021 07:54:07 +0000 (07:54 +0000)]
[mlir][Linalg] Make depthwise convolution naming scheme consistent.

Names should be consistent across all operations otherwise painful bugs will surface.

Reviewed By: rsuderman

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

2 years ago[clang-tidy] Fix `bugprone-use-after-move` check to also consider moves in constructo...
Fabian Wolff [Mon, 15 Nov 2021 07:28:46 +0000 (07:28 +0000)]
[clang-tidy] Fix `bugprone-use-after-move` check to also consider moves in constructor initializers

Fixes PR#38187. Constructors are actually already checked,
but only as functions, i.e. the check only looks at the
constructor body and not at the initializers, which misses
the (common) case where constructor parameters are moved
as part of an initializer expression.

One remaining false negative is when both the move //and//
the use-after-move occur in constructor initializers.
This is a lot more difficult to handle, though, because
the `bugprone-use-after-move` check is currently based on
a CFG that only takes the body into account, not the
initializers, so e.g. initialization order would have to
manually be considered. I will file a follow-up issue for
this once PR#38187 is closed.

Reviewed By: carlosgalvezp

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

2 years agoRevert "[mlir] FlatAffineConstraint parsing for unit tests"
Mehdi Amini [Mon, 15 Nov 2021 07:22:38 +0000 (07:22 +0000)]
Revert "[mlir] FlatAffineConstraint parsing for unit tests"

This reverts commit bec488b8183c06c409ddbdd49bbfe2709e407b32.

This commit introduced a layering violation between MLIR libraries.
Reverting for now while discussing on the original review thread.

2 years ago[DebugInfo] Fix Test Targets in D108261
Kyungwoo Lee [Mon, 15 Nov 2021 05:35:34 +0000 (21:35 -0800)]
[DebugInfo] Fix Test Targets in D108261

It appears REQUIRES are needed for tests added in D108261.
This was not caught in the pre-merge tests but in the post-commit tests.
he fix is to move the tests into the target sub-directories.

Reviewed By: dblaikie

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

2 years agoAdd more test coverage for D77598
David Blaikie [Mon, 15 Nov 2021 05:09:11 +0000 (21:09 -0800)]
Add more test coverage for D77598

Add coverage to demonstrate why including the type of template
parameters is necessary to disambiguate function template
specializations.

Test courtesy of Richard Smith

2 years agoast-print: Avoid extra whitespace before function opening brace
David Blaikie [Mon, 15 Nov 2021 04:44:27 +0000 (20:44 -0800)]
ast-print: Avoid extra whitespace before function opening brace

2 years agoast-dump: Add missing identation of class template specializations
David Blaikie [Mon, 15 Nov 2021 02:59:41 +0000 (18:59 -0800)]
ast-dump: Add missing identation of class template specializations

2 years agoAdd test for a case in D77598
David Blaikie [Mon, 15 Nov 2021 02:44:26 +0000 (18:44 -0800)]
Add test for a case in D77598

This covers the DeclPrinter::VisitCXXRecordDecl caller - though also
demonstrates some possible inconsistency in template specialization
printing.

2 years agoRe-apply "[mlir] Allow out-of-tree python building from installed MLIR."
Stella Laurenzo [Sun, 14 Nov 2021 22:44:25 +0000 (14:44 -0800)]
Re-apply "[mlir] Allow out-of-tree python building from installed MLIR."

Re-applies D111513:
* Adds a full-fledged Python example dialect and tests to the Standalone example (need to do a bit of tweaking in the top level CMake and lit tests to adapt better to if not building with Python enabled).
* Rips out remnants of custom extension building in favor of pybind11_add_module which does the right thing.
* Makes python and extension sources installable (outputs to src/python/${name} in the install tree): Both Python and C++ extension sources get installed as downstreams need all of this in order to build a derived version of the API.
* Exports sources targets (with our properties that make everything work) by converting them to INTERFACE libraries (which have export support), as recommended for the forseeable future by CMake devs. Renames custom properties to start with lower-case letter, as also recommended/required (groan).
* Adds a ROOT_DIR argument to declare_mlir_python_extension since now all C++ sources for an extension must be under the same directory (to line up at install time).
* Downstreams will need to adapt by:

  * Remove absolute paths from any SOURCES for declare_mlir_python_extension (I believe all downstreams are just using ${CMAKE_CURRENT_SOURCE_DIR} here, which can just be ommitted). May need to set ROOT_DIR if not relative to the current source directory.
  * To allow further downstreams to install/build, will need to make sure that all C++ extension headers are also listed under SOURCES for declare_mlir_python_extension.

This reverts commit 1a6c26d1f52999edbfbf6a978ae3f0e6759ea755.

Reviewed By: stephenneuendorffer

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

2 years ago[DebugInfo] Fix end_sequence of debug_line in LTO Object
Kyungwoo Lee [Mon, 15 Nov 2021 04:18:36 +0000 (20:18 -0800)]
[DebugInfo] Fix end_sequence of debug_line in LTO Object

In a LTO build, the `end_sequence` in debug_line table for each compile unit (CU) points the end of text section which merged all CUs. The `end_sequence` needs to point to the end of each CU's range. This bug often causes invalid `debug_line` table in the final `.dSYM` binary for MachO after running `dsymutil` which tries to compensate an out-of-range address of `end_sequence`.
The fix is to sync the line table termination with the range operations that are already maintained in DwarfDebug. When CU or section changes, or nodebug functions appear or module is finished, the prior pending line table is terminated using the last range label. In the MC path where no range is tracked, the old logic is conservatively used to end the line table using the section end symbol.

Reviewed By: dblaikie

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

2 years ago[msan] Fix test with GLIBC 2.34
Vitaly Buka [Mon, 15 Nov 2021 04:15:45 +0000 (20:15 -0800)]
[msan] Fix test with GLIBC 2.34

PTHREAD_STACK_MIN is not a constexpr

2 years ago[llvm] Use range-based for loops with instructions (NFC)
Kazu Hirata [Mon, 15 Nov 2021 03:40:48 +0000 (19:40 -0800)]
[llvm] Use range-based for loops with instructions (NFC)

2 years ago[llvm] Use isa instead of dyn_cast (NFC)
Kazu Hirata [Mon, 15 Nov 2021 03:40:46 +0000 (19:40 -0800)]
[llvm] Use isa instead of dyn_cast (NFC)

2 years ago[AMDGPU] Remove selectStoreIntrinsic (NFC)
Kazu Hirata [Mon, 15 Nov 2021 03:40:44 +0000 (19:40 -0800)]
[AMDGPU] Remove selectStoreIntrinsic (NFC)

The last use was removed on Jan 13, 2020 in commit
533d650e947a2f7216a315aeb8c79ac1d4740e5f.

2 years ago[NFC] Use Optional<ProfileCount> to model invalid counts
Mircea Trofin [Sun, 14 Nov 2021 06:03:10 +0000 (22:03 -0800)]
[NFC] Use Optional<ProfileCount> to model invalid counts

ProfileCount could model invalid values, but a user had no indication
that the getCount method could return bogus data. Optional<ProfileCount>
addresses that, because the user must dereference the optional. In
addition, the patch removes concept duplication.

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

2 years ago[PowerPC] guard update form prepare with non-const increment with option
Chen Zheng [Tue, 9 Nov 2021 09:47:48 +0000 (09:47 +0000)]
[PowerPC] guard update form prepare with non-const increment with option

Reviewed By: jsji

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

2 years ago[NFC] Trim trailing whitespace in *.rst
Shao-Ce SUN [Mon, 15 Nov 2021 01:17:08 +0000 (09:17 +0800)]
[NFC] Trim trailing whitespace in *.rst

2 years ago[sanitizer] Disable test incompartible with recert GLIBC
Vitaly Buka [Mon, 15 Nov 2021 00:21:07 +0000 (16:21 -0800)]
[sanitizer] Disable test incompartible with recert GLIBC

2 years ago[llvm-jitlink] Add an explicit -debugger-support option.
Lang Hames [Sun, 14 Nov 2021 23:42:45 +0000 (15:42 -0800)]
[llvm-jitlink] Add an explicit -debugger-support option.

Commit 69be352a196 restricted the MachO debugger support testcase to run on
Darwin only, but we still need to disable debugger support by default for
other noexec tests.

This patch introduces a -debugger-support option to llvm-jitlink that is
on-by-default when executing code, and off-by-default for noexec tests. This
should prevent regression tests from trying (and failing) to set up MachO
debugging support when running on non-Darwin platforms.

to explicitly enable/disable support.

2 years agoRevert "[clang] retain type sugar in auto / template argument deduction"
Matheus Izvekov [Sun, 14 Nov 2021 23:29:05 +0000 (00:29 +0100)]
Revert "[clang] retain type sugar in auto / template argument deduction"

This reverts commit 4d8fff477e024698facd89741cc6cf996708d598.

2 years ago[mlir][ods] AttrOrTypeDef format: parse types
Mogball [Sun, 14 Nov 2021 23:01:59 +0000 (23:01 +0000)]
[mlir][ods] AttrOrTypeDef format: parse types

Add template specialization to `FieldParser` for parsing types.

Reviewed By: mehdi_amini

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

2 years ago[mlir][ods] Fix unused uniqued attr constraint
Mogball [Sun, 14 Nov 2021 23:23:14 +0000 (23:23 +0000)]
[mlir][ods] Fix unused uniqued attr constraint

Derived attributes' constraints are no longer uniqued - derived
attributes' verifiers are not automatically generated.

2 years ago[gn build] Port 69be352a1961
LLVM GN Syncbot [Sun, 14 Nov 2021 22:53:50 +0000 (22:53 +0000)]
[gn build] Port 69be352a1961

2 years agoReapply "[ORC] Initial MachO debugging support (via GDB JIT debug.." with fixes.
Lang Hames [Sun, 14 Nov 2021 17:34:14 +0000 (09:34 -0800)]
Reapply "[ORC] Initial MachO debugging support (via GDB JIT debug.." with fixes.

This reapplies e1933a0488a50eb939210808fc895d374570d891 (which was reverted in
f55ba3525eb19baed7d3f23638cbbd880246a370 due to bot failures, e.g.
https://lab.llvm.org/buildbot/#/builders/117/builds/2768).

The bot failures were due to a missing symbol error: We use the input object's
mangling to decide how to mangle the debug-info registration function name. This
caused lookup of the registration function to fail when the input object
mangling didn't match the host mangling.

Disbaling the test on non-Darwin platforms is the easiest short-term solution.
I have filed https://llvm.org/PR52503 with a proposed longer term solution.

2 years agoUse std::make_unique instead of `new` to reinitalize a unique_ptr (NFC)
Mehdi Amini [Sun, 14 Nov 2021 22:28:54 +0000 (22:28 +0000)]
Use std::make_unique instead of `new` to reinitalize a unique_ptr (NFC)

Fix a clang-tidy warning.

2 years ago[LoopVectorize] Add PR41179 test case
Simon Pilgrim [Sun, 14 Nov 2021 21:53:24 +0000 (21:53 +0000)]
[LoopVectorize] Add PR41179 test case

2 years agoFollow-up to D77598: Simplify API by passing template parameters only when used/to...
David Blaikie [Sun, 14 Nov 2021 19:15:05 +0000 (11:15 -0800)]
Follow-up to D77598: Simplify API by passing template parameters only when used/to imply "TemplOverloaded/overloadable"

These arguments were redundant, and other parts of D77598 did rely on
the presence/absence of template parameters to imply whether types
should be included for the argument (like
clang::printTemplateArgumentList) so do that here too.

2 years ago[X86] Add getPack helper
Simon Pilgrim [Sun, 14 Nov 2021 21:27:15 +0000 (21:27 +0000)]
[X86] Add getPack helper

This helper provides a more complete approach for lowering to X86ISD::PACKSS/PACKUS nodes - testing for existing suitable sign/zero extension before recreating it.

It also optionally packs the upper half instead of the lower half.

2 years ago[llvm-reduce] Remove unnecessary loop.
Florian Hahn [Sat, 13 Nov 2021 20:05:58 +0000 (20:05 +0000)]
[llvm-reduce] Remove unnecessary loop.

After cd8aa234fdd2, there's no need to collect a vector of basic blocks
to keep first. Remove the first loop.

2 years ago[sanitizer] Fix test with GLIBC 2.34
Vitaly Buka [Sun, 14 Nov 2021 19:30:13 +0000 (11:30 -0800)]
[sanitizer] Fix test with GLIBC 2.34

2 years ago[SPARC] Zero-extend the operands when doing UMULO on 64-bit integers
Koakuma [Sun, 14 Nov 2021 18:56:41 +0000 (19:56 +0100)]
[SPARC] Zero-extend the operands when doing UMULO on 64-bit integers

On SPARC, S/UMULO operation on 64-bit integers works by extending the value to 128-bit, then doing a multiplication and checking the upper half of the result.
This makes UMULO works correctly by putting a zero in the upper half rather than doing a sign extension.

Reviewed By: LemonBoy

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

2 years ago[mlir] FlatAffineConstraint parsing for unit tests
Christian Ulmann [Sun, 14 Nov 2021 18:19:19 +0000 (23:49 +0530)]
[mlir] FlatAffineConstraint parsing for unit tests

This patch adds functionality to parse FlatAffineConstraints from a
StringRef with the intention to be used for unit tests. This should
make the construction of FlatAffineConstraints easier for testing
purposes.

The patch contains an example usage of the functionality in a unit test that
uses FlatAffineConstraints.

Reviewed By: bondhugula

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

2 years ago[clang] Use isa instead of dyn_cast (NFC)
Kazu Hirata [Sun, 14 Nov 2021 17:32:40 +0000 (09:32 -0800)]
[clang] Use isa instead of dyn_cast (NFC)

2 years ago[llvm] Use range-based for loops with User::operands (NFC)
Kazu Hirata [Sun, 14 Nov 2021 17:32:38 +0000 (09:32 -0800)]
[llvm] Use range-based for loops with User::operands (NFC)

2 years ago[llvm] Use range-based for loops with CallBase::args (NFC)
Kazu Hirata [Sun, 14 Nov 2021 17:32:36 +0000 (09:32 -0800)]
[llvm] Use range-based for loops with CallBase::args (NFC)

2 years ago[NFC][X86][Costmodel] Improve test coverage for {i16,i32,i64}->i8 vector trunc
Roman Lebedev [Sun, 14 Nov 2021 17:24:27 +0000 (20:24 +0300)]
[NFC][X86][Costmodel] Improve test coverage for {i16,i32,i64}->i8 vector trunc

2 years ago[NFC][X86][Costmodel] Improve test coverage for i8->{i16,i32,i64} vector *ext
Roman Lebedev [Sun, 14 Nov 2021 17:16:11 +0000 (20:16 +0300)]
[NFC][X86][Costmodel] Improve test coverage for i8->{i16,i32,i64} vector *ext

2 years ago[X86][Costmodel] `getReplicationShuffleCost()`: promote 16 bit-wide elements to 32...
Roman Lebedev [Sun, 14 Nov 2021 16:53:01 +0000 (19:53 +0300)]
[X86][Costmodel] `getReplicationShuffleCost()`: promote 16 bit-wide elements to 32 bit when no AVX512BW

The basic idea is simple, if we don't have native shuffle for this element type,
then we must have native shuffle for wider element type,
so promote, replicate, demote.

I believe, asking `getCastInstrCost(Instruction::Trunc` is correct semantically,
case in point `trunc <32 x i32> to <32 x i8>` aka 2 * ZMM will naively result in
2 * XMM, that then will be packed into 1 * YMM,
and it should count the cost of said packing,
not just the truncations.

Reviewed By: RKSimon

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

2 years ago[NFC][TTI] `getReplicationShuffleCost()`: s/Replicated/Dst/
Roman Lebedev [Sun, 14 Nov 2021 16:56:10 +0000 (19:56 +0300)]
[NFC][TTI] `getReplicationShuffleCost()`: s/Replicated/Dst/

'Replicated' is mouthful and somewhat ambigious,
while 'destination' is pretty self-explanatory.

2 years ago[InstCombine] add tests for or-xor logic fold; NFC
Mehrnoosh Heidarpour [Sun, 14 Nov 2021 16:06:07 +0000 (11:06 -0500)]
[InstCombine] add tests for or-xor logic fold; NFC

Baseline tests for D113783

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

2 years ago[IR] Define ptrauth intrinsics.
Ahmed Bougacha [Mon, 27 Sep 2021 15:00:00 +0000 (08:00 -0700)]
[IR] Define ptrauth intrinsics.

This defines the new `@llvm.ptrauth.` pointer authentication intrinsics:
sign, auth, strip, blend, and sign_generic, documented in PointerAuth.md.

Pointer Authentication is a mechanism by which certain pointers are
signed.  When a pointer gets signed, a cryptographic hash of its value
and other values (pepper and salt) is stored in unused bits of that
pointer.

Before the pointer is used, it needs to be authenticated, i.e., have its
signature checked.  This prevents pointer values of unknown origin from
being used to replace the signed pointer value.

sign and auth provide the core operations.  strip removes the ptrauth
bits from a signed pointer without checking them.  sign_generic allows
signing non-pointer values.  Finally, blend combines salt values
("discriminators") to derive more targeted and less reusable ones.

In later patches, we implement primary backend support for these
intrinsics using the AArch64 PAuth feature, and build on that to
implement the arm64e Darwin ABI and ELF PAuth ABI Extension in clang.

For more details, see the docs page, as well as our llvm-dev RFC:
  http://lists.llvm.org/pipermail/llvm-dev/2019-October/136091.html
or our 2019 Developers' Meeting talk.

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

2 years ago[X86][Costmodel] `trunc v8i64 to v16i16/v32i16` can appear after legalization, cost...
Roman Lebedev [Sun, 14 Nov 2021 15:41:38 +0000 (18:41 +0300)]
[X86][Costmodel] `trunc v8i64 to v16i16/v32i16` can appear after legalization, cost is same as for `trunc v8i64 to v8i16`

Same as D113842, but for i64

Reviewed By: RKSimon

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

2 years ago[X86][Costmodel] `trunc v16i32 to v32i16` can appear after legalization, cost is...
Roman Lebedev [Sun, 14 Nov 2021 15:41:37 +0000 (18:41 +0300)]
[X86][Costmodel] `trunc v16i32 to v32i16` can appear after legalization, cost is same as for `trunc v16i32 to v16i16`

This was noticed in D113609, hopefully it unblocks that patch.
There are likely other similar problems.

Reviewed By: RKSimon

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

2 years ago[NFC][InlineFunction] Renamed some vars to conform to coding style
Mircea Trofin [Sun, 14 Nov 2021 06:29:38 +0000 (22:29 -0800)]
[NFC][InlineFunction] Renamed some vars to conform to coding style

2 years ago[DAGCombiner] match inverted/swapped patterns for vselect of mask of signbit
Sanjay Patel [Sun, 14 Nov 2021 14:25:00 +0000 (09:25 -0500)]
[DAGCombiner] match inverted/swapped patterns for vselect of mask of signbit

This was noted as a follow-up to D113212 / D113426:
4fc1fc4005f7
7e30404c3b6c
11522cfcad6b

https://alive2.llvm.org/ce/z/e4o96b

The canonicalization rules for these IR patterns are complicated,
and we were not matching the expected forms in 2 out of the 3
cases. We can make codegen more robust by matching the swapped
forms (and that will also work if these patterns are created late).

2 years ago[clang-format][c++2b] support removal of the space between auto and {} in P0849R8
mydeveloperday [Sun, 14 Nov 2021 14:12:42 +0000 (14:12 +0000)]
[clang-format][c++2b] support removal of the space between auto and {} in P0849R8

Looks like the work of {D113393} requires manual clang-formatting intervention.
Removal of the space between `auto` and `{}`

Reviewed By: HazardyKnusperkeks, Quuxplusone

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

2 years ago[X86] Widen 128/256-bit VPTERNLOG patterns to 512-bit on non-VLX targets
Simon Pilgrim [Sun, 14 Nov 2021 13:40:53 +0000 (13:40 +0000)]
[X86] Widen 128/256-bit VPTERNLOG patterns to 512-bit on non-VLX targets

Similar to what we've done for other ops, this patch widens VPTERNLOG to a 512-bit op for non-VLX targets.

Fixes regressions in D113192

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

2 years ago[NFC][X86][Costmodel] Improve test coverage for {i32,i64}->i16 vector *ext
Roman Lebedev [Sun, 14 Nov 2021 13:07:30 +0000 (16:07 +0300)]
[NFC][X86][Costmodel] Improve test coverage for {i32,i64}->i16 vector *ext

See https://reviews.llvm.org/D113609 - some of these costs seem wrong.

2 years ago[NFC][X86][Costmodel] Improve test coverage for i16->{i32,i64} vector *ext
Roman Lebedev [Sun, 14 Nov 2021 12:47:52 +0000 (15:47 +0300)]
[NFC][X86][Costmodel] Improve test coverage for i16->{i32,i64} vector *ext

2 years ago[NFC][SROA] Revisit test coverage in non-capturing-call.ll
Roman Lebedev [Sun, 14 Nov 2021 12:29:32 +0000 (15:29 +0300)]
[NFC][SROA] Revisit test coverage in non-capturing-call.ll

2 years ago[TypePromotion] Extend TypePromotion::isSafeWrap
David Green [Sun, 14 Nov 2021 11:18:31 +0000 (11:18 +0000)]
[TypePromotion] Extend TypePromotion::isSafeWrap

This modifies the preconditions of TypePromotion's isSafeWrap
method, to allow it to work from all constants from the ICmp.
Using the code:
  %a = add %x, C1
  %c = icmp ult %a, C2

According to Alive, we can prove that is equivalent to
icmp ult (add zext(%x), sext(C1)), zext(C2)  given
C1 <=s 0 and C1 >s C2.
https://alive2.llvm.org/ce/z/CECYZB
Which is similar to what is already present. We can also
prove icmp ult (add zext(%x), sext(C1)), sext(C2) given
C1 <=s 0 and C1 <=s C2.
https://alive2.llvm.org/ce/z/KKgyeL

The PrepareWrappingAdds method was removed, and the
constants are now altered to sext or zext directly as
required by the above methods.

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

2 years ago[DwarfCompileUnit] getOrCreateCommonBlock(): check for existing entity first. NFCI
Kristina Bessonova [Tue, 2 Nov 2021 18:37:48 +0000 (20:37 +0200)]
[DwarfCompileUnit] getOrCreateCommonBlock(): check for existing entity first. NFCI

For global variables and common blocks there is no way to create entities
through getOrCreateContextDIE(), so no need to obtain the context first.

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

2 years ago[DwarfCompileUnit] getOrCreateGlobalVariableDIE(): remove outdated comment. NFC
Kristina Bessonova [Sun, 14 Nov 2021 08:56:44 +0000 (10:56 +0200)]
[DwarfCompileUnit] getOrCreateGlobalVariableDIE(): remove outdated comment. NFC

2 years ago[sanitizer] Another try to fix the test with GLIBC 2.34
Vitaly Buka [Sat, 13 Nov 2021 22:47:27 +0000 (14:47 -0800)]
[sanitizer] Another try to fix the test with GLIBC 2.34

2 years ago[gn build] Port f55ba3525eb1
LLVM GN Syncbot [Sun, 14 Nov 2021 08:26:05 +0000 (08:26 +0000)]
[gn build] Port f55ba3525eb1

2 years agoRevert "[ORC] Initial MachO debugging support (via GDB JIT debug..."
Lang Hames [Sun, 14 Nov 2021 08:14:39 +0000 (00:14 -0800)]
Revert "[ORC] Initial MachO debugging support (via GDB JIT debug..."

This reverts commit e1933a0488a50eb939210808fc895d374570d891 until I can look
into bot failures.

2 years ago[llvm] Use GetElementPtrInst::indices (NFC)
Kazu Hirata [Sun, 14 Nov 2021 05:43:28 +0000 (21:43 -0800)]
[llvm] Use GetElementPtrInst::indices (NFC)

2 years ago[sanitizer][aarch64] fix clone system call's inline assembly
hyeongyu kim [Sun, 14 Nov 2021 00:45:40 +0000 (09:45 +0900)]
[sanitizer][aarch64] fix clone system call's inline assembly

Return value of the system call was not returned normally.
It was discussed at https://reviews.llvm.org/D105169.

2 years ago[sanitizer] Fix test for GLIBC 2.31
Vitaly Buka [Sat, 13 Nov 2021 22:24:50 +0000 (14:24 -0800)]
[sanitizer] Fix test for GLIBC 2.31

Newer GLIBC uses sysconf to get SIGSTKSZ.

2 years ago[gn build] Port e1933a0488a5
LLVM GN Syncbot [Sat, 13 Nov 2021 21:44:00 +0000 (21:44 +0000)]
[gn build] Port e1933a0488a5

2 years ago[ORC] Initial MachO debugging support (via GDB JIT debug registration interface)
Lang Hames [Thu, 11 Nov 2021 23:19:21 +0000 (15:19 -0800)]
[ORC] Initial MachO debugging support (via GDB JIT debug registration interface)

This commit adds a new plugin, GDBJITDebugInfoRegistrationPlugin, that checks
for objects containing debug info and registers any debug info found via the
GDB JIT registration API.

To enable this registration without redundantly representing non-debug sections
this plugin synthesizes a new embedded object within a section of the LinkGraph.
An allocation action is used to make the registration call.

Currently MachO only. ELF users can still use the DebugObjectManagerPlugin. The
two are likely to be merged in the near future.

2 years ago[GVN][NFC] Remove redundant check
ksyx [Sat, 13 Nov 2021 20:59:43 +0000 (15:59 -0500)]
[GVN][NFC] Remove redundant check

The if-check above deleted part guarantees that StoreOffset <= LoadOffset
and that StoreOffset + StoreSize >= LoadOffset + LoadSize, and given that
LoadOffset + LoadSize > LoadOffset when LoadSize > 0. Thus, this shows
StoreOffset + StoreSize > LoadOffset is guaranteed given LoadSize > 0,
while it could be meaningless to have a type with nonpositive size, so that
the check could be removed.

Part of revision D100179
Reviewed By: nikic

2 years agoreland: [VFS] Use original path when falling back to external FS
Keith Smiley [Sat, 13 Nov 2021 18:13:38 +0000 (10:13 -0800)]
reland: [VFS] Use original path when falling back to external FS

This reverts commit f0cf544d6f6fe6cbca4c07772998272d6bb433d8.

Just a small change to fix:

```
/home/buildbot/as-builder-4/llvm-clang-x86_64-expensive-checks-ubuntu/llvm-project/llvm/lib/Support/VirtualFileSystem.cpp: In static member function ‘static llvm::ErrorOr<std::unique_ptr<llvm::vfs::File> > llvm::vfs::File::getWithPath(llvm::ErrorOr<std::unique_ptr<llvm::vfs::File> >, const llvm::Twine&)’:
/home/buildbot/as-builder-4/llvm-clang-x86_64-expensive-checks-ubuntu/llvm-project/llvm/lib/Support/VirtualFileSystem.cpp:2084:10: error: could not convert ‘F’ from ‘std::unique_ptr<llvm::vfs::File>’ to ‘llvm::ErrorOr<std::unique_ptr<llvm::vfs::File> >’
   return F;
          ^
```

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