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

3 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>
3 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

3 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

3 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

3 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.

3 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

3 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

3 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.

3 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

3 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.

3 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.

3 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.

3 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.

3 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>
3 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>
3 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

3 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.

3 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.

3 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.

3 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

3 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.

3 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

3 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

3 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

3 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.

3 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

3 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.

3 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

3 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

3 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

3 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

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

3 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'

3 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

3 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

3 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.

3 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.

3 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.

3 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

3 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

3 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

3 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

3 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

3 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.

3 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.

3 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

3 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

3 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

3 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)

3 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

3 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

3 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.

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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.

3 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.

3 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.

3 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

3 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

3 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

3 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

3 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

3 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

3 years ago[clang] Fix restructured markup
Nathan Sidwell [Tue, 9 Nov 2021 23:41:22 +0000 (18:41 -0500)]
[clang] Fix restructured markup

3 years ago[InstCombine] Precommit updated and-xor-or.ll tests. NFC.
Stanislav Mekhanoshin [Tue, 9 Nov 2021 23:38:24 +0000 (15:38 -0800)]
[InstCombine] Precommit updated and-xor-or.ll tests. NFC.

Tests for:
```
(c | ~(a & b)) & (b | ~(a & c)) --> ~(a & (b ^ c))
(b | ~(a & c)) & ~(a & b) --> ~((b | c) & a)
(b & ~(a | c)) | ~(a | b) --> ~((b & c) | a) (2 uses test)
```

3 years ago[llvm-reduce] Print extra newline when encountering unknown pass
Arthur Eubanks [Tue, 9 Nov 2021 23:19:43 +0000 (15:19 -0800)]
[llvm-reduce] Print extra newline when encountering unknown pass

3 years ago[RISCV] Add test cases for roundeven intrinsics. NFC
Craig Topper [Tue, 9 Nov 2021 22:47:44 +0000 (14:47 -0800)]
[RISCV] Add test cases for roundeven intrinsics. NFC

These just fall back to libcalls.

3 years ago[NFC][SROA] Precommit tests for promotion-with-spilling
Roman Lebedev [Tue, 9 Nov 2021 22:51:07 +0000 (01:51 +0300)]
[NFC][SROA] Precommit tests for promotion-with-spilling

Tests mainly stolen from https://reviews.llvm.org/D109749

3 years agoAMDGPU: Account for implicit argument alignment for kernarg segment
Matt Arsenault [Thu, 28 Oct 2021 00:59:46 +0000 (20:59 -0400)]
AMDGPU: Account for implicit argument alignment for kernarg segment

If a kernel had no formal arguments but did have the implicit
arguments, we were reporting a required kernarg alignment of 4. For
some reason we require an 8-byte alignment for this, even though
there's no real advantage and I don't see where this is documented in
the ABI.

The code object header code also claims the minimum alignment is 16,
which is what I thought you always got at runtime anyway so I don't
know why this matters.

3 years ago[OpenMP] Remove doing assumption propagation in the front end.
Joseph Huber [Fri, 8 Oct 2021 20:29:57 +0000 (16:29 -0400)]
[OpenMP] Remove doing assumption propagation in the front end.

This patch removes the assumption propagation that was added in D110655
primarily to get assumption informatino on opaque call sites for
optimizations. The analysis done in D111445 allows us to do this more
intelligently in the back-end.

Depends on D111445

Reviewed By: jdoerfert

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

3 years ago[OpenMP] Use AAAssumptionInfo to get assumptions in OpenMPOpt
Joseph Huber [Mon, 4 Oct 2021 21:42:46 +0000 (17:42 -0400)]
[OpenMP] Use AAAssumptionInfo to get assumptions in OpenMPOpt

This patch uses the abstract attributor introduced in D111054 to get the
assumption values instead of the `hasAssumption` function. This also
calls it so assumption information should propagate throug the device
where applicabile.

Reviewed By: jdoerfert

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

3 years ago[Attributor] Introduce AAAssumptionInfo to propagate assumptions
Joseph Huber [Mon, 4 Oct 2021 13:01:41 +0000 (09:01 -0400)]
[Attributor] Introduce AAAssumptionInfo to propagate assumptions

This patch introduces a new abstract attributor instance that propagates
assumption information from functions. Conceptually, if a function is
only called by functions that have certain assumptions, then we can
apply the same assumptions to that function. This problem is similar to
calculating the dominator set, but the assumptions are merged instead of
nodes.

Reviewed By: jdoerfert

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

3 years ago[sancov] add tracing for loads and store
Kostya Serebryany [Tue, 9 Nov 2021 01:52:36 +0000 (17:52 -0800)]
[sancov] add tracing for loads and store

add tracing for loads and stores.

The primary goal is to have more options for data-flow-guided fuzzing,
i.e. use data flow insights to perform better mutations or more agressive corpus expansion.
But the feature is general puspose, could be used for other things too.

Pipe the flag though clang and clang driver, same as for the other SanitizerCoverage flags.
While at it, change some plain arrays into std::array.

Tests: clang flags test, LLVM IR test, compiler-rt executable test.

Reviewed By: morehouse

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

3 years agoheaders: optionalise some generated resource headers
Saleem Abdulrasool [Tue, 9 Nov 2021 22:28:12 +0000 (22:28 +0000)]
headers: optionalise some generated resource headers

This splits out the generated headers and conditonalises them upon the
target being enabled.

The motivation here is that the RISCV header alone added 10MB to the
resource directory, which was previously at 10MB, increasing the build
size and time. This header is contributing ~50% of the size of the
resource headers (~10MB).

The ARM generated headers are contributing about ~10% or 1MB.

This could be extended further adding only the static resource headers
for the targets that the LLVM build supports.

The changes to the tests for ARM mirror what the RISCV target already
did and rnk identified as a possible issue.

Testing:
  cmake -G Ninja -D LLVM_TARGETS_TO_BUILD=X86 -D LLVM_ENABLE_PROJECTS="clang;lld" ../clang
  ninja check-clang

Differential Revision: https://reviews.llvm.org/D112890
Reviewed By: craig.topper

3 years agoRevert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes"
Arthur Eubanks [Tue, 9 Nov 2021 22:23:04 +0000 (14:23 -0800)]
Revert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes"

This reverts commit ee7652569854af567ba83e5255d70e80cc8619a1.

Causes crashes, see comments in D104827.

3 years agoFix test after aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7.
James Y Knight [Tue, 9 Nov 2021 16:18:36 +0000 (11:18 -0500)]
Fix test after aee49255074fd4ef38d97e6e70cbfbf2f9fd0fa7.

(Apparently no buildbots enable both examples and plugins!)

3 years ago[clang] Run LLVM Verifier in modes without CodeGen too
Itay Bookstein [Sat, 6 Nov 2021 22:06:28 +0000 (00:06 +0200)]
[clang] Run LLVM Verifier in modes without CodeGen too

Previously, the Backend_Emit{Nothing,BC,LL} modes did
not run the LLVM verifier since it is usually added via
the TargetMachine::addPassesToEmitFile method according
to the DisableVerify parameter. This is called from
EmitAssemblyHelper::AddEmitPasses, which is only relevant
for BackendAction-s that require CodeGen.

Note:
* In these particular situations the verifier is added
  to the optimization pipeline rather than the codegen
  pipeline so that it runs prior to the BC/LL emission
  pass.
* This change applies to both the old and the new PMs.
* Because the clang tests use -emit-llvm ubiquitously,
  this change will enable the verifier for them.
* A small bug is fixed in emitIFuncDefinition so that
  the clang/test/CodeGen/ifunc.c test would pass:
  the emitIFuncDefinition incorrectly passed the
  GlobalDecl of the IFunc itself to the call to
  GetOrCreateLLVMFunction for creating the resolver.

Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: rjmccall

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

3 years ago[CodeGen] Diagnose and reject non-function ifunc resolvers
Itay Bookstein [Sat, 30 Oct 2021 11:27:38 +0000 (14:27 +0300)]
[CodeGen] Diagnose and reject non-function ifunc resolvers

Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: MaskRay, erichkeane

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

3 years ago[clang][test][NFC] Move attr-ifunc.c test from Sema to CodeGen
Itay Bookstein [Tue, 9 Nov 2021 20:01:56 +0000 (22:01 +0200)]
[clang][test][NFC] Move attr-ifunc.c test from Sema to CodeGen

Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: erichkeane

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

3 years ago[clang][test][NFC] clang-format attr-ifunc.c test
Itay Bookstein [Tue, 9 Nov 2021 20:01:14 +0000 (22:01 +0200)]
[clang][test][NFC] clang-format attr-ifunc.c test

Signed-off-by: Itay Bookstein <ibookstein@gmail.com>
Reviewed By: erichkeane

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

3 years agoRevert "Misleading unicode identifier detection pass"
serge-sans-paille [Tue, 9 Nov 2021 21:38:56 +0000 (22:38 +0100)]
Revert "Misleading unicode identifier detection pass"

This reverts commit 7f92a1a84b96ff0b7568a35704c9483e9f24f057.

It triggers an assert, see http://45.33.8.238/linux/60293/step_9.txt

"AST/Decl.h:277: llvm::StringRef clang::NamedDecl::getName() const: Assertion `Name.isIdentifier() && "Name is not a simple identifier"' failed."

3 years ago[CodeGen][Outliner] Clean up dead code
Alexander Shaposhnikov [Tue, 9 Nov 2021 21:27:16 +0000 (21:27 +0000)]
[CodeGen][Outliner] Clean up dead code

Clean up dead code in X86InstrInfo.cpp and AArch64InstrInfo.cpp

Test plan: make check-all

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

3 years agoComment AST: Add support for variable templates
Aaron Puchert [Tue, 9 Nov 2021 21:24:44 +0000 (22:24 +0100)]
Comment AST: Add support for variable templates

We treat them as variables of course, though if they have function
pointer type we treat them as functions, i.e. allow parameter and return
value specifications. Just like VarDecls.

Reviewed By: gribozavr2

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

3 years agoComment AST: Declare function pointer variables as functions
Aaron Puchert [Tue, 9 Nov 2021 20:51:38 +0000 (21:51 +0100)]
Comment AST: Declare function pointer variables as functions

We were doing this already for type aliases, and it deduplicates the
code looking through aliases and pointers to find a function type. As
a side effect, this finds two warnings that we apparently missed before.

Reviewed By: gribozavr2

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

3 years agoComment AST: Factor out function type extraction in DeclInfo::fill (NFC)
Aaron Puchert [Tue, 9 Nov 2021 20:46:56 +0000 (21:46 +0100)]
Comment AST: Factor out function type extraction in DeclInfo::fill (NFC)

Reviewed By: gribozavr2

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

3 years agoDebugInfoDWARF: Refactor/simplify a couple of minor things
David Blaikie [Tue, 9 Nov 2021 20:51:05 +0000 (12:51 -0800)]
DebugInfoDWARF: Refactor/simplify a couple of minor things

3 years ago[clang] Don't crash on an incomplete-type base specifier in template context.
Haojian Wu [Tue, 9 Nov 2021 10:10:11 +0000 (11:10 +0100)]
[clang] Don't crash on an incomplete-type base specifier in template context.

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

3 years ago[InstCombine] Add tests for and/or of range checks (NFC)
Nikita Popov [Tue, 9 Nov 2021 20:59:40 +0000 (21:59 +0100)]
[InstCombine] Add tests for and/or of range checks (NFC)

3 years ago[libcxx][CI][AIX] Switch to LLVM_ENABLE_RUNTIMES
David Tenty [Tue, 9 Nov 2021 17:44:44 +0000 (12:44 -0500)]
[libcxx][CI][AIX] Switch to LLVM_ENABLE_RUNTIMES

and to the new `runtimes` top level CMakeLists.txt since the old path is now deprecated. This requires a slight adjustment of the libcxxabi CMake, since there are required macro definitions we previously got via the `llvm/CMakeList.txt` path.

Reviewed By: ldionne, #libc, #libc_abi

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

3 years ago[clang-format] Refactor SpaceBeforeParens to add options
C. Rayroud [Sun, 7 Nov 2021 19:56:35 +0000 (20:56 +0100)]
[clang-format] Refactor SpaceBeforeParens to add options

The coding style of some projects requires to have more control on space
before opening parentheses.
The goal is to add the support of clang-format to more projects.
For example adding a space only for function definitions or
declarations.
This revision adds SpaceBeforeParensOptions to configure each option
independently from one another.

Differentiel Revision: https://reviews.llvm.org/D110833

3 years ago[clang-format] Address fixme
Björn Schäpers [Fri, 5 Nov 2021 21:20:52 +0000 (22:20 +0100)]
[clang-format] Address fixme

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