platform/upstream/llvm.git
3 years ago[flang][driver] Fix formatting in a test (nfc)
Andrzej Warzynski [Tue, 22 Dec 2020 13:38:13 +0000 (13:38 +0000)]
[flang][driver] Fix formatting in a test (nfc)

3 years ago[clang][cli] Implement `getAllArgValues` marshalling
Jan Svoboda [Mon, 21 Dec 2020 13:28:09 +0000 (14:28 +0100)]
[clang][cli] Implement `getAllArgValues` marshalling

This infrastructure can be used ~30 more command line options.

Reviewed By: dexonsmith

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

3 years ago[flang][driver] Refactor unit tests for frontend actions (nfc)
Andrzej Warzynski [Tue, 22 Dec 2020 11:07:58 +0000 (11:07 +0000)]
[flang][driver] Refactor unit tests for frontend actions (nfc)

These patch implements a few non-functional-changes:
  * switch to using test fixtures for better code sharing
  * rename some variables (e.g. to communicate their purpose a bit better)
This patch doesn't change _what_ is being tested.

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

3 years ago[clang-format] NFC keep the code clang-formatted
mydeveloperday [Tue, 22 Dec 2020 12:44:57 +0000 (12:44 +0000)]
[clang-format] NFC keep the code clang-formatted

3 years ago[AArch64] Add a test for MachineLICM SinkIntoLoop. NFC.
Sjoerd Meijer [Tue, 22 Dec 2020 12:10:43 +0000 (12:10 +0000)]
[AArch64] Add a test for MachineLICM SinkIntoLoop. NFC.

3 years ago[ASTMatchers] Traverse-ignore range-for implementation details
Stephen Kelly [Sun, 20 Dec 2020 01:32:50 +0000 (01:32 +0000)]
[ASTMatchers] Traverse-ignore range-for implementation details

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

3 years ago[compiler-rt] Fix atomic_test.c on macOS
Alex Richardson [Tue, 22 Dec 2020 11:43:48 +0000 (11:43 +0000)]
[compiler-rt] Fix atomic_test.c on macOS

The macOS name mangling adds another underscore. Therefore, on macOS
the __atomic_* functions are actually ___atomic_* in libcompiler_rt.dylib.
To handle this case, prepend the asm() argument with __USER_LABEL_PREFIX__
in the same way that atomic.c does.

Reviewed By: ldionne

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

3 years ago[libc++] Add a 'is-lockfree-runtime-function' lit feature
Alex Richardson [Tue, 22 Dec 2020 11:42:07 +0000 (11:42 +0000)]
[libc++] Add a 'is-lockfree-runtime-function' lit feature

On macOS 10.14 /usr/lib/system/libcompiler_rt.dylib contains all the
`__atomic_load*`, etc. functions but does not include the `__atomic_is_lock_free`
function. The lack of this function causes the non-lockfree-atomics feature
to be set to false even though large atomic operations are actually
supported, it's just the is_lock_free() function that is missing.

This is required so that the !non-lockfree-atomics feature can be used
to XFAIL tests that require runtime library support (D88818).

Reviewed By: #libc, ldionne

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

3 years agoRevert "-fstack-clash-protection: Return an actual error when used on unsupported OS"
Nico Weber [Tue, 22 Dec 2020 11:51:19 +0000 (06:51 -0500)]
Revert "-fstack-clash-protection: Return an actual error when used on unsupported OS"

This reverts commit 4d59c8fdb955ea0d668b854f467e12bce05a8857.
Breaks tens of thousands of tests, and had pending review comments, see
comments on https://reviews.llvm.org/D92245 (and e.g.
http://lab.llvm.org:8011/#/builders/109/builds/5236 for failures).

3 years ago[PowerPC] Restore stack ptr from base ptr when available
Nemanja Ivanovic [Tue, 22 Dec 2020 11:43:33 +0000 (05:43 -0600)]
[PowerPC] Restore stack ptr from base ptr when available

On subtargets that have a red zone, we will copy the stack pointer to the base
pointer in the prologue prior to updating the stack pointer. There are no other
updates to the base pointer after that. This suggests that we should be able to
restore the stack pointer from the base pointer rather than loading it from the
back chain or adding the frame size back to either the stack pointer or the
frame pointer.
This came about because functions that call setjmp need to restore the SP from
the FP because the back chain might have been clobbered
(see https://reviews.llvm.org/D92906). However, if the stack is realigned, the
restored SP might be incorrect (which is what caused the failures in the two
ASan test cases).

This patch was tested quite extensivelly both with sanitizer runtimes and
general code.

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

3 years ago[gn build] (manually) port b8c37153d5393
Nico Weber [Tue, 22 Dec 2020 11:35:40 +0000 (06:35 -0500)]
[gn build] (manually) port b8c37153d5393

3 years ago[clangd] Reuse buffer for JSONTransport::sendMessage
Nathan James [Tue, 22 Dec 2020 11:30:55 +0000 (11:30 +0000)]
[clangd] Reuse buffer for JSONTransport::sendMessage

Allocate a Buffer in the JSONTransport to be used when sending messages to the client.
This gets reused each time a message is sent, reducing in fewer malloc, which is always a bonus.

Reviewed By: sammccall

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

3 years ago[llvm][Arm/AArch64] Format extension flags in CPU test failures
David Spickett [Thu, 17 Dec 2020 10:52:37 +0000 (10:52 +0000)]
[llvm][Arm/AArch64] Format extension flags in CPU test failures

Previously you just two hex numbers you had to decode manually.
This change adds a predicate formatter for extension flags
to produce failure messages like:
```
[ RUN      ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/2
<...>llvm/unittests/Support/TargetParserTest.cpp:862:
Failure
Expected extension flags: +fp-armv8, +crc, +crypto (0xe)
     Got extension flags: +fp-armv8, +neon, +crc, +crypto (0x1e)
[  FAILED  ] AArch64CPUTests/AArch64CPUTestFixture.testAArch64CPU/2,
where GetParam() = "cortex-a34", "armv8-a", <...>
```

From there you can take the feature name and map it back
to the enum in ARM/AArch64TargetParser.def.
(which isn't perfect but you've probably got both files
open if you're editing these tests)

Note that AEK_NONE is not meant to be user facing in the compiler
but here it is part of the tests. So failures may show an
extension "none" where the normal target parser wouldn't.

The formatter is implemented as a template on ARM::ISAKind
because the predicate formatters assume all parameters are used
for comparison.
(e.g. PRED_FORMAT3 is for comparing 3 values, not having 3
arguments in general)

Reviewed By: MarkMurrayARM

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

3 years ago-fstack-clash-protection: Return an actual error when used on unsupported OS
Sylvestre Ledru [Mon, 30 Nov 2020 17:29:55 +0000 (18:29 +0100)]
-fstack-clash-protection: Return an actual error when used on unsupported OS

$ clang-12: error: -fstack-clash-protection is not supported on Windows or Mac OS X

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

3 years agoFold comparison of __builtin_object_size expression with -1 for non-const size
Siddhesh Poyarekar [Tue, 22 Dec 2020 09:51:41 +0000 (10:51 +0100)]
Fold comparison of __builtin_object_size expression with -1 for non-const size

When __builtin_dynamic_object_size returns a non-constant expression, it cannot
be -1 since that is an invalid return value for object size. However since
passes running after the substitution don't know this, they are unable to
optimize away the comparison and hence the comparison and branch stays in there.
This change generates an appropriate call to llvm.assume to help the optimizer
folding the test.

glibc is considering adopting __builtin_dynamic_object_size for additional
protection[1] and this change will help reduce branching overhead in fortified
implementations of all of the functions that don't have the __builtin___*_chk
type builtins, e.g. __ppoll_chk.

Also remove the test limit-max-iterations.ll because it was deemed unnecessary
during review.

[1] https://sourceware.org/pipermail/libc-alpha/2020-November/120191.html

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

3 years ago[VPlan] Make VPInstruction a VPDef
Florian Hahn [Tue, 22 Dec 2020 09:20:47 +0000 (09:20 +0000)]
[VPlan] Make VPInstruction a VPDef

This patch turns updates VPInstruction to manage the value it defines
using VPDef. The VPValue is used  during VPlan construction and
codegeneration instead of the plain IR reference where possible.

Reviewed By: gilr

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

3 years ago[MachineLICM] Add llvm debug messages to SinkIntoLoop. NFC.
Sjoerd Meijer [Tue, 22 Dec 2020 09:13:51 +0000 (09:13 +0000)]
[MachineLICM] Add llvm debug messages to SinkIntoLoop. NFC.

I am investigating sinking instructions back into the loop under high
register pressure. This is just a first NFC step to add some debug
messages that allows tracing of the decision making.

3 years ago[DebugInfo] Don't use DW_OP_implicit_value for fragments
Pavel Labath [Tue, 24 Nov 2020 09:24:29 +0000 (10:24 +0100)]
[DebugInfo] Don't use DW_OP_implicit_value for fragments

Currently using DW_OP_implicit_value in fragments produces invalid DWARF
expressions. (Such a case can occur in complex floats, for example.)

This problem manifests itself as a missing DW_OP_piece operation after
the last fragment. This happens because the function for printing
constant float value skips printing the accompanying DWARF expression,
as that would also print DW_OP_stack_value (which is not desirable in
this case). However, this also results in DW_OP_piece being skipped.

The reason that DW_OP_piece is missing only for the last piece is that
the act of printing the next fragment corrects this. However, it does
that for the wrong reason -- the code emitting this DW_OP_piece thinks
that the previous fragment was missing, and so it thinks that it needs
to skip over it in order to be able to print itself.

In a simple scenario this works out, but it's likely that in a more
complex setup (where some pieces are in fact missing), this logic would
go badly wrong. In a simple setup gdb also seems to not mind the fact
that the DW_OP_piece is missing, but it would also likely not handle
more complex use cases.

For this reason, this patch disables the usage of DW_OP_implicit_value
in the frament scenario (we will use DW_OP_const*** instead), until we
figure out the right way to deal with this. This guarantees that we
produce valid expressions, and gdb can handle both kinds of inputs
anyway.

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

3 years ago[lldb/test] Add GdbRemoteTestCaseFactory to avoid duplication in lldb-server tests
Pavel Labath [Fri, 18 Dec 2020 20:26:25 +0000 (21:26 +0100)]
[lldb/test] Add GdbRemoteTestCaseFactory to avoid duplication in lldb-server tests

This uses the same approach as the debug info tests to avoid needing to
explicitly spell out the two kinds of tests. I convert a handful of
tests to the new mechanism. The rest will be converted in follow-up
patches.

3 years ago[llvm][ARM/AArch64] Convert Target Parser CPU tests to fixtures
David Spickett [Tue, 15 Dec 2020 15:49:26 +0000 (15:49 +0000)]
[llvm][ARM/AArch64] Convert Target Parser CPU tests to fixtures

Also convert the test function to use EXPECT_EQ and
remove the special case for the AEK_NONE extension.

This means that each test is marked as failing separatley
and the accumultated EXPECT failures are printed next
to that test, with its parameters.

Before they would be hidden by the "pass &=" pattern
and failures would print in one block since it was a
"single" test.

Example of the new failure messages:
```
ARMCPUTestsPart1/ARMCPUTestFixture.ARMCPUTests/6
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from ARMCPUTestsPart1/ARMCPUTestFixture
[ RUN      ] ARMCPUTestsPart1/ARMCPUTestFixture.ARMCPUTests/6
/work/open_source/nightly-llvm/llvm-project/llvm/unittests/Support/TargetParserTest.cpp:66:
Failure
      Expected: params.ExpectedFlags
      Which is: 3405705229
To be equal to: default_extensions
      Which is: 1
[  FAILED  ] ARMCPUTestsPart1/ARMCPUTestFixture.ARMCPUTests/6, where
GetParam() = "arm8", "armv4", "none", 0xcafef00d, "4" (0 ms)
```

Reviewed By: MarkMurrayARM

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

3 years ago[Flang][openmp][5/5] Make dist_schedule clause part of OmpClause
sameeran joshi [Mon, 21 Dec 2020 17:14:22 +0000 (22:44 +0530)]
[Flang][openmp][5/5] Make dist_schedule clause part of OmpClause

After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `OmpDistScheduleClause` clause part of `OmpClause`.
The unparse function for `OmpDistScheduleClause` is adapted since the keyword
and parenthesis are issued by the corresponding unparse function for
`parser::OmpClause::DistSchedule`.

Reviewed By: clementval, kiranktp

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

3 years ago[mlir] remove deprecated string-based OpBuilder from ODS
Alex Zinenko [Mon, 21 Dec 2020 11:16:30 +0000 (12:16 +0100)]
[mlir] remove deprecated string-based OpBuilder from ODS

It has been deprecated with a warning for two months, removing.

Reviewed By: mehdi_amini

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

3 years ago[Flang][openmp][4/5] Make nowait clause part of OmpClause
sameeran joshi [Mon, 21 Dec 2020 14:04:12 +0000 (19:34 +0530)]
[Flang][openmp][4/5] Make nowait clause part of OmpClause

After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `OmpNoWait` clause part of `OmpClause`.

Reviewed By: clementval, kiranktp

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

3 years ago[LV] Avoid needless fold tail
Gil Rapaport [Tue, 15 Dec 2020 20:47:12 +0000 (22:47 +0200)]
[LV] Avoid needless fold tail

When the trip-count is provably divisible by the maximal/chosen VF, folding the
loop's tail during vectorization is redundant. This commit extends the existing
test for constant trip-counts to any trip-count known to be divisible by
maximal/selected VF by SCEV.

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

3 years ago[Flang][openmp][3/5] Make ProcBind clause part of OmpClause
sameeran joshi [Mon, 21 Dec 2020 13:13:44 +0000 (18:43 +0530)]
[Flang][openmp][3/5] Make ProcBind clause part of OmpClause

After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `OmpProcBindClause` clause part of `OmpClause`.
The unparse function is dropped as the unparsing is done by `WALK_NESTED_ENUM`
for `OmpProcBindClause`.

Reviewed By: clementval, kiranktp

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

3 years ago[clangd] Trim memory periodically when using glibc malloc
Quentin Chateau [Tue, 22 Dec 2020 07:44:20 +0000 (08:44 +0100)]
[clangd] Trim memory periodically when using glibc malloc

This diff addresses the issue of the ever increasing memory usage of clangd. The key to understand what happens is to use `malloc_stats()`: malloc arenas keep getting bigger, although the actual memory used does not. It seems some operations while bulding the indices (both dynamic and background) create this problem. Specifically, 'FileSymbols::update' and 'FileSymbols::buildIndex' seem especially affected.

This diff adds a call to `malloc_trim()` periodically in
ClangdLSPServer.

Fixes: https://github.com/clangd/clangd/issues/251
Fixes: https://github.com/clangd/clangd/issues/115

Reviewed By: sammccall

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

3 years ago[Flang][openmp][2/5] Make Default clause part of OmpClause
sameeran joshi [Mon, 21 Dec 2020 08:40:27 +0000 (14:10 +0530)]
[Flang][openmp][2/5] Make Default clause part of OmpClause

After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `OmpDefaultClause` clause part of `OmpClause`.
The unparse function is dropped as the unparsing is done by `WALK_NESTED_ENUM`
for `OmpDefaultClause`.

Reviewed By: clementval, kiranktp

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

3 years ago[Flang][openmp][1/5] Make Allocate clause part of OmpClause
sameeran joshi [Fri, 18 Dec 2020 18:33:45 +0000 (00:03 +0530)]
[Flang][openmp][1/5] Make Allocate clause part of OmpClause

After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.

The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
  `llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
  TableGen, if incase we generate parser using TableGen we could have only a
  single `let expression`.

This patch makes `allocate` clause part of `OmpClause`.The unparse function for
`OmpAllocateClause` is adapted since the keyword and parenthesis are issued by
the corresponding unparse function for `parser::OmpClause::Allocate`.

Reviewed By: clementval

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

3 years ago[RISCV] Define vector compare intrinsics.
Hsiangkai Wang [Tue, 15 Dec 2020 23:06:07 +0000 (07:06 +0800)]
[RISCV] Define vector compare intrinsics.

Define vector compare intrinsics and lower them to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93368

3 years ago[RISCV] Define vleff intrinsics.
Zakk Chen [Fri, 18 Dec 2020 08:14:53 +0000 (00:14 -0800)]
[RISCV] Define vleff intrinsics.

Define vleff intrinsics and lower to V instructions.

We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Reviewed By: craig.topper

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

3 years ago[LegalizeType] When LegalizeType procedure widens a masked_gather, set MemoryType...
Bing1 Yu [Tue, 22 Dec 2020 05:09:22 +0000 (13:09 +0800)]
[LegalizeType] When LegalizeType procedure widens a masked_gather, set MemoryType's EltNum equal to Result's EltNum

When LegalizeType procedure widens a masked_gather, set MemoryType's EltNum equal to Result's EltNum.

As I mentioned in https://reviews.llvm.org/D91092, in previous code, If we have a v17i32's masked_gather in avx512, we widen it to a v32i32's masked_gather with a v17i32's MemoryType. When the SplitVecRes_MGATHER process this v32i32's masked_gather, GetSplitDestVTs will assert fail since what you are going to split is v17i32.

Reviewed By: craig.topper

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

3 years ago[CSKY 3/n] Add bare-bones C-SKY MCTargetDesc
Zi Xuan Wu [Tue, 22 Dec 2020 02:56:43 +0000 (10:56 +0800)]
[CSKY 3/n] Add bare-bones C-SKY MCTargetDesc

Add basis of CSKY MCTargetDesc and it's enough to compile and link but doesn't yet do anything particularly useful.
Once an ASM parser and printer are added in the next two patches, the whole thing can be usefully tested.

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

3 years agoscan-view: Remove Reporter.py and associated AppleScript files
Tom Stellard [Mon, 21 Dec 2020 23:24:45 +0000 (15:24 -0800)]
scan-view: Remove Reporter.py and associated AppleScript files

I'm not exactly sure what this is, but it appears to be a tool for reporting
internal issues at Apple.  These files haven't been meaningfully updated in
12 years, and it doesn't seem like there is any reason to keep them in tree.

Reviewed By: NoQ

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

3 years ago[lld/mac] Implement support for private extern symbols
Nico Weber [Thu, 17 Dec 2020 18:30:18 +0000 (13:30 -0500)]
[lld/mac] Implement support for private extern symbols

Private extern symbols are used for things scoped to the linkage unit.
They cause duplicate symbol errors (so they're in the symbol table,
unlike TU-scoped truly local symbols), but they don't make it into the
export trie. They are created e.g. by compiling with
-fvisibility=hidden.

If two weak symbols have differing privateness, the combined symbol is
non-private external. (Example: inline functions and some TUs that
include the header defining it were built with
-fvisibility-inlines-hidden and some weren't).

A weak private external symbol implicitly has its "weak" dropped and
behaves like a regular strong private external symbol: Weak is an export
trie concept, and private symbols are not in the export trie.

If a weak and a strong symbol have different privateness, the strong
symbol wins.

If two common symbols have differing privateness, the larger symbol
wins. If they have the same size, the privateness of the symbol seen
later during the link wins (!) -- this is a bit lame, but it matches
ld64 and this behavior takes 2 lines less to implement than the less
surprising "result is non-private external), so match ld64.
(Example: `int a` in two .c files, both built with -fcommon,
one built with -fvisibility=hidden and one without.)

This also makes `__dyld_private` a true TU-local symbol, matching ld64.
To make this work, make the `const char*` StringRefZ ctor to correctly
set `size` (without this, writing the string table crashed when calling
getName() on the __dyld_private symbol).

Mention in CommonSymbol's comment that common symbols are now disabled
by default in clang.

Mention in -keep_private_externs's HelpText that the flag only has an
effect with `-r` (which we don't implement yet -- so this patch here
doesn't regress any behavior around -r + -keep_private_externs)). ld64
doesn't explicitly document it, but the commit text of
http://reviews.llvm.org/rL216146 does, and ld64's
OutputFile::buildSymbolTable() checks `_options.outputKind() ==
Options::kObjectFile` before calling `_options.keepPrivateExterns()`
(the only reference to that function).

Fixes PR48536.

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

3 years ago[RISCV] Add intrinsics for vmacc/vnmsac/vmadd/vnmsub instructions
ShihPo Hung [Mon, 21 Dec 2020 06:41:47 +0000 (22:41 -0800)]
[RISCV] Add intrinsics for vmacc/vnmsac/vmadd/vnmsub instructions

This defines vmadd, vmacc, vnmsub, and vnmsac intrinsics and
lower to V instructions.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93632

3 years agoRevert "[mlir] Add SmallVector sizes"
Tres Popp [Tue, 22 Dec 2020 01:19:31 +0000 (02:19 +0100)]
Revert "[mlir] Add SmallVector sizes"

This reverts commit 83274a0773f6a20abdc848b448009e0195c42166.

Fixed in a555ca8b3d67

3 years ago[MC][test] Reorganize .cfi_* tests
Fangrui Song [Tue, 22 Dec 2020 01:18:28 +0000 (17:18 -0800)]
[MC][test] Reorganize .cfi_* tests

Delete tests which are covered by others.

3 years ago[LoopNest] Extend `LPMUpdater` and adaptor to handle loop-nest passes
Ta-Wei Tu [Tue, 22 Dec 2020 00:42:52 +0000 (08:42 +0800)]
[LoopNest] Extend `LPMUpdater` and adaptor to handle loop-nest passes

This is a follow-up patch of D87045.

The patch implements "loop-nest mode" for `LPMUpdater` and `FunctionToLoopPassAdaptor` in which only top-level loops are operated.

`createFunctionToLoopPassAdaptor` decides whether the returned adaptor is in loop-nest mode or not based on the given pass. If the pass is a loop-nest pass or the pass is a `LoopPassManager` which contains only loop-nest passes, the loop-nest version of adaptor is returned; otherwise, the normal (loop) version of adaptor is returned.

Reviewed By: Whitney

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

3 years ago[RISCV] Use more precise type constraints for the vmv.v.v and vmv.v.x intrinsics.
Craig Topper [Mon, 21 Dec 2020 23:16:57 +0000 (15:16 -0800)]
[RISCV] Use more precise type constraints for the vmv.v.v and vmv.v.x intrinsics.

We can infer the input type from the result type. For vmv.v.v its
the same. For vmv.v.x its the element type.

3 years ago[RISCV] Update vmv.v.v-rv32.ll and vmv.v.v-rv64.ll to test the correct intrinsics.
Craig Topper [Mon, 21 Dec 2020 22:59:45 +0000 (14:59 -0800)]
[RISCV] Update vmv.v.v-rv32.ll and vmv.v.v-rv64.ll to test the correct intrinsics.

These were accidentally identical to the vmv.v.x tests. I must
have fumbled when I copied them from our downstream repo.

3 years ago[mlir] Add SmallVector sizes
Tres Popp [Mon, 21 Dec 2020 21:57:34 +0000 (22:57 +0100)]
[mlir] Add SmallVector sizes

This is a temporary fix until figuring out how to correct the forward
declare in mlir/include/mlir/Support/LLVM.h

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

3 years ago[InstCombine] Add check of i1 types in select-to-zext/sext transformation
Congzhe Cao [Mon, 21 Dec 2020 18:33:58 +0000 (13:33 -0500)]
[InstCombine] Add check of i1 types in select-to-zext/sext transformation

When doing select-to-zext/sext transformations, we should
not handle TrueVal and FalseVal of i1 type otherwise it
would result in zext/sext i1 to i1.

Reviewed By: spatel

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

3 years ago[Driver] Default Generic_GCC ppc/ppc64/ppc64le to -fasynchronous-unwind-tables
Fangrui Song [Mon, 21 Dec 2020 23:32:35 +0000 (15:32 -0800)]
[Driver] Default Generic_GCC ppc/ppc64/ppc64le to -fasynchronous-unwind-tables

GCC made the switch on 2018-04-10 ("rs6000: Enable -fasynchronous-unwind-tables by default").
In Clang, FreeBSD/NetBSD powerpc have already defaulted to -fasynchronous-unwind-tables.

This patch defaults Generic_GCC powerpc (which affects Linux) to use -fasynchronous-unwind-tables.

Reviewed By: #powerpc, nemanjai

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

3 years agoHowToReleaseLLVM: Update document to match the current release process
Tom Stellard [Mon, 21 Dec 2020 23:16:09 +0000 (15:16 -0800)]
HowToReleaseLLVM: Update document to match the current release process

Change Summary:

* Clarify that release manager can commit without code owner approval
  (but are still highly encouraged to get approval).

* Clarify that there is no official release criteria.

* Document what types of changes are allowed in each release phase.

This is update is based on the RFC submitted here:
http://lists.llvm.org/pipermail/llvm-dev/2020-May/141730.html

Reviewed By: hans

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

3 years agollvm-profgen: Parse command line arguments after initializing targets
Tom Stellard [Mon, 21 Dec 2020 21:29:56 +0000 (13:29 -0800)]
llvm-profgen: Parse command line arguments after initializing targets

I am experimenting with turning backends into loadable modules and in
that scenario, target specific command line arguments won't be available
until after the targets are initialized.

Also, most other tools initialize targets before parsing arguments.

Reviewed By: wlei

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

3 years ago[MLIR][SPIRVToLLVM] Updated documentation on spirv-cpu-runner
George Mitenkov [Mon, 21 Dec 2020 22:44:31 +0000 (01:44 +0300)]
[MLIR][SPIRVToLLVM] Updated documentation on spirv-cpu-runner

This patch adds documentation for the `mlir-spirv-cpu-runner`.
It provides an overview of applied transformations and passes, as
well as an example walk-through.

Some typos in the documentation have been fixed as well.

Reviewed By: mravishankar

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

3 years ago[NFC] Remove unused function
Arthur Eubanks [Mon, 21 Dec 2020 22:39:19 +0000 (14:39 -0800)]
[NFC] Remove unused function

3 years ago[RISCV] Define the vand, vor and vxor RVV intrinsics
Evandro Menezes [Sat, 19 Dec 2020 02:34:55 +0000 (20:34 -0600)]
[RISCV] Define the vand, vor and vxor RVV intrinsics

Define the `vand`, `vor` and `vxor` IR intrinsics for the respective V instructions.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Evandro Menezes <evandro.menezes@sifive.com>
Differential Revision: https://reviews.llvm.org/D93574

3 years ago[mlir][sparse] adjust output tensor to synthetic tensor
Aart Bik [Mon, 21 Dec 2020 21:42:38 +0000 (13:42 -0800)]
[mlir][sparse] adjust output tensor to synthetic tensor

Fixes a merge conflict with previous two CLs.

Reviewed By: mravishankar

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

3 years ago[MC] Split MCContext::createTempSymbol, default AlwaysAddSuffix to true, and add...
Fangrui Song [Mon, 21 Dec 2020 22:04:13 +0000 (14:04 -0800)]
[MC] Split MCContext::createTempSymbol, default AlwaysAddSuffix to true, and add comments

CanBeUnnamed is rarely false. Splitting to a createNamedTempSymbol makes the
intention clearer and matches the direction of reverted r240130 (to drop the
unneeded parameters).

No behavior change.

3 years agoMigrate MCContext::createTempSymbol call sites to AlwaysAddSuffix=true
Fangrui Song [Mon, 21 Dec 2020 21:46:45 +0000 (13:46 -0800)]
Migrate MCContext::createTempSymbol call sites to AlwaysAddSuffix=true

Most call sites set AlwaysAddSuffix to true. The two use cases do not really
need false and can be more consistent with other temporary symbol usage.

3 years ago[NewPM] Add TargetMachine method to add alias analyses
Arthur Eubanks [Tue, 15 Dec 2020 02:06:10 +0000 (18:06 -0800)]
[NewPM] Add TargetMachine method to add alias analyses

AMDGPUTargetMachine::adjustPassManager() adds some alias analyses to the
legacy PM. We need a way to do the same for the new PM in order to port
AMDGPUTargetMachine::adjustPassManager() to the new PM.

Currently the new PM adds alias analyses by creating an AAManager via
PassBuilder and overriding the AAManager a PassManager uses via
FunctionAnalysisManager::registerPass().

We will continue to respect a custom AA pipeline that specifies an exact
AA pipeline to use, but for "default" we will now add alias analyses
that backends specify. Most uses of PassManager use the "default"
AAManager created by PassBuilder::buildDefaultAAPipeline(). Backends can
override the newly added TargetMachine::registerAliasAnalyses() to add custom
alias analyses.

Reviewed By: ychen

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

3 years agoRevert "[AMDGPU][HIP] Switch default DWARF version to 5"
Scott Linder [Mon, 21 Dec 2020 17:38:56 +0000 (17:38 +0000)]
Revert "[AMDGPU][HIP] Switch default DWARF version to 5"

This reverts commit c4d10e7e9bb47b77fad43d8ddcfa328298f36c88.

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

3 years ago[mlir][vector] Extend vector unroll to all element-wise ops
Thomas Raoux [Mon, 21 Dec 2020 21:17:17 +0000 (13:17 -0800)]
[mlir][vector] Extend vector unroll to all element-wise ops

Extend unroll to support all element-wise ops and allow unrolling for ops with
vector operands of with the same shape as the destination but different element
type (like Cmp or Select).

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

3 years ago[MLIR][Docs] Fix a small typo in documentation.
ergawy [Mon, 21 Dec 2020 08:40:40 +0000 (09:40 +0100)]
[MLIR][Docs] Fix a small typo in documentation.

Just fixes a tiny typo in a link between 2 pages.

Reviewed By: ftynse

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

3 years ago[lldb] [Process/FreeBSDRemote] Remove anonymous namespace
Michał Górny [Mon, 21 Dec 2020 21:26:33 +0000 (22:26 +0100)]
[lldb] [Process/FreeBSDRemote] Remove anonymous namespace

3 years ago[mlir][Linalg] Revisit the Linalg on tensors abstraction
nicolasvasilache [Mon, 21 Dec 2020 18:03:12 +0000 (10:03 -0800)]
[mlir][Linalg] Revisit the Linalg on tensors abstraction

This revision drops init_tensor arguments from Linalg on tensors and instead uniformizes the output buffers and output tensors to be consistent.
This significantly simplifies the usage of Linalg on tensors and is a stepping stone for
its evolution towards a mixed tensor and shape abstraction discussed in https://llvm.discourse.group/t/linalg-and-shapes/2421/19.

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

3 years ago[openacc] Use TableGen enum for default clause value
Valentin Clement [Mon, 21 Dec 2020 20:06:55 +0000 (15:06 -0500)]
[openacc] Use TableGen enum for default clause value

Use the TableGen feature to have enum values for clauses.
Next step will be to extend the MLIR part used currently by OpenMP
to use the same enum on the dialect side.

This patch also add function that convert the enum to StringRef to be
used on the dump-parse-tree from flang.

Reviewed By: jdoerfert

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

3 years ago[lld-macho][nfc] Remove %T from headerpad.s
Jez Ng [Mon, 21 Dec 2020 19:44:01 +0000 (14:44 -0500)]
[lld-macho][nfc] Remove %T from headerpad.s

The llvm-lit docs indicate that it is deprecated.

Reviewed By: #lld-macho, thakis

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

3 years ago[lld-macho][nfc] Clean up tests
Jez Ng [Mon, 21 Dec 2020 19:43:58 +0000 (14:43 -0500)]
[lld-macho][nfc] Clean up tests

* Migrate most of our tests to use `split-file` instead of `echo`
* Remove individual `rm -f %t/libfoo.a` commands in favor of a top-level `rm -rf %t`
* Remove unused `Inputs/libfunction.s`

Reviewed By: #lld-macho, compnerd

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

3 years ago[lldb] Remove anonymous namespace from NativeRegisterContextLinux_x86_64
Pavel Labath [Mon, 21 Dec 2020 19:39:05 +0000 (20:39 +0100)]
[lldb] Remove anonymous namespace from NativeRegisterContextLinux_x86_64

Use "static" instead.

3 years ago[clangd][NFC] Improve clangd status messages
Quentin Chateau [Mon, 21 Dec 2020 19:16:47 +0000 (20:16 +0100)]
[clangd][NFC] Improve clangd status messages

clangd actions have various naming schemes, the most
common being PascalCase. This commit applies PascalCase
to all clangd actions, and fix the status rendering
in `renderTUAction` to look more consistent.

Reviewed By: sammccall

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

3 years ago[AA] byval argument is identified function local
Nikita Popov [Sun, 20 Dec 2020 20:30:33 +0000 (21:30 +0100)]
[AA] byval argument is identified function local

byval arguments should mostly get the same treatment as noalias
arguments in alias analysis. This was not the case for the
isIdentifiedFunctionLocal() function.

Marking byval arguments as identified function local means that
they cannot alias with other arguments, which I believe is correct.

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

3 years agoUpdate references to 'master' branch.
Hafiz Abid Qadeer [Mon, 21 Dec 2020 19:06:17 +0000 (19:06 +0000)]
Update references to 'master' branch.

This commit replace 'master' with 'main' in llvm/docs.

Reviewed By: sammccall, kristof.beyls

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

3 years agoscudo: Remove ANDROID_EXPERIMENTAL_MTE macro.
Peter Collingbourne [Fri, 18 Dec 2020 05:02:01 +0000 (21:02 -0800)]
scudo: Remove ANDROID_EXPERIMENTAL_MTE macro.

Kernel support for MTE has been released in Linux 5.10. This means
that it is a stable API and we no longer need to make the support
conditional on a macro. We do need to provide conditional definitions
of the new macros though in order to avoid a dependency on new
kernel headers.

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

3 years ago[cuda][hip] Fix typoes in header wrappers.
Michael Liao [Mon, 21 Dec 2020 18:02:47 +0000 (13:02 -0500)]
[cuda][hip] Fix typoes in header wrappers.

3 years ago[AMDGPU][MC][NFC] Fix for sanitizer error in 8ab5770
Dmitry Preobrazhensky [Mon, 21 Dec 2020 17:42:35 +0000 (20:42 +0300)]
[AMDGPU][MC][NFC] Fix for sanitizer error in 8ab5770

Corrected to fix sanitizer error introduced by 8ab5770

3 years ago[AMDGPU][MC][NFC] Parser refactoring
Dmitry Preobrazhensky [Mon, 21 Dec 2020 17:21:07 +0000 (20:21 +0300)]
[AMDGPU][MC][NFC] Parser refactoring

See bug 48515 (https://bugs.llvm.org/show_bug.cgi?id=48515)

Reviewers: rampitec

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

3 years ago[AMDGPU][MC][NFC] Lit tests cleanup
Dmitry Preobrazhensky [Mon, 21 Dec 2020 16:52:27 +0000 (19:52 +0300)]
[AMDGPU][MC][NFC] Lit tests cleanup

See bug 48513

Reviewers: rampitec

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

3 years ago[mlir[[vector] Extend Transfer read/write ops to support tensor types.
Thomas Raoux [Fri, 18 Dec 2020 00:26:07 +0000 (16:26 -0800)]
[mlir[[vector] Extend Transfer read/write ops to support tensor types.

Transfer_ops can now work on both buffers and tensor. Right now, lowering of
the tensor case is not supported yet.

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

3 years ago[clang] Fix expected errors in plugin attribute example
David Spickett [Mon, 21 Dec 2020 16:45:57 +0000 (16:45 +0000)]
[clang] Fix expected errors in plugin attribute example

b2ba6867eac10874bd279c739639bdb9e60c1996 was landed
with updated error messages in the example file
but not in the test file.

3 years ago[ELF] Reject local-exec TLS relocations for -shared
Fangrui Song [Mon, 21 Dec 2020 16:47:04 +0000 (08:47 -0800)]
[ELF] Reject local-exec TLS relocations for -shared

For x86-64, D33100 added a diagnostic for local-exec TLS relocations referencing a preemptible symbol.

This patch generalizes it to non-preemptible symbols (see `-Bsymbolic` in `tls.s`)
on all targets.

Local-exec TLS relocations resolve to offsets relative to a fixed point within
the static TLS block, which are only meaningful for the executable.

With this change, `clang -fpic -shared -fuse-ld=bfd a.c` on the following example will be flagged for AArch64/ARM/i386/x86-64/RISC-V

```
static __attribute__((tls_model("local-exec"))) __thread long TlsVar = 42;
long bump() { return ++TlsVar; }
```

Note, in GNU ld, at least arm, riscv and x86's ports have the similar
diagnostics, but aarch64 and ppc64 do not error.

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

3 years ago[ELF][PPC64] Detect missing R_PPC64_TLSGD/R_PPC64_TLSLD and disable TLS relaxation
Fangrui Song [Mon, 21 Dec 2020 16:45:41 +0000 (08:45 -0800)]
[ELF][PPC64] Detect missing R_PPC64_TLSGD/R_PPC64_TLSLD and disable TLS relaxation

Alternative to D91611.

The TLS General Dynamic/Local Dynamic code sequences need to mark
`__tls_get_addr` with R_PPC64_TLSGD or R_PPC64_TLSLD, e.g.

```
addis r3, r2, x@got@tlsgd@ha # R_PPC64_GOT_TLSGD16_HA
addi r3, r3, x@got@tlsgd@l   # R_PPC64_GOT_TLSGD16_LO
bl __tls_get_addr(x@tlsgd)   # R_PPC64_TLSGD followed by R_PPC64_REL24
nop
```

However, there are two deviations form the above:

1. direct call to `__tls_get_addr`. This is essential to implement ld.so in glibc/musl/FreeBSD.

```
bl __tls_get_addr
nop
```

This is only used in a -shared link, and thus not subject to the GD/LD to IE/LE
relaxation issue below.

2. Missing R_PPC64_TLSGD/R_PPC64_TLSGD for compiler generated TLS references

According to Stefan Pintille, "In the early days of the transition from the
ELFv1 ABI that is used for big endian PowerPC Linux distributions to the ELFv2
ABI that is used for little endian PowerPC Linux distributions, there was some
ambiguity in the specification of the relocations for TLS. The GNU linker has
implemented support for correct handling of calls to __tls_get_addr with a
missing relocation.  Unfortunately, we didn't notice that the IBM XL compiler
did not handle TLS according to the updated ABI until we tried linking XL
compiled libraries with LLD."

In short, LLD needs to work around the old IBM XL compiler issue.
Otherwise, if the object file is linked in -no-pie or -pie mode,
the result will be incorrect because the 4 instructions are partially
rewritten (the latter 2 are not changed).

Work around the compiler bug by disable General Dynamic/Local Dynamic to
Initial Exec/Local Exec relaxation. Note, we also disable Initial Exec
to Local Exec relaxation for implementation simplicity, though technically it can be kept.

ppc64-tls-missing-gdld.s demonstrates the updated behavior.

Reviewed By: #powerpc, stefanp, grimar

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

3 years agoRevert "[TableGen] Add the !substr() bang operator"
Paul C. Anagnostopoulos [Mon, 21 Dec 2020 15:45:30 +0000 (10:45 -0500)]
Revert "[TableGen] Add the !substr() bang operator"

This reverts commit 3a675c777dd5788e2313cb06fb27b01f8a2e7573.

3 years agoRemove unused variables.
Michael Forster [Mon, 21 Dec 2020 15:21:31 +0000 (16:21 +0100)]
Remove unused variables.

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

3 years ago[AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic funnel...
Simon Pilgrim [Mon, 21 Dec 2020 15:22:27 +0000 (15:22 +0000)]
[AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic funnel shifts (REAPPLIED)

The fold currently only handles rotation patterns, but with the maturation of backend funnel shift handling we can now realistically handle all funnel shift patterns.

This should allow us to begin resolving PR46896 et al.

Ensure we block poison in a funnel shift value - similar to rG0fe91ad463fea9d08cbcd640a62aa9ca2d8d05e0

Reapplied with fix for PR48068 - we weren't checking that the shift values could be hoisted from their basicblocks.

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

3 years ago[TableGen] Add the !substr() bang operator
Paul C. Anagnostopoulos [Wed, 16 Dec 2020 14:55:16 +0000 (09:55 -0500)]
[TableGen] Add the !substr() bang operator

Update the documentation and add a test.

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

3 years ago[InstSimplify] reduce logic with inverted add/sub ops
Sanjay Patel [Mon, 21 Dec 2020 13:48:04 +0000 (08:48 -0500)]
[InstSimplify] reduce logic with inverted add/sub ops

https://llvm.org/PR48559
This could be part of a larger ValueTracking API,
but I don't see that currently.

https://rise4fun.com/Alive/gR0

  Name: and
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = and i8 %sub, %sub1
  =>
  %r = 0

  Name: or
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = or i8 %sub, %sub1
  =>
  %r = -1

  Name: xor
  Pre: C1 == ~C2
  %sub = add i8 %x, C1
  %sub1 = sub i8 C2, %x
  %r = xor i8 %sub, %sub1
  =>
  %r = -1

3 years ago[InstSimplify] add tests for inverted logic operands; NFC
Sanjay Patel [Mon, 21 Dec 2020 13:26:55 +0000 (08:26 -0500)]
[InstSimplify] add tests for inverted logic operands; NFC

3 years ago[VE] Correct VMP allocation in calling conv
Kazushi (Jam) Marukawa [Fri, 18 Dec 2020 16:12:25 +0000 (01:12 +0900)]
[VE] Correct VMP allocation in calling conv

VE used to allocate VM1, VM2, VMP2 (VM4+VM5), and VM3.  This patch
corrects to allocate VM1, VM2, VMP2 (VM4+VM5), and VM6.  Also add
a regression test.

Reviewed By: simoll

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

3 years ago[VPlan] Make VPRecipeBase inherit from VPDef.
Florian Hahn [Mon, 21 Dec 2020 11:12:40 +0000 (11:12 +0000)]
[VPlan] Make VPRecipeBase inherit from VPDef.

This patch makes VPRecipeBase a direct subclass of VPDef, moving the
SubclassID to VPDef.

Reviewed By: gilr

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

3 years ago[Statepoints] Disable VReg lowering for values used on exception path of invoke.
Denis Antrushin [Thu, 17 Dec 2020 09:36:57 +0000 (16:36 +0700)]
[Statepoints] Disable VReg lowering for values used on exception path of invoke.

Currently we lower invokes the same way as usual calls, e.g.:

V1 = STATEPOINT ... V (tied-def 0)

But this is incorrect is V1 is used on exceptional path.
By LLVM rules V1 neither dominates its uses in landing pad, nor
its live range is live on entry to landing pad. So compiler is
allowed to do various weird transformations like splitting live
range after statepoint and use split LR in catch block.

Until (and if) we find better solution to this problem, let's
use old lowering (spilling) for those values which are used on
exceptional path and allow VReg lowering for values used only
on normal path.

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

3 years agoRefactoring the attribute plugin example to fit the new API
Yafei Liu [Mon, 21 Dec 2020 13:22:56 +0000 (08:22 -0500)]
Refactoring the attribute plugin example to fit the new API

Make the example compile and the test case pass.

3 years ago[VE] Optimize LEA combinations
Kazushi (Jam) Marukawa [Fri, 27 Nov 2020 13:51:11 +0000 (22:51 +0900)]
[VE] Optimize LEA combinations

Change to optimize references of elements of aggregate data.  Also
add regression tests.

Reviewed By: simoll

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

3 years ago[TableGen] NFC: Rename variables in OptParserEmitter
Jan Svoboda [Fri, 18 Dec 2020 10:18:12 +0000 (11:18 +0100)]
[TableGen] NFC: Rename variables in OptParserEmitter

Switch to the LLVM naming convention.

Reviewed By: dexonsmith

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

3 years ago[TableGen] NFC: Switch to range-based for loops in OptParserEmitter
Jan Svoboda [Fri, 18 Dec 2020 09:52:53 +0000 (10:52 +0100)]
[TableGen] NFC: Switch to range-based for loops in OptParserEmitter

This simplifies the code a bit. No functionality change.

Reviewed By: dexonsmith

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

3 years ago[flang][driver] Make the names of files created in unit tests unique (nfc)
Andrzej Warzynski [Mon, 21 Dec 2020 11:09:06 +0000 (11:09 +0000)]
[flang][driver] Make the names of files created in unit tests unique (nfc)

Using files with identical names leads to unexpected failures when tests
are run in parallel. This is tricky to reproduce, but has been happening
on some buildbots since merging https://reviews.llvm.org/D92854. In that
patch I added a unit test with a non-unique test file. This patch fixes
that.

3 years ago[VE] Support STACKSAVE and STACKRESTORE
Kazushi (Jam) Marukawa [Fri, 18 Dec 2020 14:21:10 +0000 (23:21 +0900)]
[VE] Support STACKSAVE and STACKRESTORE

Change to use default expanded code.  Add regression tests also.

Reviewed By: simoll

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

3 years ago[VE] Support RETURNADDR
Kazushi (Jam) Marukawa [Tue, 15 Dec 2020 14:22:39 +0000 (23:22 +0900)]
[VE] Support RETURNADDR

Implement RETURNADDR for VE.  Add a regression test also.

Reviewed By: simoll

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

3 years ago[VPlan] Use VPDef for VPInterleaveRecipe.
Florian Hahn [Mon, 21 Dec 2020 09:14:57 +0000 (09:14 +0000)]
[VPlan] Use VPDef for VPInterleaveRecipe.

This patch turns updates VPInterleaveRecipe to manage the values it defines
using VPDef. The VPValue is used  during VPlan construction and
codegeneration instead of the plain IR reference where possible.

Reviewed By: gilr

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

3 years ago[VP][NFC] ISD::VP_Sub -> ISD::VP_SUB
Simon Moll [Mon, 21 Dec 2020 09:59:22 +0000 (10:59 +0100)]
[VP][NFC] ISD::VP_Sub -> ISD::VP_SUB

3 years ago[clang] Use enum for LangOptions::SYCLVersion instead of unsigned
Jan Svoboda [Fri, 18 Dec 2020 14:24:39 +0000 (15:24 +0100)]
[clang] Use enum for LangOptions::SYCLVersion instead of unsigned

`LangOptions::SYCLVersion` can only have two values. This patch introduces an enum that allows us to reduce the member size from 32 bits to 1 bit.

Consequently, this also makes marshalling of this option fit into our model for enums: D84674.

Reviewed By: bader

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

3 years ago[clang][cli] Let denormalizer decide how to render the option based on the option...
Jan Svoboda [Fri, 18 Dec 2020 12:55:48 +0000 (13:55 +0100)]
[clang][cli] Let denormalizer decide how to render the option based on the option class

Before this patch, you needed to use `AutoNormalizeEnumJoined` whenever you wanted to **de**normalize joined enum.
Besides the naming confusion, this means the fact the option is joined is specified in two places: in the normalization multiclass and in the `Joined<["-"], ...>` multiclass.
This patch makes this work automatically, taking into account the `OptionClass` of options.

Also, the enum denormalizer now just looks up the spelling of the present enum case in a table and forwards it to the string denormalizer.

I also added more tests that exercise this.

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

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

3 years ago[clang][cli] Streamline MarshallingInfoFlag description
Jan Svoboda [Fri, 18 Dec 2020 15:14:18 +0000 (16:14 +0100)]
[clang][cli] Streamline MarshallingInfoFlag description

This replaces the existing `MarshallingInfoFlag<...>, IsNegative` with simpler `MarshallingInfoNegativeFlag`.

Reviewed By: dexonsmith

Original patch by Daniel Grumberg.

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

3 years ago[NFC][InstructionCost] Remove isValid() asserts in SLPVectorizer.cpp
David Sherwood [Mon, 21 Dec 2020 09:05:01 +0000 (09:05 +0000)]
[NFC][InstructionCost] Remove isValid() asserts in SLPVectorizer.cpp

An earlier patch introduced asserts that the InstructionCost is
valid because at that time the ReuseShuffleCost variable was an
unsigned. However, now that the variable is an InstructionCost
instance the asserts can be removed.

See this thread for context:
http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

See this patch for the introduction of the type:
https://reviews.llvm.org/D91174

3 years ago[MLIR][SPIRVToLLVM] Updated documentation on entry points and not supported ops
George Mitenkov [Mon, 21 Dec 2020 08:19:32 +0000 (11:19 +0300)]
[MLIR][SPIRVToLLVM] Updated documentation on entry points and not supported ops

This patch addresses two issues:
1. Not supported ops are updated to pick up the changes in the
SPIR-V dialect.

2. Conversion on `spv.ExecutionMode` is updated.

Reviewed By: antiagainst

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

3 years ago[AsmPrinter] Replace a reachable report_fatal_error with MCContext::reportError
Fangrui Song [Mon, 21 Dec 2020 07:45:48 +0000 (23:45 -0800)]
[AsmPrinter] Replace a reachable report_fatal_error with MCContext::reportError

3 years agoMCContext::reportError: don't call report_fatal_error
Fangrui Song [Mon, 21 Dec 2020 07:23:12 +0000 (23:23 -0800)]
MCContext::reportError: don't call report_fatal_error

Errors from MCAssembler, MCObjectStreamer and *ObjectWriter typically cause a crash:

```
% cat c.c
int bar;
extern int foo __attribute__((alias("bar")));
% clang -c -fcommon c.c
fatal error: error in backend: Common symbol 'bar' cannot be used in assignment expr
PLEASE submit a bug report to ...
Stack dump:
...
```

`LLVMTargetMachine::addPassesToEmitFile` constructs `MachineModuleInfoWrapperPass`
which creates a MCContext without SourceMgr. `MCContext::reportError` calls
`report_fatal_error` which gets captured by Clang `LLVMErrorHandler` and gets translated
to the output above.

Since `MCContext::reportError` errors indicate user errors, such a crashing style error
is inappropriate. So this patch changes `report_fatal_error` to `SourceMgr().PrintMessage`.
```
% clang -c -fcommon c.c
<unknown>:0: error: Common symbol 'bar' cannot be used in assignment expr
```

Ideally we should at least recover the original filename (the line information
is generally lost).  That requires general improvement to MC diagnostics,
because currently in many cases SMLoc information is lost.

3 years ago[FastRA] Fix handling of bundled MIs
Pushpinder Singh [Thu, 29 Oct 2020 06:34:06 +0000 (02:34 -0400)]
[FastRA] Fix handling of bundled MIs

Fast register allocator skips bundled MIs, as the main assignment
loop uses MachineBasicBlock::iterator (= MachineInstrBundleIterator)
This was causing SIInsertWaitcnts to crash which expects all
instructions to have registers assigned.

This patch makes sure to set everything inside bundle to the same
assignments done on BUNDLE header.

Reviewed By: qcolombet

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

3 years ago[RISCV] Define the remaining vector fixed-point arithmetic intrinsics.
Monk Chiang [Mon, 21 Dec 2020 05:51:57 +0000 (21:51 -0800)]
[RISCV] Define the remaining vector fixed-point arithmetic intrinsics.

  This patch base on D93366, and define vector fixed-point intrinsics.
    1. vaaddu/vaadd/vasubu/vasub
    2. vsmul
    3. vssrl/vssra
    4. vnclipu/vnclip

  We work with @rogfer01 from BSC to come out this patch.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
  Differential Revision: https://reviews.llvm.org/D93508