platform/upstream/llvm.git
3 years ago[mlir][linalg] Support permutation when lowering to loop nests
Lei Zhang [Mon, 11 Jan 2021 14:08:21 +0000 (09:08 -0500)]
[mlir][linalg] Support permutation when lowering to loop nests

Linalg ops are perfect loop nests. When materializing the concrete
loop nest, the default order specified by the Linalg op's iterators
may not be the best for further CodeGen: targets frequently need
to plan the loop order in order to gain better data access. And
different targets can have different preferences. So there should
exist a way to control the order.

Reviewed By: nicolasvasilache

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

3 years ago[mlir][linalg] Support parsing attributes in named op spec
Lei Zhang [Mon, 11 Jan 2021 13:50:00 +0000 (08:50 -0500)]
[mlir][linalg] Support parsing attributes in named op spec

With this, now we can specify a list of attributes on named ops
generated from the spec. The format is defined as

```
attr-id ::= bare-id (`?`)?
attr-typedef ::= type (`[` `]`)?
attr-def ::= attr-id `:` attr-typedef

tc-attr-def ::= `attr` `(` attr-def-list `)`
tc-def ::= `def` bare-id
  `(`tensor-def-list`)` `->` `(` tensor-def-list`)`
  (tc-attr-def)?
```

For example,

```
ods_def<SomeCppOp>
def some_op(...) -> (...)
attr(
  f32_attr: f32,
  i32_attr: i32,
  array_attr : f32[],
  optional_attr? : f32
)
```

where `?` means optional attribute and `[]` means array type.

Reviewed By: hanchung, nicolasvasilache

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

3 years ago[flang][driver] Copy input files into a temp dir when testing
Andrzej Warzynski [Thu, 7 Jan 2021 17:49:38 +0000 (17:49 +0000)]
[flang][driver] Copy input files into a temp dir when testing

The following frontend driver invocation will generate 2 output files
in the same directory as the input files:
```
flang-new -fc1 input-1.f input-2.f
```
This is the desired behaviour. However, when testing we need to make
sure that we don't pollute the source directory. To this end, copy test
input files into a temporary directory.

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

3 years ago[mlir] Make GpuAsyncRegion pass depend on async dialect.
Christian Sigg [Mon, 11 Jan 2021 12:56:35 +0000 (13:56 +0100)]
[mlir] Make GpuAsyncRegion pass depend on async dialect.

Do not cache gpu.async.token type so that the pass can be created before the GPU dialect is registered.

Reviewed By: ftynse

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

3 years ago[mlir] Remove unnecessary llvm.mlir.cast in AsyncToLLVM lowering.
Christian Sigg [Mon, 11 Jan 2021 12:25:23 +0000 (13:25 +0100)]
[mlir] Remove unnecessary llvm.mlir.cast in AsyncToLLVM lowering.

Reviewed By: ftynse

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

3 years ago[AMDGPU] Fix a urem combine test to test what it was supposed to
Jay Foad [Mon, 11 Jan 2021 13:28:34 +0000 (13:28 +0000)]
[AMDGPU] Fix a urem combine test to test what it was supposed to

3 years ago[ARM] Add uses for locals introduced for debug messages. NFC.
Stephan Herhut [Mon, 11 Jan 2021 11:32:25 +0000 (12:32 +0100)]
[ARM] Add uses for locals introduced for debug messages. NFC.

This adds uses for locals introduced for new debug messages for the load store optimizer. Those locals are only used on debug statements and otherwise create unused variable warnings.

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

3 years ago[X86][SSE] Add 'vectorized sum' test patterns
Simon Pilgrim [Mon, 11 Jan 2021 12:51:03 +0000 (12:51 +0000)]
[X86][SSE] Add 'vectorized sum' test patterns

These are often generated when building a vector from the reduction sums of independent vectors.

I've implemented some typical patterns from various v4f32/v4i32 based off current codegen emitted from the vectorizers, although these tests are more about tweaking some hadd style backend folds to handle whatever the vectorizers/vectorcombine throws at us...

3 years ago[lldb] Disable PipeTest.OpenAsReader on windows
Pavel Labath [Mon, 11 Jan 2021 12:15:01 +0000 (13:15 +0100)]
[lldb] Disable PipeTest.OpenAsReader on windows

This test seems to be broken there (which is not totally surprising as
this functionality was never used on windows). Disable the test while I
investigate.

3 years ago[obj2yaml][test] - Improve and fix section-group.yaml test.
Georgii Rymar [Wed, 23 Dec 2020 10:40:58 +0000 (13:40 +0300)]
[obj2yaml][test] - Improve and fix section-group.yaml test.

It has multiple issues fixed by this patch:
1) It shouldn't test how llvm-readelf/yaml2obj works.
2) It should use "-NEXT" prefix for check lines.
3) It can use YAML macros, that allows to use a single YAML.
4) It should probably test the case when a group member is a null section.

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

3 years ago[VPlan] Move initial quote emission from ::print to ::dumpBasicBlock.
Florian Hahn [Mon, 11 Jan 2021 12:20:04 +0000 (12:20 +0000)]
[VPlan] Move initial quote emission from ::print to ::dumpBasicBlock.

This means there will be no stray " when printing individual recipes
using print()/dump() in a debugger, for example.

3 years ago[llvm-readelf/obj] - Index phdrs and relocations from 0 when reporting warnings.
Georgii Rymar [Thu, 24 Dec 2020 13:20:07 +0000 (16:20 +0300)]
[llvm-readelf/obj] - Index phdrs and relocations from 0 when reporting warnings.

As was mentioned in comments here:
https://reviews.llvm.org/D92636#inline-864967

we are not consistent and sometimes index things from 0, but sometimes
from 1 in warnings.

This patch fixes 2 places: messages reported for
program headers and messages reported for relocations.

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

3 years ago[clang][AArch64][SVE] Avoid going through memory for coerced VLST return values
Joe Ellis [Fri, 8 Jan 2021 11:44:15 +0000 (11:44 +0000)]
[clang][AArch64][SVE] Avoid going through memory for coerced VLST return values

VLST return values are coerced to VLATs in the function epilog for
consistency with the VLAT ABI. Previously, this coercion was done
through memory. It is preferable to use the
llvm.experimental.vector.insert intrinsic to avoid going through memory
here.

Reviewed By: c-rhodes

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

3 years ago[obj2yaml] - Fix the crash in getUniquedSectionName().
Georgii Rymar [Wed, 23 Dec 2020 10:29:01 +0000 (13:29 +0300)]
[obj2yaml] - Fix the crash in getUniquedSectionName().

`getUniquedSectionName(const Elf_Shdr *Sec)` assumes that
`Sec` is not `nullptr`.

I've found one place in `getUniquedSymbolName` where it is
not true (because of that we crash when trying to dump
unnamed null section symbols).

Patch fixes the crash and changes the signature of the
`getUniquedSectionName` section to accept a reference.

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

3 years ago[VE] Support additional VMRGW and VMV intrinsic instructions
Kazushi (Jam) Marukawa [Fri, 8 Jan 2021 11:41:37 +0000 (20:41 +0900)]
[VE] Support additional VMRGW and VMV intrinsic instructions

Support missing VMRGW and VMV intrinsic instructions and add regression
tests.

Reviewed By: simoll

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

3 years ago[VE] Support intrinsic to isnert/extract_subreg of v512i1
Kazushi (Jam) Marukawa [Fri, 8 Jan 2021 11:29:42 +0000 (20:29 +0900)]
[VE] Support intrinsic to isnert/extract_subreg of v512i1

Support insert/extract_subreg intrinsic instructions for v512i1
registers and add regression tests.

Reviewed By: simoll

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

3 years ago[X86][SSE] Add missing SSE test coverage for permute(hop,hop) folds
Simon Pilgrim [Mon, 11 Jan 2021 11:24:20 +0000 (11:24 +0000)]
[X86][SSE] Add missing SSE test coverage for permute(hop,hop) folds

Should help avoid bugs like reported in rG80dee7965dff

3 years agoRevert rGd43a264a5dd3 "Revert "[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop...
Simon Pilgrim [Mon, 11 Jan 2021 11:15:28 +0000 (11:15 +0000)]
Revert rGd43a264a5dd3 "Revert "[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())""

This reapplies commit rG80dee7965dffdfb866afa9d74f3a4a97453708b2.

[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())

UNPCKL/UNPCKH only uses one op from each hop, so we can merge the hops and then permute the result.

REAPPLIED with a fix for unary unpacks of HOP.

3 years ago[SVE][CodeGen] Fix legalisation of floating-point masked gathers
Kerry McLaughlin [Mon, 11 Jan 2021 10:57:46 +0000 (10:57 +0000)]
[SVE][CodeGen] Fix legalisation of floating-point masked gathers

Changes in this patch:
- When lowering floating-point masked gathers, cast the result of the
  gather back to the original type with reinterpret_cast before returning.
- Added patterns for reinterpret_casts from integer to floating point, and
  concat_vector patterns for bfloat16.
- Tests for various legalisation scenarios with floating point types.

Reviewed By: sdesmalen, david-arm

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

3 years agoRequire chained analyses in BasicAA and AAResults to be transitive
Bjorn Pettersson [Fri, 1 Jan 2021 23:05:53 +0000 (00:05 +0100)]
Require chained analyses in BasicAA and AAResults to be transitive

This patch fixes a bug that could result in miscompiles (at least
in an OOT target). The problem could be seen by adding checks that
the DominatorTree used in BasicAliasAnalysis and ValueTracking was
valid (e.g. by adding DT->verify() call before every DT dereference
and then running all tests in test/CodeGen).

Problem was that the LegacyPassManager calculated "last user"
incorrectly for passes such as the DominatorTree when not telling
the pass manager that there was a transitive dependency between
the different analyses. And then it could happen that an incorrect
dominator tree was used when doing alias analysis (which was a pretty
serious bug as the alias analysis result could be invalid).

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

Reviewed By: nikic

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

3 years ago[X86] Fix tile register spill issue.
Luo, Yuanke [Thu, 31 Dec 2020 05:47:42 +0000 (13:47 +0800)]
[X86] Fix tile register spill issue.

The tile register spill need 2 instructions.
%46:gr64_nosp = MOV64ri 64
TILESTORED %stack.2, 1, killed %46:gr64_nosp, 0, $noreg, %43:tile
The first instruction load the stride to a GPR, and the second
instruction store tile register to stack slot. The optimization of merge
spill instruction is done after register allocation. And spill tile
register need create a new virtual register to for stride, so we can't
hoist tile spill instruction in postOptimization() of register
allocation. We can't hoist TILESTORED alone and we can't hoist the 2
instuctions together because MOV64ri will clobber some GPR. This patch
is to disble the spill merge for any spill which need 2 instructions.

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

3 years ago[clangd] Add metrics for go-to-implementation.
Haojian Wu [Mon, 11 Jan 2021 08:55:24 +0000 (09:55 +0100)]
[clangd] Add metrics for go-to-implementation.

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

3 years ago[ARM] Add debug messages for the load store optimizer. NFC
David Green [Mon, 11 Jan 2021 09:24:28 +0000 (09:24 +0000)]
[ARM] Add debug messages for the load store optimizer. NFC

3 years ago[NFC][InstructionCost] Change LoopVectorizationCostModel::getInstructionCost to retur...
David Sherwood [Wed, 25 Nov 2020 15:55:43 +0000 (15:55 +0000)]
[NFC][InstructionCost] Change LoopVectorizationCostModel::getInstructionCost to return InstructionCost

This patch is part of a series of patches that migrate integer
instruction costs to use InstructionCost. In the function
selectVectorizationFactor I have simply asserted that the cost
is valid and extracted the value as is. In future we expect
to encounter invalid costs, but we should filter out those
vectorization factors that lead to such invalid costs.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

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

3 years agoReapply "[clang][cli] Port DiagnosticOpts to new option parsing system"
Jan Svoboda [Fri, 8 Jan 2021 10:05:16 +0000 (11:05 +0100)]
Reapply "[clang][cli] Port DiagnosticOpts to new option parsing system"

This reverts commit 8e3e148c

This commit fixes two issues with the original patch:
* The sanitizer build bot reported an uninitialized value. This was caused by normalizeStringIntegral not returning None on failure.
* Some build bots complained about inaccessible keypaths. To mitigate that, "this->" was added back to the keypath to restore the previous behavior.

3 years ago[NFC] Remove min/max functions from InstructionCost
David Sherwood [Thu, 7 Jan 2021 15:02:50 +0000 (15:02 +0000)]
[NFC] Remove min/max functions from InstructionCost

Removed the InstructionCost::min/max functions because it's
fine to use std::min/max instead.

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

3 years ago[ARM] Update trunc costs
David Green [Mon, 11 Jan 2021 08:59:28 +0000 (08:59 +0000)]
[ARM] Update trunc costs

We did not have specific costs for larger than legal truncates that were
not otherwise cheap (where they were next to stores, for example). As
MVE does not have a dedicated instruction for them (and we do not use
loads/stores yet), they should be expensive as they get expanded to a
series of lane moves.

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

3 years ago[clang-format] Find main include after block ended with #pragma hdrstop
Rafał Jelonek [Mon, 11 Jan 2021 08:43:30 +0000 (09:43 +0100)]
[clang-format] Find main include after block ended with #pragma hdrstop

Find main include in first include block not ended with #pragma hdrstop

Reviewed By: curdeius

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

3 years ago[clang-format] turn on formatting after "clang-format on" while sorting includes
Rafał Jelonek [Mon, 11 Jan 2021 08:34:01 +0000 (09:34 +0100)]
[clang-format] turn on formatting after "clang-format on" while sorting includes

Formatting is not active after "clang-format on" due to merging lines while formatting is off. Also, use trimmed line. Behaviour with LF is different than with CRLF.

Reviewed By: curdeius, MyDeveloperDay

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

3 years ago[ARM] Additional trunc cost tests. NFC
David Green [Mon, 11 Jan 2021 08:35:16 +0000 (08:35 +0000)]
[ARM] Additional trunc cost tests. NFC

3 years ago[clang-format] Skip UTF8 Byte Order Mark while sorting includes
Rafał Jelonek [Mon, 11 Jan 2021 08:28:41 +0000 (09:28 +0100)]
[clang-format] Skip UTF8 Byte Order Mark while sorting includes

If file contain BOM then first instruction (include or clang-format off) is ignored

Reviewed By: MyDeveloperDay

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

3 years ago[CSKY] Add visibility macro to fix link error
Zi Xuan Wu [Mon, 11 Jan 2021 08:18:01 +0000 (16:18 +0800)]
[CSKY] Add visibility macro to fix link error

Add LLVM_EXTERNAL_VISIBILITY macro to fix link error of
https://reviews.llvm.org/D88466#2476378

3 years agoRemove redundant casts.
Adrian Kuegel [Fri, 8 Jan 2021 14:37:06 +0000 (15:37 +0100)]
Remove redundant casts.

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

3 years ago[RISCV] Clear isCodeGenOnly flag on VMSGE(U) pseudo instructions. Remove InstAliases...
Craig Topper [Mon, 11 Jan 2021 06:35:51 +0000 (22:35 -0800)]
[RISCV] Clear isCodeGenOnly flag on VMSGE(U) pseudo instructions. Remove InstAliases that duplicate the asm strings in the pseudos.

The Pseudo class sets isCodeGenOnly=1 which causes the asm strings
in the pseudos to be ignored. I think this is why the aliases are
needed at all.

Reviewed By: frasercrmck

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

3 years ago[JITLink] Rename PostAllocationPasses to PreFixupPasses.
Lang Hames [Mon, 11 Jan 2021 07:30:09 +0000 (18:30 +1100)]
[JITLink] Rename PostAllocationPasses to PreFixupPasses.

PreFixupPasses better reflects when these passes will run.

A future patch will (re)introduce a PostAllocationPasses list that will run
after allocation, but before JITLinkContext::notifyResolved is called to notify
the rest of the JIT about the resolved symbol addresses.

3 years ago[NFC][AsmPrinter] Make comments for spill/reload more precise.
Hsiangkai Wang [Fri, 8 Jan 2021 13:07:05 +0000 (21:07 +0800)]
[NFC][AsmPrinter] Make comments for spill/reload more precise.

The size of spill/reload may be unknown for scalable vector types.
When the size is unknown, print it as "Unknown-size" instead of a very
large number.

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

3 years ago[MLIR][SPIRV] Add (de-)serialization support for SpecConstantOpeation.
ergawy [Mon, 11 Jan 2021 06:37:34 +0000 (07:37 +0100)]
[MLIR][SPIRV] Add (de-)serialization support for SpecConstantOpeation.

This commit adds support for (de-)serializing SpecConstantOpeation. One
thing worth noting is that during deserialization, we assign a fake ID to
enclosed ops inside SpecConstantOpeation. We need to do this in order
for deserialization logic to properly update ID to value map and to
later reference the created value from the sibling 'spv::YieldOp'.

Reviewed By: antiagainst

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

3 years agoCGDebugInfo: Delete unneeded UnwrapTypeForDebugInfo
Fangrui Song [Mon, 11 Jan 2021 06:22:07 +0000 (22:22 -0800)]
CGDebugInfo: Delete unneeded UnwrapTypeForDebugInfo

Tested with stage 2 -DCMAKE_BUILD_TYPE=Debug clang, byte identical.

3 years agoCGDebugInfo: Delete redundant test
Fangrui Song [Mon, 11 Jan 2021 06:09:47 +0000 (22:09 -0800)]
CGDebugInfo: Delete redundant test

3 years ago[IR Parser] Fix a crash handling zero width integer attributes.
Chris Lattner [Mon, 11 Jan 2021 02:32:57 +0000 (18:32 -0800)]
[IR Parser] Fix a crash handling zero width integer attributes.

llvm::APInt cannot hold zero bit values, therefore we shouldn't try
to form them.

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

3 years ago[PowerPC] Add variants of 64-bit vector types for vec_sel.
Esme-Yi [Mon, 11 Jan 2021 03:52:16 +0000 (03:52 +0000)]
[PowerPC] Add variants of 64-bit vector types for vec_sel.

Summary: This patch added variants of vec_sel and fixed bugzilla 46770.

Reviewed By: nemanjai

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

3 years ago[LoopUnroll] Fix a crash
Serguei Katkov [Tue, 22 Dec 2020 09:40:50 +0000 (16:40 +0700)]
[LoopUnroll] Fix a crash

Loop peeling as a last step triggers loop simplification and this
can change the loop structure. As a result all cashed values like
latch branch becomes invalid.

Patch re-structure the code to take into account the possible
changes caused by peeling.

Reviewers: dmgreen, Meinersbur, etiotto, fhahn, efriedma, bmahjour
Reviewed By: Meinersbur, fhahn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D93686

3 years ago[RISCV] Convert most of the information about RVV Pseudos into bits in TSFlags.
Craig Topper [Mon, 11 Jan 2021 02:01:23 +0000 (18:01 -0800)]
[RISCV] Convert most of the information about RVV Pseudos into bits in TSFlags.

This patch moves all but the BaseInstr to bits in TSFlags.

For the index fields, we can just use a bit to indicate their presence.
The locations of the operands are well defined.

This reduces the llc binary by about 32K on my build. It also
removes the binary search of the table from the custom inserter.
Instead we just check that the SEW op is present.

Reviewed By: rogfer01

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

3 years ago[DAGCombine] Remove the check for unsafe-fp-math when we are checking the AFN
QingShan Zhang [Mon, 11 Jan 2021 02:25:53 +0000 (02:25 +0000)]
[DAGCombine] Remove the check for unsafe-fp-math when we are checking the AFN

We are checking the unsafe-fp-math for sqrt but not for fpow, which behaves inconsistent.
As the direction is to remove this global option, we need to remove the unsafe-fp-math
check for sqrt and update the test with afn fast-math flags.

Reviewed By: Spatel

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

3 years agoRevert "[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())"
Nico Weber [Mon, 11 Jan 2021 01:22:53 +0000 (20:22 -0500)]
Revert "[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())"

This reverts commit 80dee7965dffdfb866afa9d74f3a4a97453708b2.
Makes clang sometimes hang forever. See
https://bugs.chromium.org/p/chromium/issues/detail?id=1164786#c6 for a
stand-alone repro.

3 years ago[LoopDeletion] Break backedge of outermost loops when known not taken
Philip Reames [Sun, 10 Jan 2021 23:57:25 +0000 (15:57 -0800)]
[LoopDeletion] Break backedge of outermost loops when known not taken

This is a resubmit of dd6bb367 (which was reverted due to stage2 build failures in 7c63aac), with the additional restriction added to the transform to only consider outer most loops.

As shown in the added test case, ensuring LCSSA is up to date when deleting an inner loop is tricky as we may actually need to remove blocks from any outer loops, thus changing the exit block set.   For the moment, just avoid transforming this case.  I plan to return to this case in a follow up patch and see if we can do better.

Original commit message follows...

The basic idea is that if SCEV can prove the backedge isn't taken, we can go ahead and get rid of the backedge (and thus the loop) while leaving the rest of the control in place. This nicely handles cases with dispatch between multiple exits and internal side effects.

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

3 years agoCGDebugInfo: Delete unused DIFile* parameter
Fangrui Song [Sun, 10 Jan 2021 23:03:40 +0000 (15:03 -0800)]
CGDebugInfo: Delete unused DIFile* parameter

3 years ago[StringExtras] Add a helper class for comma-separated lists
Kazu Hirata [Sun, 10 Jan 2021 22:32:02 +0000 (14:32 -0800)]
[StringExtras] Add a helper class for comma-separated lists

This patch introduces a helper class SubsequentDelim to simplify loops
that generate a comma-separated lists.

For example, consider the following loop, taken from
llvm/lib/CodeGen/MachineBasicBlock.cpp:

    for (auto I = pred_begin(), E = pred_end(); I != E; ++I) {
      if (I != pred_begin())
        OS << ", ";
      OS << printMBBReference(**I);
    }

The new class allows us to rewrite the loop as:

    SubsequentDelim SD;
    for (auto I = pred_begin(), E = pred_end(); I != E; ++I)
      OS << SD << printMBBReference(**I);

where SD evaluates to the empty string for the first time and ", " for
subsequent iterations.

Unlike interleaveComma, defined in llvm/include/llvm/ADT/STLExtras.h,
SubsequentDelim can accommodate a wider variety of loops, including:

- those that conditionally skip certain items,
- those that need iterators to call getSuccProbability(I), and
- those that iterate over integer ranges.

As an example, this patch cleans up MachineBasicBlock::print.

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

3 years ago[OpenMP] Not set OPENMP_STANDALONE_BUILD=ON when building OpenMP along with LLVM
Shilei Tian [Sun, 10 Jan 2021 21:46:09 +0000 (16:46 -0500)]
[OpenMP] Not set OPENMP_STANDALONE_BUILD=ON when building OpenMP along with LLVM

For now, `*_STANDALONE_BUILD` is set to ON even if they're built along
with LLVM because of issues mentioned in the comments. This can cause some issues.
For example, if we build OpenMP along with LLVM, we'd like to copy those OpenMP
headers to `<prefix>/lib/clang/<version>/include` such that `clang` can find
those headers without using `-I <prefix>/include` because those headers will be
copied to `<prefix>/include` if it is built standalone.

In this patch, we fixed the dependence issue in OpenMP such that it can be built
correctly even with `OPENMP_STANDALONE_BUILD=OFF`. The issue is in the call to
`add_lit_testsuite`, where `clang` and `clang-resource-headers` are passed as
`DEPENDS`. Since we're building OpenMP along with LLVM, `clang` is set by CMake
to be the C/C++ compiler, therefore these two dependences are no longer needed,
where caused the dependence issue.

Reviewed By: jdoerfert

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

3 years ago[LLVM] Added OpenMP to `LLVM_ALL_RUNTIMES`
Shilei Tian [Sun, 10 Jan 2021 21:45:39 +0000 (16:45 -0500)]
[LLVM] Added OpenMP to `LLVM_ALL_RUNTIMES`

This patch added `openmp` to `LLVM_ALL_RUNTIMES` so that when the CMake argument `LLVM_ENABLE_RUNTIMES=all`, OpenMP can also be built.

Reviewed By: jdoerfert

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

3 years ago[NFCI][SimplifyCFG] Prefer to add Insert edges before Delete edges into DomTreeUpdate...
Roman Lebedev [Sun, 10 Jan 2021 13:25:15 +0000 (16:25 +0300)]
[NFCI][SimplifyCFG] Prefer to add Insert edges before Delete edges into DomTreeUpdater, if reasonable

This has a measurable impact on the number of DomTree recalculations.
While this doesn't handle all the cases,
it deals with the most obvious ones.

3 years ago[lldb] Fix some bugs in the Pipe class and add tests
Pavel Labath [Fri, 8 Jan 2021 19:37:09 +0000 (20:37 +0100)]
[lldb] Fix some bugs in the Pipe class and add tests

- s/createUniqueFile/createUniquePath -- we don't want to create the file,
  just the file name
- s/data()/str().c_str()/ -- paths given to system apis must be
  null-terminated

3 years ago[Tests] Precommit tests from to simplify rebase
Philip Reames [Sun, 10 Jan 2021 20:42:08 +0000 (12:42 -0800)]
[Tests] Precommit tests from to simplify rebase

3 years agoPrecommit tests requested for D93725
Philip Reames [Sun, 10 Jan 2021 20:26:24 +0000 (12:26 -0800)]
Precommit tests requested for D93725

3 years ago[test] Improve CodeGenCXX/difile_entry.cpp
Fangrui Song [Sun, 10 Jan 2021 20:24:49 +0000 (12:24 -0800)]
[test] Improve CodeGenCXX/difile_entry.cpp

The test added in D87147 did not actually test PR47391.
Use an absolute path to test the canonicalization.

3 years ago[Tests] Auto update a vectorizer test to simplify future diff
Philip Reames [Sun, 10 Jan 2021 20:23:22 +0000 (12:23 -0800)]
[Tests] Auto update a vectorizer test to simplify future diff

3 years ago[SLP] fix typo in assert
Sanjay Patel [Sun, 10 Jan 2021 18:15:04 +0000 (13:15 -0500)]
[SLP] fix typo in assert

This snuck into 0aa75fb12faa , but I didn't catch it locally.

3 years ago[SLP] put verifyFunction call behind EXPENSIVE_CHECKS
Sanjay Patel [Sun, 10 Jan 2021 17:31:05 +0000 (12:31 -0500)]
[SLP] put verifyFunction call behind EXPENSIVE_CHECKS

A severe compile-time slowdown from this call is noted in:
https://llvm.org/PR48689
My naive fix was to put it under LLVM_DEBUG ( 267ff79 ),
but that's not limiting in the way we want.
This is a quick fix (or we could just remove the call completely
and rely on some later pass to discover potentially wrong IR?).
A bigger/better fix would be to improve/limit verifyFunction()
as noted in:
https://llvm.org/PR47712

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

3 years ago[llvm] Ensure newlines at the end of files (NFC)
Kazu Hirata [Sun, 10 Jan 2021 17:24:56 +0000 (09:24 -0800)]
[llvm] Ensure newlines at the end of files (NFC)

This patch eliminates pesky "No newline at end of file" messages from
git diff.

3 years ago[MemorySSA] Remove unused dominatesUse (NFC)
Kazu Hirata [Sun, 10 Jan 2021 17:24:54 +0000 (09:24 -0800)]
[MemorySSA] Remove unused dominatesUse (NFC)

The function was introduced without a use on Feb 2, 2016 in commit
e1100f533f0a48f55e80e1152b06f5deab5f9b30.

3 years ago[CodeGen, DebugInfo] Use llvm::find_if (NFC)
Kazu Hirata [Sun, 10 Jan 2021 17:24:53 +0000 (09:24 -0800)]
[CodeGen, DebugInfo] Use llvm::find_if (NFC)

3 years ago[ConstantFold] Fold fptoi.sat intrinsics
Nikita Popov [Sun, 10 Jan 2021 16:07:14 +0000 (17:07 +0100)]
[ConstantFold] Fold fptoi.sat intrinsics

The APFloat::convertToInteger() API already implements the desired
saturation semantics.

3 years ago[ConstantFold] Add tests for fptoi.sat (NFC)
Nikita Popov [Sun, 10 Jan 2021 16:08:11 +0000 (17:08 +0100)]
[ConstantFold] Add tests for fptoi.sat (NFC)

3 years ago[STLExtras] Use return type from operator* of the wrapped iter.
Florian Hahn [Sun, 10 Jan 2021 14:41:13 +0000 (14:41 +0000)]
[STLExtras] Use return type from operator* of the wrapped iter.

Currently make_early_inc_range cannot be used with iterators with
operator* implementations that do not return a reference.

Most notably in the LLVM codebase, this means the User iterator ranges
cannot be used with make_early_inc_range, which slightly simplifies
iterating over ranges while elements are removed.

Instead of directly using BaseT::reference as return type of operator*,
this patch uses decltype to get the actual return type of the operator*
implementation in WrappedIteratorT.

This patch also updates a few places to use make use of
make_early_inc_range.

Reviewed By: dblaikie

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

3 years ago[lld/mac] llvm style fix: no else after return
Nico Weber [Sun, 10 Jan 2021 14:35:00 +0000 (09:35 -0500)]
[lld/mac] llvm style fix: no else after return

3 years ago[mlir] NFC - Drop spurious assertion on symbols during `promoteComposedSymbolsAsDims`
Nicolas Vasilache [Sun, 10 Jan 2021 14:01:54 +0000 (14:01 +0000)]
[mlir] NFC - Drop spurious assertion on symbols during `promoteComposedSymbolsAsDims`

This assertion is an old remnant from earlier days when only affine functions existed.
It is not the place of affine map composition to check whether orthogonal considerations
on what is allowed to be a symbol under the AffineScope trait.

3 years ago[CodeGen] Update transformations to use poison for shufflevector/insertelem's initial...
Juneyoung Lee [Sun, 10 Jan 2021 08:22:54 +0000 (17:22 +0900)]
[CodeGen] Update transformations to use poison for shufflevector/insertelem's initial vector elem

This patch is a part of D93817 and makes transformations in CodeGen use poison for shufflevector/insertelem's initial vector element.

The change in CodeGenPrepare.cpp is fine because the mask of shufflevector should be always zero.
It doesn't touch the second element (which is poison).

The change in InterleavedAccessPass.cpp is also fine becauses the mask is of the form <a, a+m, a+2m, .., a+km> where a+km is smaller than
the size of the first vector operand.
This is guaranteed by the caller of replaceBinOpShuffles, which is lowerInterleavedLoad.
It calls isDeInterleaveMask and isDeInterleaveMaskOfFactor to check the mask is the desirable form.
isDeInterleaveMask has the check that a+km is smaller than the vector size.
To check my understanding, I added an assertion & added a test to show that this optimization doesn't fire in such case.

Reviewed By: spatel

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

3 years ago[test] Improve weakref & weak_import tests
Fangrui Song [Sun, 10 Jan 2021 07:56:55 +0000 (23:56 -0800)]
[test] Improve weakref & weak_import tests

3 years ago[RISCV] Change ConstraintMask in RISCVII enum to be shifted left. NFC
Craig Topper [Sun, 10 Jan 2021 03:56:57 +0000 (19:56 -0800)]
[RISCV] Change ConstraintMask in RISCVII enum to be shifted left. NFC

This makes the mask align with the position of the bits in TSFlags
which is a little more logical.

I might be adding more fields to TSFlags and some might be single
bits where just ANDing with mask to test the bit would make sense.

While there rename TargetFlags in validateInstruction to reflect
that it's just the constraint bits.

3 years ago[RISCV] Use uint16_t instead of unsigned for opcodes in the RVV pseudo instruction...
Craig Topper [Sun, 10 Jan 2021 02:00:05 +0000 (18:00 -0800)]
[RISCV] Use uint16_t instead of unsigned for opcodes in the RVV pseudo instruction table.

We currently have about 7000 opcodes in the RISCVGenInstrInfo.inc
enum. We can use uint16_t to store these values. We would need to
grow by nearly 9x before we run out of space so this should last
for a little while.

This reduces the llc binary by 32K.

3 years ago[lld/mac] remove redundant null check
Nico Weber [Sun, 10 Jan 2021 02:17:59 +0000 (21:17 -0500)]
[lld/mac] remove redundant null check

This is already checked two lines up. No behavior change.

3 years agoRecommit D91678 after fixing the test breakage.
Sriraman Tallam [Sun, 10 Jan 2021 01:40:38 +0000 (17:40 -0800)]
Recommit D91678 after fixing the test breakage.

This adds a new test checking llvm-symbolizer with an object built with basic block sections.

Build a object with -fbasic-block-sections and reorder the basic blocks to be
non-contiguous. Then check if llvm-symbolizer correctly reports the symbolized
addresses. Included the source to build the object with command lines.

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

3 years ago[CodeGenModule] Drop dso_local on function declarations for ELF -fno-pic -fno-direct...
Fangrui Song [Sun, 10 Jan 2021 00:31:55 +0000 (16:31 -0800)]
[CodeGenModule] Drop dso_local on function declarations for ELF -fno-pic -fno-direct-access-external-data

ELF -fno-pic sets dso_local on a function declaration to allow direct accesses
when taking its address (similar to a data symbol). The emitted code follows the
traditional GCC/Clang -fno-pic behavior: an absolute relocation is produced.

If the function is not defined in the executable, a canonical PLT entry will be
needed at link time. This is similar to a copy relocation and is incompatible
with (-Bsymbolic or --dynamic-list linked shared objects / protected symbols in
a shared object).

This patch gives -fno-pic code a way to avoid such a canonical PLT entry.

The FIXME was about a generalization for -fpie -mpie-copy-relocations (now -fpie
-fdirect-access-external-data). While we could set dso_local to avoid GOT when
taking the address of a function declaration (there is an ignorable difference
about R_386_PC32 vs R_386_PLT32 on i386), it likely does not provide any benefit
and can just cause trouble, so we don't make the generalization.

3 years ago[RISCV] Add scalable vector icmp ISel patterns
Fraser Cormack [Sat, 9 Jan 2021 19:21:23 +0000 (19:21 +0000)]
[RISCV] Add scalable vector icmp ISel patterns

Original patch by @rogfer01.

The RVV integer comparison instructions are defined in such a way that
many LLVM operations are defined by using the "opposite" comparison
instruction and swapping the operands. This is done in this patch in
most cases, except for the mappings where the immediate range must be
adjusted to accomodate:

    va < i --> vmsle{u}.vi vd, va, i-1, vm
    va >= i --> vmsgt{u}.vi vd, va, i-1, vm

That is left for future optimization; this patch supports all operations
but in the case of the missing mappings the immediate will be moved to
a scalar register first.

Since there are so many condition codes and operand cases to check, it
was decided to reduce the test burden by only testing the "vscale x 8"
vector types.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper

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

3 years ago[SelectionDAG] Teach isConstOrConstSplat about ISD::SPLAT_VECTOR
Fraser Cormack [Sat, 9 Jan 2021 17:12:22 +0000 (17:12 +0000)]
[SelectionDAG] Teach isConstOrConstSplat about ISD::SPLAT_VECTOR

This improves llvm::isConstOrConstSplat by allowing it to analyze
ISD::SPLAT_VECTOR nodes, in order to allow more constant-folding of
operations using scalable vector types.

Reviewed By: craig.topper

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

3 years ago[mlir] Enhance mlir-opt show-dialects test case
Lewuathe [Sat, 9 Jan 2021 20:43:43 +0000 (20:43 +0000)]
[mlir] Enhance mlir-opt show-dialects test case

mlir-opt supports many more test cases. All available dialects supported by latest mlir-opt should be coverted in the test case.

Reviewed By: aartbik, stephenneuendorffer, mehdi_amini

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

3 years ago[clang] Add llvm-strip to test dependencies
Shoaib Meenai [Sat, 9 Jan 2021 19:57:09 +0000 (11:57 -0800)]
[clang] Add llvm-strip to test dependencies

CodeGen/thinlto_embed_bitcode.ll relies on it.

3 years ago[NFC] Disallow unused prefixes in CodeGen/X86 tests.
Mircea Trofin [Fri, 8 Jan 2021 20:21:29 +0000 (12:21 -0800)]
[NFC] Disallow unused prefixes in CodeGen/X86 tests.

Also fixed remaining tests that featured unused prefixes.

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

3 years ago[mlir][vector] modified scatter/gather syntax, pass_thru mandatory
Aart Bik [Sat, 9 Jan 2021 00:25:37 +0000 (16:25 -0800)]
[mlir][vector] modified scatter/gather syntax, pass_thru mandatory

This change makes the scatter/gather syntax more consistent with
the syntax of all the other memory operations in the Vector dialect
(order of types, use of [] for index, etc.). This will make the MLIR
code easier to read. In addition, the pass_thru parameter of the
gather has been made mandatory (there is very little benefit in
using the implicit "undefined" values).

Reviewed By: nicolasvasilache

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

3 years ago[SimplifyCFG] Keep !dgb metadata of moved instruction, if they match.
Florian Hahn [Sat, 9 Jan 2021 17:02:58 +0000 (17:02 +0000)]
[SimplifyCFG] Keep !dgb metadata of moved instruction, if they match.

Currently SimplifyCFG drops the debug locations of 'bonus' instructions.
Such instructions are moved before the first branch. The reason for the
current behavior is that this could lead to surprising debug stepping,
if the block that's folded is dead.

In case the first branch and the instructions to be folded have the same
debug location, this shouldn't be an issue and we can keep the debug
location.

Reviewed By: vsk

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

3 years ago[gn build] Make an explicit `use_lld = true` on mac use lld.darwinnew
Nico Weber [Sat, 9 Jan 2021 19:03:52 +0000 (14:03 -0500)]
[gn build] Make an explicit `use_lld = true` on mac use lld.darwinnew

use_lld defaults to true on non-mac if clang_base_path is set (i.e.
the host compiler is a locally-built clang). On mac, the lld Mach-O
port used to be unusable, but ld64.lld.darwinnew is close to usable.
When explicitly setting `use_lld = true` in a GN build on a mac host,
check-lld passes, two check-clang tests fail, and a handful check-llvm
tests fail (the latter all due to -flat_namespace not yet being implemented).

3 years ago[OpenMP] Remove copy constructor of `RTLInfoTy`
Shilei Tian [Sat, 9 Jan 2021 18:00:50 +0000 (13:00 -0500)]
[OpenMP] Remove copy constructor of `RTLInfoTy`

Multiple `RTLInfoTy` objects are stored in a list `AllRTLs`. Since
`RTLInfoTy` contains a `std::mutex`, it is by default not a copyable object.
In order to support `AllRTLs.push_back(...)` which is currently used, a customized
copy constructor is provided. Every time we need to add a new data member into
`RTLInfoTy`, we should keep in mind not forgetting to add corresponding assignment
in the copy constructor. In fact, the only use of the copy constructor is to push
the object into the list, we can of course write it in a way that first emplace
a new object back, and then use the reference to the last element. In this way we
don't need the copy constructor anymore. If the element is invalid, we just need
to pop it, and that's what this patch does.

Reviewed By: JonChesterfield

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

3 years ago[lld-macho] Remove unnecessary llvm:: namespace prefixes
Jez Ng [Sat, 9 Jan 2021 16:58:19 +0000 (11:58 -0500)]
[lld-macho] Remove unnecessary llvm:: namespace prefixes

3 years ago[llvm] Drop unnecessary make_range (NFC)
Kazu Hirata [Sat, 9 Jan 2021 17:24:59 +0000 (09:24 -0800)]
[llvm] Drop unnecessary make_range (NFC)

3 years ago[Transforms] Use llvm::find_if (NFC)
Kazu Hirata [Sat, 9 Jan 2021 17:24:58 +0000 (09:24 -0800)]
[Transforms] Use llvm::find_if (NFC)

3 years ago[SCEV] Remove unused getOrInsertCanonicalInductionVariable (NFC)
Kazu Hirata [Sat, 9 Jan 2021 17:24:56 +0000 (09:24 -0800)]
[SCEV] Remove unused getOrInsertCanonicalInductionVariable (NFC)

The last use was removed on Mar 22, 2012 in commit
f47d0af5515bee47dfd000363740fe347bb6cd18.

3 years ago[SelectionDAG] Extend immAll(Ones|Zeros)V to handle ISD::SPLAT_VECTOR
Fraser Cormack [Wed, 6 Jan 2021 08:07:41 +0000 (08:07 +0000)]
[SelectionDAG] Extend immAll(Ones|Zeros)V to handle ISD::SPLAT_VECTOR

The TableGen immAllOnesV and immAllZerosV helpers implicitly wrapped the
ISD::isBuildVectorAll(Ones|Zeros) helper functions. This was inhibiting
their use for targets such as RISC-V which use ISD::SPLAT_VECTOR. In
particular, RISC-V had to define its own 'vnot' fragment.

In order to extend the scope of these nodes to include support for
ISD::SPLAT_VECTOR, two new ISD predicate functions have been introduced:
ISD::isConstantSplatVectorAll(Ones|Zeros). These effectively supersede
the older "isBuildVector" predicates, which are now simple wrappers for
the new functions. They pass a defaulted boolean toggle which preserves
the old behaviour. It is hoped that in time all call-sites can be ported
to the "isConstantSplatVector" functions.

While the use of ISD::isBuildVectorAll(Ones|Zeros) has not changed, the
behaviour of the TableGen immAll(Ones|Zeros)V **has**. To test the new
functionality, the custom RISC-V TableGen fragment has been removed and
replaced with the built-in 'vnot'. To test their use as pattern-roots, two
splat patterns have been updated accordingly.

Reviewed By: craig.topper

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

3 years ago[OpenMP] Added the support for cache line size 256 for A64FX
Shilei Tian [Sat, 9 Jan 2021 16:58:37 +0000 (11:58 -0500)]
[OpenMP] Added the support for cache line size 256 for A64FX

Fugaku supercomputer is built with the Fujitsu A64FX microprocessor, whose cache line is 256. In current libomp, we only have cache line size 128 for PPC64 and otherwise 64. This patch added the support of cache line 256 for A64FX. It's worth noting that although A64FX is a variant of AArch64, this property is not shared. As a result, in light of UCX source code (https://github.com/openucx/ucx/blob/392443ab92626412605dee1572056f79c897c6c3/src/ucs/arch/aarch64/cpu.c#L17), we can only determine by checking whether the CPU is FUJITSU A64FX.

Reviewed By: jdoerfert, Hahnfeld

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

3 years ago[RISCV] Do not grow the stack a second time when we need to realign the stack
Roger Ferrer Ibanez [Sat, 9 Jan 2021 16:49:05 +0000 (16:49 +0000)]
[RISCV] Do not grow the stack a second time when we need to realign the stack

This is a first change needed to fix a crash in which the emergency
spill splot ends being out of reach. This happens when we run the
register scavenger after we have eliminated the frame indexes. The fix
for the actual crash will come in a later change.

This change removes an extra stack size increase we do in
RISCVFrameLowering::determineFrameLayout.

We don't have to change the size of the stack here as
PEI::calculateFrameObjectOffsets is already doing this with the right
size accounting the extra alignment.

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

3 years ago[VPlan] Keep start value of VPWidenPHIRecipe as VPValue.
Florian Hahn [Sat, 9 Jan 2021 16:34:15 +0000 (16:34 +0000)]
[VPlan] Keep start value of VPWidenPHIRecipe as VPValue.

Similar to D92129, update VPWidenPHIRecipe  to manage the start value as
VPValue. This allows adjusting the start value as a VPlan transform,
which will be used in a follow-up patch to support reductions during
epilogue vectorization.

Reviewed By: gilr

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

3 years ago[clang][Sema] Compare SourceLocations directly [NFCI]
Mikhail Maltsev [Sat, 9 Jan 2021 14:13:18 +0000 (14:13 +0000)]
[clang][Sema] Compare SourceLocations directly [NFCI]

The ordered comparison operators are defined for the SourceLocation
class, so SourceLocation objects can be compared directly. There is no
need to extract the internal representation for comparison.

Reviewed By: aprantl

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

3 years ago[mlir][spirv] Replace SPIRVOpLowering with OpConversionPattern
Lei Zhang [Sat, 9 Jan 2021 13:04:49 +0000 (08:04 -0500)]
[mlir][spirv] Replace SPIRVOpLowering with OpConversionPattern

The dialect conversion framework was enhanced to handle type
conversion automatically. OpConversionPattern already contains
a pointer to the TypeConverter. There is no need to duplicate it
in a separate subclass. This removes the only reason for a
SPIRVOpLowering subclass. It adapts to use core infrastructure
and simplifies the code.

Also added a utility function to OpConversionPattern for getting
TypeConverter as a certain subclass.

Reviewed By: hanchung

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

3 years ago[WebAssembly] Remove unreachable EH pads
Heejin Ahn [Sun, 27 Dec 2020 10:52:43 +0000 (02:52 -0800)]
[WebAssembly] Remove unreachable EH pads

This removes unreachable EH pads in LateEHPrepare. This is not for
optimization but for preparation for CFGStackify. In CFGStackify, we
determine where to place `try` marker by computing the nearest common
dominator of all predecessors of an EH pad, but when an EH pad does not
have a predecessor, it becomes tricky. We can insert an empty dummy BB
before the EH pad and place the `try` there, but removing unreachable EH
pads is simpler.

This moves an existing exception label test from eh-label.mir to
exception.mir and adds a new test there.

This also adds some comments to existing methods.

Reviewed By: dschuff, tlively

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

3 years ago[RISCV] Add tests for scalable constant-folding (NFC)
Fraser Cormack [Sat, 9 Jan 2021 10:29:50 +0000 (10:29 +0000)]
[RISCV] Add tests for scalable constant-folding (NFC)

3 years ago[Test][FileCheck] Fix use of undef var
Thomas Preud'homme [Thu, 20 Aug 2020 19:41:43 +0000 (20:41 +0100)]
[Test][FileCheck] Fix use of undef var

The test related to directives with prefix NUMEXPR-CONSTRAINT-NOMATCH
refers to the numeric variable UNSI which is defined by a directive with
prefix CHECK not enabled on the lit command-line. Rather than adding the
prefix CHECK to the lit command-line, this commit defined variable UNSI
in a new NUMEXPR-CONSTRAINT-NOMATCH prefixed directive. The directive
needs to contain more than just the variable otherwise the error message
from FileCheck is about the wrong line being matched.

Reviewed By: jhenderson

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

3 years ago[WebAssembly] Update InstPrinter support for EH
Heejin Ahn [Sun, 27 Dec 2020 09:10:53 +0000 (01:10 -0800)]
[WebAssembly] Update InstPrinter support for EH

- Updates InstPrinter to handle `catch_all`.
- Makes `rethrow` condition an early exit from the function to make the
  rest simpler.
- Unify label and catch counters. They don't need to be counted
  separately and this will help `delegate` instruction later.
- Removes `LastSeenEHInst` field. This was first introduced to handle
  when there are more than one `catch` blocks per `try`, but this was
  not implemented correctly and not being used at the moment anyway.
- Reenables all tests in cfg-stackify-eh.ll that don't deal with unwind
  destination mismatches, which will be handled in a later CL.

Reviewed By: dschuff, tlively, aardappel

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

3 years ago[mlir] AsyncRuntime: use LLVM ThreadPool to run async tasks
Eugene Zhulenev [Fri, 8 Jan 2021 23:23:59 +0000 (15:23 -0800)]
[mlir] AsyncRuntime: use LLVM ThreadPool to run async tasks

Revert https://reviews.llvm.org/D92368 after the dynamic library unloading was fixed in https://reviews.llvm.org/D94312

Reviewed By: mehdi_amini

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

3 years ago[WebAssembly] Remove exnref and br_on_exn
Heejin Ahn [Sat, 26 Dec 2020 04:23:33 +0000 (20:23 -0800)]
[WebAssembly] Remove exnref and br_on_exn

This removes `exnref` type and `br_on_exn` instruction. This is
effectively NFC because most uses of these were already removed in the
previous CLs.

Reviewed By: dschuff, tlively

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

3 years ago[WebAssembly] Update basic EH instructions for the new spec
Heejin Ahn [Sat, 26 Dec 2020 10:27:44 +0000 (02:27 -0800)]
[WebAssembly] Update basic EH instructions for the new spec

This implements basic instructions for the new spec.

- Adds new versions of instructions: `catch`, `catch_all`, and `rethrow`
- Adds support for instruction selection for the new instructions
 - `catch` needs a custom routine for the same reason `throw` needs one,
   to encode `__cpp_exception` tag symbol.
- Updates `WebAssembly::isCatch` utility function to include `catch_all`
  and Change code that compares an instruction's opcode with `catch` to
  use that function.
- LateEHPrepare
  - Previously in LateEHPrepare we added `catch` instruction to both
    `catchpad`s (for user catches) and `cleanuppad`s (for destructors).
    In the new version `catch` is generated from `llvm.catch` intrinsic
    in instruction selection phase, so we only need to add `catch_all`
    to the beginning of cleanup pads.
  - `catch` is generated from instruction selection, but we need to
    hoist the `catch` instruction to the beginning of every EH pad,
    because `catch` can be in the middle of the EH pad or even in a
    split BB from it after various code transformations.
  - Removes `addExceptionExtraction` function, which was used to
    generate `br_on_exn` before.
- CFGStackfiy: Deletes `fixUnwindMismatches` function. Running this
  function on the new instruction causes crashes, and the new version
  will be added in a later CL, whose contents will be completely
  different. So deleting the whole function will make the diff easier to
  read.
- Reenables all disabled tests in exception.ll and eh-lsda.ll and a
  single basic test in cfg-stackify-eh.ll.
- Updates existing tests to use the new assembly format. And deletes
  `br_on_exn` instructions from the tests and FileCheck lines.

Reviewed By: dschuff, tlively

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

3 years agoFix CodeGenCXX/difile_entry.cpp on Windows
Fangrui Song [Sat, 9 Jan 2021 08:46:02 +0000 (00:46 -0800)]
Fix CodeGenCXX/difile_entry.cpp on Windows