platform/upstream/llvm.git
2 years ago[lldb] [test] Fix new signal tests to use remote-linux plugin
Michał Górny [Wed, 10 Nov 2021 17:07:36 +0000 (18:07 +0100)]
[lldb] [test] Fix new signal tests to use remote-linux plugin

Hopefully this will fix OSX and Windows buildbots

2 years ago[mlir][Linalg] Add interface method to Linalg ops to allow setting the output operand.
MaheshRavishankar [Wed, 10 Nov 2021 17:00:07 +0000 (09:00 -0800)]
[mlir][Linalg] Add interface method to Linalg ops to allow setting the output operand.

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

2 years ago[InstCombine] Add additional test with signed range check (NFC)
Nikita Popov [Wed, 10 Nov 2021 16:57:14 +0000 (17:57 +0100)]
[InstCombine] Add additional test with signed range check (NFC)

2 years ago[SCEV] Add tests that require rewriting zexts when applying guards.
Florian Hahn [Wed, 10 Nov 2021 16:58:27 +0000 (16:58 +0000)]
[SCEV] Add tests that require rewriting zexts when applying guards.

Precommit tests inspired by PR40961 and PR52464.

2 years ago[X86] combineMulToPMADDWD - remove useless TODO
Simon Pilgrim [Wed, 10 Nov 2021 16:16:20 +0000 (16:16 +0000)]
[X86] combineMulToPMADDWD - remove useless TODO

We should always be able to use PMULUDQ/PMULDQ in PMADDWD patterns with greater than 32-bit extended integer sources

2 years ago[OpenMP] Fix: opposite attributes could be set by -fno-inline
Igor Kirillov [Wed, 27 Oct 2021 15:21:54 +0000 (16:21 +0100)]
[OpenMP] Fix: opposite attributes could be set by -fno-inline

After the changes introduced by D106799 it is possible to tag
outlined function with both AlwaysInline and NoInline attributes using
-fno-inline command line options.
This issue is similiar to D107649.

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

2 years ago[lldb/test] Update TestScriptedProcess to use skinny corefiles
Med Ismail Bennani [Wed, 10 Nov 2021 16:11:22 +0000 (16:11 +0000)]
[lldb/test] Update TestScriptedProcess to use skinny corefiles

This patch changes the ScriptedProcess test to use a stack-only skinny
corefile as a backing store.

The corefile is saved as a temporary file at the beginning of the test,
and a second target is created for the ScriptedProcess. To do so, we use
the SBAPI from the ScriptedProcess' python script to interact with the
corefile process.

This patch also makes some small adjustments to the other ScriptedProcess
scripts to resolve some inconsistencies and removes the raw memory dump
that was previously checked in.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb/bindings] Change ScriptedThread initializer parameters
Med Ismail Bennani [Tue, 19 Oct 2021 23:30:22 +0000 (23:30 +0000)]
[lldb/bindings] Change ScriptedThread initializer parameters

This patch changes the `ScriptedThread` initializer in couple of ways:
- It replaces the `SBTarget` parameter by a `SBProcess` (pointing to the
  `ScriptedProcess` that "owns" the `ScriptedThread`).
- It adds a reference to the `ScriptedProcessInfo` Dictionary, to pass
  arbitrary user-input to the `ScriptedThread`.

This patch also fixes the SWIG bindings methods that call the
`ScriptedProcess` and `ScriptedThread` initializers by passing all the
arguments to the appropriate `PythonCallable` object.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[lldb] Fix Scripted ProcessLaunchInfo Argument nullptr deref
Med Ismail Bennani [Wed, 10 Nov 2021 16:43:19 +0000 (16:43 +0000)]
[lldb] Fix Scripted ProcessLaunchInfo Argument nullptr deref

This patch adds a new `StructuredData::Dictionary` constructor that
takes a `StructuredData::ObjectSP` as an argument. This is used to pass
the opaque_ptr from the `SBStructuredData` used to initialize a
ScriptedProecss, to the `ProcessLaunchInfo` class.

This also updates `SBLaunchInfo::SetScriptedProcessDictionary` to
reflect the formentionned changes which solves the nullptr deref.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[mlir][linalg] Remove getSmallestBoundingIndex (NFC).
Tobias Gysi [Wed, 10 Nov 2021 16:17:53 +0000 (16:17 +0000)]
[mlir][linalg] Remove getSmallestBoundingIndex (NFC).

Remove the getSmallestBoundingIndex method that has no uses anymore.

Depends On D113548

Reviewed By: nicolasvasilache

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

2 years ago[clang] Do not crash in APValue::prettyPrint() on forward-decl structs.
Adam Czachorowski [Wed, 10 Nov 2021 15:28:13 +0000 (16:28 +0100)]
[clang] Do not crash in APValue::prettyPrint() on forward-decl structs.

The call to getTypeSizeInChars() is replaced with
getTypeSizeInCharsIfKnown(), which does not crash on forward declared
structs. This only affects printing.

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

2 years ago[linalg][mlir] Replace getSmallestBoundingIndex in promotion (NFC).
Tobias Gysi [Wed, 10 Nov 2021 16:06:37 +0000 (16:06 +0000)]
[linalg][mlir] Replace getSmallestBoundingIndex in promotion (NFC).

Replace the getSmallestBoundingIndex method used in promotion by getConstantUpperBoundForIndex that uses flat affine constraints to compute a constant upper bound.

Depends On D113546

Reviewed By: nicolasvasilache

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

2 years ago[AArch64] Combine vector fptoi.sat(fmul) to fixed point fcvtz
David Green [Wed, 10 Nov 2021 16:12:48 +0000 (16:12 +0000)]
[AArch64] Combine vector fptoi.sat(fmul) to fixed point fcvtz

Similar to D113199 but dealing with the vector size, this extends the
fptosi+fmul to fixed point fold to handle fptosi.sat nodes that are
equally viable, so long as the saturation width matches the output
width.

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

2 years ago[NVPTX] Add imm variants for surface and texture instructions
Andrew Savonichev [Wed, 10 Nov 2021 16:02:27 +0000 (19:02 +0300)]
[NVPTX] Add imm variants for surface and texture instructions

Texture/sampler/surface operands can be either a register or an
immediate (an index of .texref, .samplerref or .surfref).

TableGen declarations for these instructions used to only have
Int64Regs operands, so this caused issues when machine verifier
is turned on:

    *** Bad machine code: Expected a register operand. ***
    - function:    bar
    - basic block: %bb.0  (0x55b144d99ab8)
    - instruction: %4:int32regs = SULD_1D_I32_TRAP 0, killed %2:int32regs
    - operand 1:   0

The solution is to duplicate these instructions for all possible
operand types (i16imm and Int64Regs). Since this would
essentially double the amount code in TableGen, the patch also
does some refactoring for the original instructions to keep
things manageable.

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

2 years ago[mlir][linalg] Use getUpperBoundForIndex in hoisting (NFC).
Tobias Gysi [Wed, 10 Nov 2021 15:55:16 +0000 (15:55 +0000)]
[mlir][linalg] Use getUpperBoundForIndex in hoisting (NFC).

Use the custom upper bound computation in hoisting by the new getUpperBoundForIndex method.

Depends On D113546

Reviewed By: nicolasvasilache

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

2 years ago[mli][linalg] Use CodegenStrategy to test interchange (NFC).
Tobias Gysi [Wed, 10 Nov 2021 15:38:15 +0000 (15:38 +0000)]
[mli][linalg] Use CodegenStrategy to test interchange (NFC).

Use CodegenStrategy instead of a separate test pass to test iterator interchange.

Depends On D113409

Reviewed By: nicolasvasilache

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

2 years ago[libFuzzer] Deflake entropic exec-time test.
Dokyung Song [Wed, 10 Nov 2021 15:42:58 +0000 (07:42 -0800)]
[libFuzzer] Deflake entropic exec-time test.

Entropic scheduling with exec-time option can be misled, if inputs
on the right path to become crashing inputs accidentally take more
time to execute before it's added to the corpus. This patch, by letting
more of such inputs added to the corpus (four inputs of size 7 to 10,
instead of a single input of size 2), reduces possibilities of being
influenced by timing flakiness.

A longer-term fix could be to reduce timing flakiness in the fuzzer;
one way could be to execute inputs multiple times and take average of
their execution time before they are added to the corpus.

Reviewed By: morehouse

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

2 years ago[aarch64/mac] Correctly disassemble @TLVPPAGE(OFF) relocs
Nico Weber [Fri, 29 Oct 2021 19:52:28 +0000 (15:52 -0400)]
[aarch64/mac] Correctly disassemble @TLVPPAGE(OFF) relocs

`llvm-otool -tV foo.o` and `llvm-objdump --macho -d foo.o` would
previously fail on object files containing @TLVPPAGE or @TLVPPAGEOFF relocs.

Move llvm-objdump-specific test from
llvm/test/MC/AArch64/arm64-tls-modifiers-darwin.s to new
llvm/test/tools/llvm-objdump/MachO/disassemble-arm64-tlv-modifers.test
and put test for this fix to that new file.

Fixes PR52356.

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

2 years ago[mlir][linalg] Remove padding test pass (NFC).
Tobias Gysi [Wed, 10 Nov 2021 15:30:37 +0000 (15:30 +0000)]
[mlir][linalg] Remove padding test pass (NFC).

Remove padding test pass that was replaced by CodegenStrategy.

Depends On D113411

Reviewed By: nicolasvasilache

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

2 years ago[OpenMP] Lower printf to __llvm_omp_vprintf
Jon Chesterfield [Wed, 10 Nov 2021 15:30:55 +0000 (15:30 +0000)]
[OpenMP] Lower printf to __llvm_omp_vprintf

Extension of D112504. Lower amdgpu printf to `__llvm_omp_vprintf`
which takes the same const char*, void* arguments as cuda vprintf and also
passes the size of the void* alloca which will be needed by a non-stub
implementation of `__llvm_omp_vprintf` for amdgpu.

This removes the amdgpu link error on any printf in a target region in favour
of silently compiling code that doesn't print anything to stdout.

Reviewed By: jdoerfert

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

2 years ago[NFC] Inclusive language: replace master with main in benchmark docs
Quinn Pham [Tue, 9 Nov 2021 21:34:26 +0000 (15:34 -0600)]
[NFC] Inclusive language: replace master with main in benchmark docs

[NFC] As part of using inclusive language within the llvm project and to match
the renamed master branch of `google/benchmark`, this patch replaces master with
main in the benchmark releasing docs.

Reviewed By: kbobyrev

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

2 years ago[DAG] reassociateOpsCommutative - pull out repeated getOperand() calls. NFC.
Simon Pilgrim [Wed, 10 Nov 2021 15:16:27 +0000 (15:16 +0000)]
[DAG] reassociateOpsCommutative - pull out repeated getOperand() calls. NFC.

2 years ago[linalg][mlir] Replace getSmallestBoundingIndex in padding (NFC).
Tobias Gysi [Wed, 10 Nov 2021 15:12:39 +0000 (15:12 +0000)]
[linalg][mlir] Replace getSmallestBoundingIndex in padding (NFC).

Replace the getSmallestBoundingIndex method used in padding by getConstantUpperBoundForIndex that uses flat affine constraints to compute a constant upper bound.

Depends On D113398

Reviewed By: nicolasvasilache

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

2 years ago[mlir][linalg] Use CodegenStrategy to test hoisting (NFC).
Tobias Gysi [Wed, 10 Nov 2021 15:06:16 +0000 (15:06 +0000)]
[mlir][linalg] Use CodegenStrategy to test hoisting (NFC).

Use CodegenStrategy instead of a separate test pass to test hoisting.

Depends On D113410

Reviewed By: nicolasvasilache

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

2 years ago[mli][linalg] Use CodegenStrategy to test padding (NFC).
Tobias Gysi [Wed, 10 Nov 2021 14:59:42 +0000 (14:59 +0000)]
[mli][linalg] Use CodegenStrategy to test padding (NFC).

Use CodegenStrategy instead of a separate test pass to test padding.

Depends On D113409

Reviewed By: nicolasvasilache

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

2 years ago[mlir][linalg] Use AffineApplyOp to compute padding width (NFC).
Tobias Gysi [Wed, 10 Nov 2021 14:15:41 +0000 (14:15 +0000)]
[mlir][linalg] Use AffineApplyOp to compute padding width (NFC).

Use AffineApplyOp instead of SubIOp to compute the padding width when creating a pad tensor operation.

Depends On D113382

Reviewed By: nicolasvasilache

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

2 years ago[InstCombine] add check for integer source type from cast to prevent crash
Sanjay Patel [Wed, 10 Nov 2021 14:32:33 +0000 (09:32 -0500)]
[InstCombine] add check for integer source type from cast to prevent crash

A problem was noted in the post-commit review for
c36b7e21bd8f04a44d6 / D113035 :

If the source type is not integer or integer vector,
then we could crash when trying to ComputeNumSignBits().

2 years ago[x86] shorten function name; NFC
Sanjay Patel [Wed, 10 Nov 2021 13:47:08 +0000 (08:47 -0500)]
[x86] shorten function name; NFC

2 years ago[x86] add tests for signbit splat mask patterns; NFC
Sanjay Patel [Tue, 9 Nov 2021 22:23:37 +0000 (17:23 -0500)]
[x86] add tests for signbit splat mask patterns; NFC

2 years ago[fir] Add fir.box_rank, fir.box_addr, fir.box_dims and fir.box_elesize conversion
Valentin Clement [Wed, 10 Nov 2021 14:28:26 +0000 (15:28 +0100)]
[fir] Add fir.box_rank, fir.box_addr, fir.box_dims and fir.box_elesize conversion

This patch adds conversion for basic box operations that extract
information from the box.

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

Reviewed By: awarzynski

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[fir] Use contralized values for indexing box
Valentin Clement [Wed, 10 Nov 2021 14:12:12 +0000 (15:12 +0100)]
[fir] Use contralized values for indexing box

Add constant to index the different values in a box so that
they can be reused for the codegen part as well.

Reviewed By: awarzynski

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

2 years ago[PowerPC] Respect rounding mode in the back end
Nemanja Ivanovic [Mon, 8 Nov 2021 19:41:46 +0000 (13:41 -0600)]
[PowerPC] Respect rounding mode in the back end

Currently, the floating point instructions that depend on
rounding mode are correctly marked in the PPC back end with
an implicit use of the RM register. Similarly, instructions
that explicitly define the register are marked with an
implicit def of the same register. So for the most part,
RM-using code won't be moved across RM-setting instructions.

However, calls are not marked as RM-setting instructions so
code can be moved across calls. This is generally desired,
but so is the ability to turn off this behaviour with an
appropriate option - and -frounding-math really should be
that option.

This patch provides a set of call instructions (for direct
and indirect calls) that are marked with an implicit def of
the RM register. These will be used for calls that are marked
with the strictfp attribute.

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

2 years ago[mli][linalg] Add flag to control CodegenStrategy enable pass.
Tobias Gysi [Wed, 10 Nov 2021 14:06:14 +0000 (14:06 +0000)]
[mli][linalg] Add flag to control CodegenStrategy enable pass.

Add a flag to control if CodegenStrategy runs the EnablePass between the transformations.

Depends On D113382

Reviewed By: nicolasvasilache

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

2 years ago[lldb] DeConstStringify the Property class
Pavel Labath [Wed, 10 Nov 2021 14:05:07 +0000 (15:05 +0100)]
[lldb] DeConstStringify the Property class

Most of the interfaces were converted already, this just converts the
internal implementation.

2 years ago[mlir][linalg] Hoist padding simplifications (NFC).
Tobias Gysi [Wed, 10 Nov 2021 13:43:50 +0000 (13:43 +0000)]
[mlir][linalg] Hoist padding simplifications (NFC).

Remove unused members and store the indexing and packing loops in SmallVector.

Reviewed By: nicolasvasilache

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

2 years ago[NFC][AArch64] Handle processLogicalImmediate error
Andrew Savonichev [Wed, 7 Apr 2021 16:05:54 +0000 (19:05 +0300)]
[NFC][AArch64] Handle processLogicalImmediate error

If processLogicalImmediate fails, we should return from the function
without changing InsInstrs or DelInstrs. This happens for
CodeGen/AArch64/urem-seteq-nonzero.ll LIT test as described in
https://reviews.llvm.org/D99662#2662296.

Callers of genAlternativeCodeSequence skip patterns where InsInstrs
stays empty, so this does not cause any issues now.

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

2 years ago[llvm-reduce] Use DenseSet instead of std::set (NFC).
Florian Hahn [Wed, 10 Nov 2021 13:56:22 +0000 (13:56 +0000)]
[llvm-reduce] Use DenseSet instead of std::set (NFC).

When reducing functions with very large basic blocks (~ almost 1 million
BBs), the majority of time is spent maintaining the order in the std::set
for the basic blocks to keep.

In those cases, DenseSet<> is much more efficient. Use it instead.

2 years ago[mlir][linalg] Remove padding from tiling options.
Tobias Gysi [Wed, 10 Nov 2021 13:07:19 +0000 (13:07 +0000)]
[mlir][linalg] Remove padding from tiling options.

Remove the padding options from the tiling options since padding is now implemented by a separate pattern/pass introduced in https://reviews.llvm.org/D112412.

The revsion remove the tile-and-pad-tensors.mlir and replaces it with the pad.mlir that tests padding in isolation (without tiling). Similarly, hoist-padding.mlir is replaced by pad-and-hoist.mlir introduced in https://reviews.llvm.org/D112713.

Depends On D112838

Reviewed By: nicolasvasilache

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

2 years ago[DAG] Split BuildVectorSDNode::getConstantRawBits into BuildVectorSDNode::recastRawBi...
Simon Pilgrim [Wed, 10 Nov 2021 13:06:07 +0000 (13:06 +0000)]
[DAG] Split BuildVectorSDNode::getConstantRawBits into BuildVectorSDNode::recastRawBits helper. NFC.

NFC refactor of D113351, pulling out the APInt split/merge code from the BuildVectorSDNode bits extraction into a BuildVectorSDNode::recastRawBits helper. This is to allow us to reuse the code when we're packing constant folded APInt data back together.

2 years ago[LV] Do not rely on InductionDescriptor::getCastInsts. (NFC)
Florian Hahn [Wed, 10 Nov 2021 13:03:44 +0000 (13:03 +0000)]
[LV] Do not rely on InductionDescriptor::getCastInsts. (NFC)

Now that CastDef is passed as VPValue, there is no need to access
ID.getCastInsts, as CastDef can instead be checked.

2 years ago[clang-repl] Allow Interpreter::getSymbolAddress to take a mangled name.
Vassil Vassilev [Mon, 30 Aug 2021 16:31:54 +0000 (16:31 +0000)]
[clang-repl] Allow Interpreter::getSymbolAddress to take a mangled name.

2 years ago[fir] Fixup comment. NFC
Diana Picus [Wed, 10 Nov 2021 12:48:03 +0000 (12:48 +0000)]
[fir] Fixup comment. NFC

Fixed comment as requested in https://reviews.llvm.org/D113560.

2 years ago[fir] Add !fir.char type conversion
Diana Picus [Wed, 10 Nov 2021 11:26:15 +0000 (11:26 +0000)]
[fir] Add !fir.char type conversion

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

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[fir] Add !fir.ptr type conversion
Diana Picus [Tue, 9 Nov 2021 16:36:24 +0000 (16:36 +0000)]
[fir] Add !fir.ptr type conversion

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

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[mlir] Reintroduce nano time to execution_engine
Denys Shabalin [Tue, 9 Nov 2021 16:03:51 +0000 (17:03 +0100)]
[mlir] Reintroduce nano time to execution_engine

Prior change had a broken test that wasn't run by accident.

Reviewed By: ftynse

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

2 years agoRevert "[openmp] Add OMPT initialization in libomptarget"
Joachim Protze [Wed, 10 Nov 2021 11:44:25 +0000 (12:44 +0100)]
Revert "[openmp] Add OMPT initialization in libomptarget"

Reverting initial OMPT for target implementation in favor of a
different implementation.

This reverts commit 3bc8ce5dd718beef0031bf4b070ac4026e6910d7.

2 years ago[LV] Move optimized IV recipes to phi section of header after sinking.
Florian Hahn [Wed, 10 Nov 2021 11:41:08 +0000 (11:41 +0000)]
[LV] Move optimized IV recipes to phi section of header after sinking.

Unfortunately sinking recipes for first-order recurrences relies on
the original position of recipes. So if a recipes needs to be sunk after
an optimized induction, it needs to stay in the original position, until
sinking is done. This is causing PR52460.

To fix the crash, keep the recipes in the original position until
sink-after is done.

Post-commit follow-up to c45045bfd04af9 to address PR52460.

2 years agoRevert "[LoopVectorize] Extract the last lane from a uniform store"
Kerry McLaughlin [Wed, 10 Nov 2021 11:21:19 +0000 (11:21 +0000)]
Revert "[LoopVectorize] Extract the last lane from a uniform store"

This reverts commit 0d748b4d32cbddf58a1ff83f3ff178ec1ad49edc.
This is causing some failures when building Spec2017 with scalable
vectors. Reverting to investigate.

2 years ago[NFC][SROA] Revisit test coverage in non-capturing-call.ll
Roman Lebedev [Wed, 10 Nov 2021 09:03:48 +0000 (12:03 +0300)]
[NFC][SROA] Revisit test coverage in non-capturing-call.ll

2 years agoReapply 5ec2386 "Reapply db28934 "[IndVars] Pass TTI to replaceCongruentIVs""
Dmitry Makogon [Wed, 10 Nov 2021 10:30:48 +0000 (17:30 +0700)]
Reapply 5ec2386 "Reapply db28934 "[IndVars] Pass TTI to replaceCongruentIVs""

This reverts commit 7cd273c339cfe8427404f881ae280bd9fae6ff78.

Several patches with tests fixes have been applied:
0cada82f0a30e5ae22dce66b58604ab9b47a3897 "[Test] Remove incorrect test in GVN"
97cb13615d6d9df254e3c0f3deef9eaedfe189b6 "[Test] Separate IndVars test into AArch64 and X86 parts"
985cc490f17d28b20392ee214895d947b85120ef "[Test] Remove separated test in IndVars",
and test failures caused by 5ec2386 should be resolved now.

2 years ago[mlir][linalg][bufferize] Add mustBufferizeInPlace to op interface
Matthias Springer [Wed, 10 Nov 2021 10:22:42 +0000 (19:22 +0900)]
[mlir][linalg][bufferize] Add mustBufferizeInPlace to op interface

This is useful for ops such as scf::IfOp, which always bufferize in-place.

This commit is in preparation of decoupling BufferizationAliasInfo from the SCF dialect.

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

2 years ago[lldb] [test] Skip new signal tests on Windows
Michał Górny [Wed, 10 Nov 2021 10:31:21 +0000 (11:31 +0100)]
[lldb] [test] Skip new signal tests on Windows

2 years ago[SelectionDAG] Widen scalable-vector loads/stores via VP_LOAD/VP_STORE
Fraser Cormack [Wed, 6 Oct 2021 17:14:06 +0000 (18:14 +0100)]
[SelectionDAG] Widen scalable-vector loads/stores via VP_LOAD/VP_STORE

This patch fixes a compiler crash when widening scalable-vector loads
and stores which end up breaking down to element-wise store operations.
It does so by providing a way for targets with support for
vector-predicated loads and stores to use those instead. By widening the
operation but maintaining the original effective operation length via
the EVL, only the intended vector elements are loaded or stored.

This method should in theory be possible and even preferred for
fixed-length vector types, but all fixed-length types can be broken down
into their elements, and regardless I have observed regressions in the
generated code when doing so. I believe this is simply due to
VP_LOAD/VP_STORE not being up to par with LOAD/STORE in terms of
optimization. It does improve performance on smaller self-contained
examples, however, so the potential is there.

While the only target that benefits from this is RISCV, the legalization
is generic and so was placed centrally.

Reviewed By: craig.topper

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

2 years agoRevert "[DebugInfo] Only create concrete DIEs of concrete functions"
Adrian Kuegel [Wed, 10 Nov 2021 09:51:16 +0000 (10:51 +0100)]
Revert "[DebugInfo] Only create concrete DIEs of concrete functions"

This reverts commit f19471a24985a0cbc32b6548c8fce1d2514e8243.
This leads to a crash. Still working on a reproducer to share.

2 years ago[mlir][linalg][bufferize] Bufferize ops via PreOrder traversal
Matthias Springer [Wed, 10 Nov 2021 09:47:28 +0000 (18:47 +0900)]
[mlir][linalg][bufferize] Bufferize ops via PreOrder traversal

The existing PostOrder traversal with special rules for certain ops was complicated and had a bug. Switch to PreOrder traversal.

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

2 years agoRevert "[DebugInfo] Fix broken MachO test"
Adrian Kuegel [Wed, 10 Nov 2021 08:46:35 +0000 (09:46 +0100)]
Revert "[DebugInfo] Fix broken MachO test"

This reverts commit 06736dab9bb5f8e170038e49b3a65e7a7e6e0f02.
This depends on another patch that will be reverted.

2 years ago[IR] In ConstantFoldShuffleVectorInstruction use zeroinitializer for splats of 0
David Sherwood [Mon, 8 Nov 2021 12:02:21 +0000 (12:02 +0000)]
[IR] In ConstantFoldShuffleVectorInstruction use zeroinitializer for splats of 0

When creating a splat of 0 for scalable vectors we tend to create them
with using a combination of shufflevector and insertelement, i.e.

shufflevector (<vscale x 4 x i32> insertelement (<vscale x 4 x i32> poison, i32 0, i32 0),
               <vscale x 4 x i32> poison, <vscale x 4 x i32> zeroinitializer)

However, for the case of a zero splat we can actually just replace the
above with zeroinitializer instead. This makes the IR a lot simpler and
easier to read. I have changed ConstantFoldShuffleVectorInstruction to
use zeroinitializer when creating a splat of integer 0 or FP +0.0 values.

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

2 years ago[mlir][linalg][bufferize] Remove special scf::IfOp rules
Matthias Springer [Wed, 10 Nov 2021 09:39:16 +0000 (18:39 +0900)]
[mlir][linalg][bufferize] Remove special scf::IfOp rules

Remove some of the special rules for scf::IfOp (not all of them) and encode them in the op interface. This is in preparation of decoupling analysis, bufferization and dialects.

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

2 years ago[mlir][linalg][bufferize] Add helper method isMemoryWrite to op interface
Matthias Springer [Wed, 10 Nov 2021 09:34:26 +0000 (18:34 +0900)]
[mlir][linalg][bufferize] Add helper method isMemoryWrite to op interface

This is in preparating for decoupling the SCF dialect from the analysis.

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

2 years ago[mlir][linalg][bufferize] Fix buffer equivalence around scf.if ops
Matthias Springer [Wed, 10 Nov 2021 09:28:41 +0000 (18:28 +0900)]
[mlir][linalg][bufferize] Fix buffer equivalence around scf.if ops

Also extend the comments for aliasInfo and equivalenceInfo.

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

2 years ago[gn build] Port a35efc4dcb70
LLVM GN Syncbot [Wed, 10 Nov 2021 09:27:55 +0000 (09:27 +0000)]
[gn build] Port a35efc4dcb70

2 years ago[NFC][clang-tidy] Fixup documentation file names for 'readability-container-data...
Whisperity [Wed, 10 Nov 2021 09:16:06 +0000 (10:16 +0100)]
[NFC][clang-tidy] Fixup documentation file names for 'readability-container-data-pointer'

2 years ago[mlir][linalg][bufferize] Relax tensor.insert_slice conflict rules
Matthias Springer [Wed, 10 Nov 2021 09:15:19 +0000 (18:15 +0900)]
[mlir][linalg][bufferize] Relax tensor.insert_slice conflict rules

A tensor.insert_slice write does not conflict with a subsequent read of the source if the source is originating from a matching tensor.extract_slice.

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

2 years agoMisleading unicode identifier detection pass
serge-sans-paille [Fri, 15 Oct 2021 13:18:52 +0000 (15:18 +0200)]
Misleading unicode identifier detection pass

Detect when an identifier contains some Right-To-Left characters.
This pass relates to https://trojansource.codes/

Example of misleading source:

    short int א = (short int)0;
    short int ג = (short int)12345;

    int main() {
      int א = ג; // a local variable, set to zero?
      printf("ג is %d\n", ג);
      printf("א is %d\n", א);
    }

This is a recommit of 299aa4dfa1d8c120648b1404b481d858b76c8173 with missing
option registration fixed.

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

2 years ago[Test] Remove separated test in IndVars
Dmitry Makogon [Wed, 10 Nov 2021 09:17:58 +0000 (16:17 +0700)]
[Test] Remove separated test in IndVars

This patch removes a test file, which was forgotten to be removed in
97cb13615d6d9df254e3c0f3deef9eaedfe189b6. The deleted test
is separated into 2 parts by that patch.

2 years ago[ELF] Enforce double-dash form for --ignore-{data,function}-pointer-equality --reprod...
Fangrui Song [Wed, 10 Nov 2021 09:17:08 +0000 (01:17 -0800)]
[ELF] Enforce double-dash form for --ignore-{data,function}-pointer-equality --reproduce --thread

They are LLD-specific options. We have enforced double-dash forms for
other options (reduce collision with short options) but missed them.

2 years ago[Test] Separate IndVars test into AArch64 and X86 parts
Dmitry Makogon [Wed, 10 Nov 2021 08:48:56 +0000 (15:48 +0700)]
[Test] Separate IndVars test into AArch64 and X86 parts

The widen-loop-comp.ll in indvars has a target triple with
specified aarch64 architecture. This caused test failures with
db28934 "[IndVars] Pass TTI to replaceCongruentIVs" applied, because
with the patch indvars performed some target-specific
transforms, and for example if a build supported only X86,
then indvars would not have applied those transforms.
However, the checks in the test were generated as for aarch64.
Thus the test failures on such builds.

This patch separates widen-loop-comp.ll into two parts.
The first one is intended to be run only if a build supports aarch64.
This is now in AArch64 directory with a lit config.

The second one was added recently to show db28934 improvements.
This one is now in X86 directory.

This patch should resolve build issues caused by
5ec23863320ca12bfabb6dcff1d0425cb614b7a5.

2 years ago[mlir][linalg] Enable insertion of dealloc for end2end tests
Stephan Herhut [Mon, 4 Oct 2021 14:51:25 +0000 (16:51 +0200)]
[mlir][linalg] Enable insertion of dealloc for end2end tests

This uses the buffer-deallocation pass or, in case the test case does not use bufferization, has added explicit deallocs.

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

2 years ago[InstCombine] Extend stacksave/restore elimination
Itay Bookstein [Wed, 3 Nov 2021 13:08:06 +0000 (15:08 +0200)]
[InstCombine] Extend stacksave/restore elimination

Previously, InstCombine detected a pair of llvm.stacksave/stackrestore
instructions that are adjacent modulo debug instructions in order to
eliminate the llvm.stackrestore. This precludes situations where
intervening instructions (e.g. loads) preclude the llvm.stacksave and
llvm.stackrestore from becoming adjacent. This commit extends the logic
and allows for eliminating the llvm.stackrestore when the range of
instructions between them does not include any alloca or side-effect
causing instructions.

Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>
Reviewed By: lebedev.ri

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

2 years ago[InstCombine][NFC] Refactor llvm.stackrestore handling
Itay Bookstein [Tue, 9 Nov 2021 07:06:30 +0000 (09:06 +0200)]
[InstCombine][NFC] Refactor llvm.stackrestore handling

Hoist the instruction classification logic outside the loop
in preparation for reuse in a future commit.

Signed-off-by: Itay Bookstein <itay.bookstein@nextsilicon.com>
Reviewed By: lebedev.ri

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

2 years ago[lldb] [gdb-server] Fix fill_clamp to handle signed src types
Michał Górny [Tue, 9 Nov 2021 22:55:52 +0000 (23:55 +0100)]
[lldb] [gdb-server] Fix fill_clamp to handle signed src types

Fix the fill_clamp() function to handle signed source types.  Make sure
that the source value is always non-negative, and cast it to unsigned
when verifying the upper bound.  This fixes compiler warnings about
comparing unsigned and signed types.

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

2 years ago[lldb] Support gdbserver signals
Michał Górny [Sat, 14 Aug 2021 21:22:29 +0000 (23:22 +0200)]
[lldb] Support gdbserver signals

GDB and LLDB use different signal models.  GDB uses a predefined set
of signal codes, and maps platform's signos to them.  On the other hand,
LLDB has historically simply passed native signos.

In order to improve compatibility between LLDB and gdbserver, the GDB
signal model should be used.  However, GDB does not provide a mapping
for all existing signals on Linux and unsupported signals are passed
as 'unknown'.  Limiting LLDB to this behavior could be considered
a regression.

To get the best of both worlds, use the LLDB signal model when talking
to lldb-server, and the GDB signal model otherwise.  For this purpose,
new versions of lldb-server indicate "native-signals+" via qSupported.
At the same time, we also detect older versions of lldb-server
via QThreadSuffixSupported for backwards compatibility.  If neither test
succeeds, we assume gdbserver or another implementation using GDB model.

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

2 years ago[Test] Remove incorrect test in GVN
Dmitry Makogon [Wed, 10 Nov 2021 08:15:04 +0000 (15:15 +0700)]
[Test] Remove incorrect test in GVN

Removed it because it runs indvars after GVN and
it's obvious it's an indvars test, not GVN.

Also the removed test file includes a 'target triple' with aarch64 specified,
which is needed for indvars to eliminate the Phis produced by GVN,
and the test directory doesn't have a lit config to exclude lit from
running the test if aarch64 is not supported by a build.

2 years ago[llvm-objdump] Remove a trailing semicolon, fixing GCC warnings. NFC.
Martin Storsjö [Wed, 10 Nov 2021 07:39:47 +0000 (09:39 +0200)]
[llvm-objdump] Remove a trailing semicolon, fixing GCC warnings. NFC.

2 years agoReland [XCOFF][yaml2obj] support for the auxiliary file header.
Esme-Yi [Wed, 10 Nov 2021 07:23:56 +0000 (07:23 +0000)]
Reland [XCOFF][yaml2obj] support for the auxiliary file header.

Summary: Fix the build failure on MSVC by making the `T` and `U` of the function
'T llvm::Optional<T>::getValueOr<llvm::yaml::Hex32>(U &&) const &' the same.

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

2 years ago[clangd] Trace per-token time in clangd --check
Sam McCall [Wed, 10 Nov 2021 07:22:28 +0000 (08:22 +0100)]
[clangd] Trace per-token time in clangd --check

2 years ago[CodeCompletion] Generally consider header files without extension
Christian Kandeler [Tue, 9 Nov 2021 17:12:01 +0000 (18:12 +0100)]
[CodeCompletion] Generally consider header files without extension

Real-world use case: The Qt framework's headers have the same name
as the respective class defined in them, and Qt's traditional qmake
build tool uses -I (rather than -isystem) to pull them in.

Reviewed By: sammccall

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

2 years ago[llvm] Use MachineBasicBlock::{successors,predecessors} (NFC)
Kazu Hirata [Wed, 10 Nov 2021 07:05:15 +0000 (23:05 -0800)]
[llvm] Use MachineBasicBlock::{successors,predecessors} (NFC)

2 years ago[clang-tidy] Fix llvm-header-guard so that it works with Windows paths
Salman Javed [Wed, 10 Nov 2021 05:34:41 +0000 (18:34 +1300)]
[clang-tidy] Fix llvm-header-guard so that it works with Windows paths

Fixes pr40372 (https://bugs.llvm.org/show_bug.cgi?id=40372).

The llvm-header-guard check does not take into account that the path
separator on Windows is `\`, not `/`.

This means that instead of suggesting a header guard in the form of:
LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_FOO_H

it incorrectly suggests:
C:\LLVM_PROJECT\CLANG_TOOLS_EXTRA\CLANG_TIDY\FOO_H

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

2 years ago[formatters] Add a libstdcpp formatter for forward_list and refactor list formatter
Danil Stefaniuc [Wed, 10 Nov 2021 05:22:14 +0000 (21:22 -0800)]
[formatters] Add a libstdcpp formatter for forward_list and refactor list formatter

This diff adds a data formatter for libstdcpp's forward_list. Besides, it refactors the existing code by extracting the common functionality between libstdcpp forward_list and list formatters into the AbstractListSynthProvider class.

Reviewed By: wallace

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

2 years ago[AArch64][GlobalISel] Fix atomic truncating stores from generating invalid copies.
Amara Emerson [Wed, 10 Nov 2021 04:41:26 +0000 (20:41 -0800)]
[AArch64][GlobalISel] Fix atomic truncating stores from generating invalid copies.

If the source reg is a 64b vreg, then we need to emit a subreg copy to a 32b
gpr before we select sub-64b variants like STLRW.

2 years ago[ELF] Inline isPPC64SmallCodeModelTocReloc which is only called once. NFC
Fangrui Song [Wed, 10 Nov 2021 04:41:05 +0000 (20:41 -0800)]
[ELF] Inline isPPC64SmallCodeModelTocReloc which is only called once. NFC

2 years ago[ELF] Move isStaticLinkTimeConstant closer to the only caller processRelocAux. NFC
Fangrui Song [Wed, 10 Nov 2021 04:24:40 +0000 (20:24 -0800)]
[ELF] Move isStaticLinkTimeConstant closer to the only caller processRelocAux. NFC

2 years agoFix unused variable warning in release build
Jorge Gorbe Moya [Wed, 10 Nov 2021 03:48:42 +0000 (19:48 -0800)]
Fix unused variable warning in release build

2 years ago[CFE][Codegen] Make sure to maintain the contiguity of all the static allocas
hsmahesha [Wed, 10 Nov 2021 03:14:58 +0000 (08:44 +0530)]
[CFE][Codegen] Make sure to maintain the contiguity of all the static allocas

at the start of the entry block, which in turn would aid better code transformation/optimization.

Reviewed By: rnk

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

2 years ago[clang-tblgen] Fix non-determinism in generating AttributeReference.rst
Igor Kudrin [Wed, 10 Nov 2021 03:07:20 +0000 (10:07 +0700)]
[clang-tblgen] Fix non-determinism in generating AttributeReference.rst

As for now, the categories are printed in an arbitrary order which
depends on the addresses of dynamically allocated objects. The patch
sorts them in an alphabetical order thus making the output stable.

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

2 years ago[clang-tblgen] Fix non-determinism in generating AttrSubMatchRulesParserStringSwitche...
Igor Kudrin [Wed, 10 Nov 2021 03:06:30 +0000 (10:06 +0700)]
[clang-tblgen] Fix non-determinism in generating AttrSubMatchRulesParserStringSwitches.inc

llvm::MapVector, compared to std::map, guarantees the same iteration
order in different runs.

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

2 years ago[dfsan] Dfsan version of D113328
Vitaly Buka [Tue, 9 Nov 2021 03:22:24 +0000 (19:22 -0800)]
[dfsan] Dfsan version of D113328

Depends on D113328.

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

2 years ago[msan] Block signals in MsanThread::Init
Vitaly Buka [Sat, 6 Nov 2021 02:57:19 +0000 (19:57 -0700)]
[msan] Block signals in MsanThread::Init

If async signal handler called when we MsanThread::Init
signal handler may trigger false reports.
I failed to reproduce this locally for a test.

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

2 years ago[NFC][sanitizer] Extract ScopedBlockSignals
Vitaly Buka [Tue, 9 Nov 2021 02:45:22 +0000 (18:45 -0800)]
[NFC][sanitizer] Extract ScopedBlockSignals

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

2 years ago[mlir-c] Add Region iterators matching Block & Operation ones
Jacques Pienaar [Wed, 10 Nov 2021 01:52:56 +0000 (17:52 -0800)]
[mlir-c] Add Region iterators matching Block & Operation ones

Enables using the same iterator interface to these even though underlying storage is different.

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

2 years agoFix flang following MLIR API change in f30a8a6f674
Mehdi Amini [Wed, 10 Nov 2021 01:25:36 +0000 (01:25 +0000)]
Fix flang following MLIR API change in f30a8a6f674

The printer for Attribute/Type does not need to include the mnemonic
anymore.

2 years agoFix ODS Attribute/Type declarative assembly generator after API change for Attribute...
Mehdi Amini [Wed, 10 Nov 2021 01:05:34 +0000 (01:05 +0000)]
Fix ODS Attribute/Type declarative assembly generator after API change for Attribute/Type print

The change in f30a8a6f674 conflicted with the recently landed feature on
ODS assembly format for Attribute/Type.

2 years agollvm-dwarfdump: Lookup type units when prettyprinting types
David Blaikie [Wed, 10 Nov 2021 00:47:30 +0000 (16:47 -0800)]
llvm-dwarfdump: Lookup type units when prettyprinting types

This handles DWARFv4 and DWARFv5 type units, but not Split DWARF type
units. That'll come in a follow-up patch.

2 years agoChange the contract with the type/attribute parsing to let the dispatch handle the...
Mehdi Amini [Wed, 10 Nov 2021 00:38:01 +0000 (00:38 +0000)]
Change the contract with the type/attribute parsing to let the dispatch handle the mnemonic

This breaking change requires to remove printing the mnemonic in the print()
method on Type/Attribute classes.
This makes it consistent with the parsing code which alread handles the
mnemonic outside of the parsing method.

This likely won't break the build for anyone, but tests will start
failing for dialects downstream. The fix is trivial and look like
going from:

void emitc::OpaqueType::print(DialectAsmPrinter &printer) const {
  printer << "opaque<\"";

to:

void emitc::OpaqueAttr::print(DialectAsmPrinter &printer) const {
  printer << "<\"";

Reviewed By: rriddle, aartbik

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

2 years agoEmit the boilerplate for Type printer/parser dialect dispatching from ODS
Mehdi Amini [Sat, 6 Nov 2021 07:14:32 +0000 (07:14 +0000)]
Emit the boilerplate for Type printer/parser dialect dispatching from ODS

Add a new `useDefaultTypePrinterParser` boolean settings on the dialect
(default to false for now) that emits the boilerplate to dispatch type
parsing/printing to the auto-generated method.
We will likely turn this on by default in the future.

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

2 years agoEmit the boilerplate for Attribute printer/parser dialect dispatching from ODS
Mehdi Amini [Sat, 6 Nov 2021 07:14:17 +0000 (07:14 +0000)]
Emit the boilerplate for Attribute printer/parser dialect dispatching from ODS

Add a new `useDefaultAttributePrinterParser` boolean settings on the dialect
(default to false for now) that emits the boilerplate to dispatch attribute
parsing/printing to the auto-generated method.
We will likely turn this on by default in the future.

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

2 years agoRestructure the Test dialect ODS to include the AttrDef in TestOps.td (NFC)
Mehdi Amini [Sat, 6 Nov 2021 07:14:02 +0000 (07:14 +0000)]
Restructure the Test dialect ODS to include the AttrDef in TestOps.td (NFC)

This structure is necessary to be able to use AttrDef as arguments on operations.

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

2 years ago[GlobalISel] Ensure that translateInvoke adds all successors for inlineasm
Jessica Paquette [Mon, 8 Nov 2021 22:43:12 +0000 (14:43 -0800)]
[GlobalISel] Ensure that translateInvoke adds all successors for inlineasm

The existing code didn't add all necessary successors, which resulted in
disjoint basic blocks. These would end up not being legalized which, in the
best case, caused a fallback only in assert builds.

Here's an example:

https://godbolt.org/z/ndx15Enfj

We also end up getting weird codegen here as well.

Refactoring the code here allows us to correctly attach all successors. With
this patch, the above example gives correct codegen at -O0 with and without
asserts.

Also autogen the testcase to show that we add all the successors now.

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

2 years agoFix memory leak in D demangler
David Blaikie [Wed, 10 Nov 2021 00:08:14 +0000 (16:08 -0800)]
Fix memory leak in D demangler