platform/upstream/llvm.git
3 years ago[mlir][linalg] Fix loop upper bounds in conv fusion test
Lei Zhang [Thu, 8 Apr 2021 17:40:35 +0000 (13:40 -0400)]
[mlir][linalg] Fix loop upper bounds in conv fusion test

Reviewed By: mravishankar

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

3 years ago[analyzer] Fix false positives in inner pointer checker (PR49628)
Valeriy Savchenko [Wed, 24 Mar 2021 13:15:04 +0000 (16:15 +0300)]
[analyzer] Fix false positives in inner pointer checker (PR49628)

This patch supports std::data and std::addressof functions.

rdar://73463300

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

3 years ago[analyzer] Fix crash on spaceship operator (PR47511)
Valeriy Savchenko [Tue, 23 Mar 2021 12:38:55 +0000 (15:38 +0300)]
[analyzer] Fix crash on spaceship operator (PR47511)

rdar://68954187

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

3 years agoRevert "[DebugInfo] Correctly track SDNode dependencies for list debug values"
Stephen Tozer [Thu, 8 Apr 2021 16:54:45 +0000 (17:54 +0100)]
Revert "[DebugInfo] Correctly track SDNode dependencies for list debug values"

Reverted due to failure on the sanitizer-x86_64-linux-fast bot.

This reverts commit e10493eb5012a2c313471489646bde9595ea06c0.

3 years ago[lldb] [Process] Watch for fork/vfork notifications
Michał Górny [Fri, 12 Mar 2021 08:02:36 +0000 (09:02 +0100)]
[lldb] [Process] Watch for fork/vfork notifications

Watch for fork(2)/vfork(2) (also fork/vfork-style clone(2) on Linux)
notifications and explicitly detach the forked child process, and add
initial tests for these cases.  The code covers FreeBSD, Linux
and NetBSD process plugins.  There is no new user-visible functionality
provided -- this change lays foundations over subsequent work on fork
support.

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

3 years agoabtest.py: support bisection based on a response file
Yuanfang Chen [Thu, 8 Apr 2021 16:43:08 +0000 (09:43 -0700)]
abtest.py: support bisection based on a response file

Also makes LINK_TEST customizable from commandline with `--test` option.

3 years ago[MCA] Add tests for IPC on Cortex-A55
Andrew Savonichev [Fri, 15 Jan 2021 13:08:58 +0000 (16:08 +0300)]
[MCA] Add tests for IPC on Cortex-A55

The tests compare IPC statistics that MCA provides with IPC values
measured on Cortex-A55 hardware. For hardware tests, each snippet is
run in a loop unrolled by 1000, and IPC is measured by linux-perf.

Several tests do not match the hardware: the skewed ALU is not
supported, LDR seem to be missing a forwarding path.

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

3 years ago[lld-macho][nfc] Extend abs-symbol.s to test for local absolute symbols
Jez Ng [Thu, 8 Apr 2021 16:14:48 +0000 (12:14 -0400)]
[lld-macho][nfc] Extend abs-symbol.s to test for local absolute symbols

Addresses an old TODO.

Reviewed By: #lld-macho, oontvoo

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

3 years ago[lld-macho] Support --thinlto-jobs
Jez Ng [Thu, 8 Apr 2021 16:14:47 +0000 (12:14 -0400)]
[lld-macho] Support --thinlto-jobs

The test is loosely based off LLD-ELF's `thinlto.ll`. However, I
found that test questionable because the the -save_temps behavior it
checks for is identical regardless of whether we are running in single-
or multi-threaded mode. I tried writing a test based on `--time-trace`
but couldn't get it to run deterministically... so I've opted to just
skip checking that behavior for now.

Reviewed By: #lld-macho, gkm

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

3 years ago[MLIR] Support symbols in emptiness checks for FlatAffineConstraints
Arjun P [Thu, 8 Apr 2021 15:29:58 +0000 (20:59 +0530)]
[MLIR] Support symbols in emptiness checks for FlatAffineConstraints

Reviewed By: ftynse

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

3 years ago[DebugInfo] Correctly track SDNode dependencies for list debug values
Stephen Tozer [Fri, 26 Mar 2021 14:52:56 +0000 (14:52 +0000)]
[DebugInfo] Correctly track SDNode dependencies for list debug values

During SelectionDAG, we must track the SDNodes that each SDDbgValue depends on
to compute its value. These are ultimately derived from the location operands to
the SDDbgValue, but were stored in a separate vector prior to this patch. This
resulted in cases where one of the lists was updated incorrectly, resulting in
crashes during compilation. This patch fixes the issue by directly recomputing
the dependency list from the SDDbgOperands in getDependencies().

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

3 years ago[AMDGPU] Add some implicit uses to tests. NFC.
Jay Foad [Thu, 8 Apr 2021 15:24:19 +0000 (16:24 +0100)]
[AMDGPU] Add some implicit uses to tests. NFC.

This is just to stop a future patch from optimizing away the things that
we actually want to check for.

3 years ago[AMDGPU] SIFoldOperands: remove an unneeded isReg check. NFC.
Jay Foad [Thu, 8 Apr 2021 15:32:25 +0000 (16:32 +0100)]
[AMDGPU] SIFoldOperands: remove an unneeded isReg check. NFC.

3 years agoRevert "Reduce the number of attributes attached to each function"
Dávid Bolvanský [Thu, 8 Apr 2021 15:28:57 +0000 (17:28 +0200)]
Revert "Reduce the number of attributes attached to each function"

This reverts commit 053dc95839b3b8a36db46f8c419e36e632e989cd. It causes perf regressions - see discussion in D97116.

3 years ago[lsan] Mark 2 new lsan tests unsupported on arm-linux
David Spickett [Thu, 8 Apr 2021 14:52:15 +0000 (15:52 +0100)]
[lsan] Mark 2 new lsan tests unsupported on arm-linux

These tests were added in:
1daa48f005bd477ba8711ecdf91a1f1515f01383
59e422c90bf4796fc73237e838d8954b4e2099b1

malloc_zero.c and realloc_too_big.c fail when only
leak sanitizer is enabled.
http://lab.llvm.org:8011/#/builders/59/builds/1635
(also in an armv8 32 bit build)

(I would XFAIL them but the same test is run with
address and leak sanitizer enabled and that one does
pass)

3 years ago[lldb/DWARF] Fix a crash parsing invalid dwarf (pr49678)
Pavel Labath [Sat, 27 Mar 2021 20:21:14 +0000 (21:21 +0100)]
[lldb/DWARF] Fix a crash parsing invalid dwarf (pr49678)

If the debug info is missing the terminating null die, we would crash
when trying to access the nonexisting children/siblings. This was
discovered because the test case for D98619 accidentaly produced such
input.

3 years ago[lldb] Re-skip TestVSCode_launch
Pavel Labath [Thu, 8 Apr 2021 14:31:18 +0000 (16:31 +0200)]
[lldb] Re-skip TestVSCode_launch

The test is flaky (sleeps didn't help).

3 years ago[NFC] Fix warning introduced in 20105b6b4874a85813f7a4a3d8ad2a0f023dda14
serge-sans-paille [Thu, 8 Apr 2021 14:09:40 +0000 (16:09 +0200)]
[NFC] Fix warning introduced in 20105b6b4874a85813f7a4a3d8ad2a0f023dda14

3 years ago[AMDGPU] SIFoldOperands: make use of emplace_back. NFC.
Jay Foad [Thu, 8 Apr 2021 13:33:51 +0000 (14:33 +0100)]
[AMDGPU] SIFoldOperands: make use of emplace_back. NFC.

3 years ago[AMDGPU] SIFoldOperands: remove an unneeded make_early_inc_range. NFC.
Jay Foad [Thu, 8 Apr 2021 13:32:36 +0000 (14:32 +0100)]
[AMDGPU] SIFoldOperands: remove an unneeded make_early_inc_range. NFC.

3 years ago[AMDGPU] SIFoldOperands: try harder to fold cndmask instructions
Jay Foad [Thu, 8 Apr 2021 13:09:31 +0000 (14:09 +0100)]
[AMDGPU] SIFoldOperands: try harder to fold cndmask instructions

Look through copies to find more cases where the two values being
selected are identical. The motivation for this is just to be able to
remove the weird special case where tryFoldCndMask was called from
foldInstOperand, part way through folding a move-immediate into its
users, without regressing any lit tests.

3 years ago[LV] Pass VPWidenPHIRecipe to widenPHIInstruction (NFC).
Florian Hahn [Thu, 8 Apr 2021 13:15:39 +0000 (14:15 +0100)]
[LV] Pass VPWidenPHIRecipe to widenPHIInstruction (NFC).

Instead of passing the start value and the defined value to
widenPHIInstruction, pass the VPWidenPHIRecipe directly, which can be
used to get both (and more in future patches).

3 years ago[analyzer] Fix dead store checker false positive
Valeriy Savchenko [Wed, 24 Mar 2021 13:50:19 +0000 (16:50 +0300)]
[analyzer] Fix dead store checker false positive

It is common to zero-initialize not only scalar variables,
but also structs.  This is also defensive programming and
we shouldn't complain about that.

rdar://34122265

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

3 years agoSupport: mapped_file_region: Pass MAP_NORESERVE to mmap
Joseph Tremoulet [Thu, 8 Apr 2021 13:06:52 +0000 (09:06 -0400)]
Support: mapped_file_region:  Pass MAP_NORESERVE to mmap

This allows mapping larger files, delaying OOM failures until too many
pages of them are accessed.  This is makes the behavior of the
mapped_file_region in this regard consistent between its "Unix" and
"Windows" implementations.

Guard the code witih #if defined(MAP_NORESERVE), consistent with other
uses of MAP_NORESERVE in llvm-project, because some FreeBSD versions do
not provide this flag.

Reviewed By: clayborg

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

3 years ago[AMDGPU] SIFoldOperands: make tryFoldCndMask a member function. NFC.
Jay Foad [Thu, 8 Apr 2021 13:04:49 +0000 (14:04 +0100)]
[AMDGPU] SIFoldOperands: make tryFoldCndMask a member function. NFC.

3 years ago[AMDGPU] Fix computing live registers in prolog
Sebastian Neubauer [Thu, 8 Apr 2021 12:00:33 +0000 (14:00 +0200)]
[AMDGPU] Fix computing live registers in prolog

ScratchExecCopy needs to be marked as live, we cannot use that register
while EXEC is stored in there.

Marking SGPRForFPSaveRestoreCopy and SGPRForBPSaveRestoreCopy as
available is unnecessary, they should not be live at that point anway.

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

3 years ago[InstCombine] add icmp with no-wrap add tests; NFC
Sanjay Patel [Thu, 8 Apr 2021 12:28:59 +0000 (08:28 -0400)]
[InstCombine] add icmp with no-wrap add tests; NFC

Goes with D100095

3 years ago[TableGen] Make behavior of list slice suffix consistent across all values
Paul C. Anagnostopoulos [Mon, 5 Apr 2021 13:13:25 +0000 (09:13 -0400)]
[TableGen] Make behavior of list slice suffix consistent across all values

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

3 years ago[TableGen] Add support for the 'assert' statement in multiclasses
Paul C. Anagnostopoulos [Thu, 1 Apr 2021 17:01:43 +0000 (13:01 -0400)]
[TableGen] Add support for the 'assert' statement in multiclasses

3 years ago[CodeGen][AArch64] Fix isel crash for truncating FP stores
David Sherwood [Wed, 7 Apr 2021 08:13:00 +0000 (09:13 +0100)]
[CodeGen][AArch64] Fix isel crash for truncating FP stores

When attempting to truncate a FP vector and store the result out
to memory we crashed because we had no pattern for truncating FP
stores. In fact, we don't support these types of stores and the
correct fix is to stop marking these truncating stores as legal.

Tests have been added here:

  CodeGen/AArch64/sve-fptrunc-store.ll

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

3 years ago[mlir][spirv] Add control for non-32-bit scalar type emulation
Lei Zhang [Wed, 7 Apr 2021 18:52:16 +0000 (14:52 -0400)]
[mlir][spirv] Add control for non-32-bit scalar type emulation

Non-32-bit scalar types require special hardware support that may not
exist on all GPUs. This is reflected in SPIR-V as that non-32-bit scalar
types require special capabilities or extensions.

Previously when there is a non-32-bit type and no native support, we
unconditionally emulate it with 32-bit ones. This isn't good given that
it can have implications over ABI and data layout consistency.

This commit introduces an option to control whether to use 32-bit
types to emulate.

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

3 years ago[mlir][spirv] Timely fail type conversion
Lei Zhang [Wed, 7 Apr 2021 18:52:07 +0000 (14:52 -0400)]
[mlir][spirv] Timely fail type conversion

Per the TypeConverter API contract, returning `llvm:None` means
other conversion rules should be tried. But we only have one
rule per input type. So there is no need to try others and we can
just directly fail, which should return `nullptr`. This avoids
unnecessary checks.

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

3 years ago[AMDGPU] SIFoldOperands: refactor tryFoldCndMask with early-outs. NFC.
Jay Foad [Thu, 8 Apr 2021 12:03:20 +0000 (13:03 +0100)]
[AMDGPU] SIFoldOperands: refactor tryFoldCndMask with early-outs. NFC.

3 years ago[DebugInfo] Prevent invalid debug info being produced during LoopStrengthReduce
Stephen Tozer [Fri, 26 Mar 2021 14:52:43 +0000 (14:52 +0000)]
[DebugInfo] Prevent invalid debug info being produced during LoopStrengthReduce

During LoopStrengthReduce, some of the SSA values that are used by debug values
may be lost and/or salvaged. After LSR we attempt to recover any undef debug
values, including any that were salvaged but then lost their values afterwards,
by replacing the lost values with any live equal values (plus a possible
constant offset) that have been gathered prior to running LSR. When we do this
we restore the debug value's original DIExpression, to undo any salvaging (as we
have gone back to using the original debug value).

This process can currently produce invalid debug info if the number of operands
has changed by salvaging during LSR. Replacing old values during the
applyEqualValues step does not change the number of location operands, which
means that when we restore the old DIExpression we may have a mismatch between
the number of operands used by the debug value and the number of operands
referenced by the DIExpression. This patch fixes this by restoring the full
original location metadata at the start of the applyEqualValues step, so that
there is no mismatch in operand count between the debug value and its
DIExpression.

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

3 years ago[NFC][X86][CostModel] Add some load/store tests w/ non-power-of-two elt cnt vectors
Roman Lebedev [Thu, 8 Apr 2021 11:56:05 +0000 (14:56 +0300)]
[NFC][X86][CostModel] Add some load/store tests w/ non-power-of-two elt cnt vectors

For example the cost to load <48 x i16> should likely be 3,
because that's just 3x load i256.

3 years ago[lldb] [client] Support for multiprocess extension
Michał Górny [Fri, 12 Mar 2021 08:02:36 +0000 (09:02 +0100)]
[lldb] [client] Support for multiprocess extension

Add a minimal support for the multiprocess extension in gdb-remote
client.  It accepts PIDs as part of thread-ids, and rejects PIDs that
do not match the current inferior.

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

3 years ago[NVPTX] Fix compiler warning in NDEBUG build [NFC]
Mikael Holmen [Thu, 8 Apr 2021 11:21:07 +0000 (13:21 +0200)]
[NVPTX] Fix compiler warning in NDEBUG build [NFC]

Without the fix we get

../lib/Target/NVPTX/NVPTXLowerArgs.cpp:236:24: error: lambda capture 'Arg' is not used [-Werror,-Wunused-lambda-capture]
  auto IsALoadChain = [Arg](Value *Start) {
                       ^~~
1 error generated.

3 years ago[flang][nfc] Rename some test files
Andrzej Warzynski [Thu, 8 Apr 2021 10:01:35 +0000 (10:01 +0000)]
[flang][nfc] Rename some test files

Update test names as per Flang's coding style guide [1]:
```
File names should use dashes, not underscores.
```

[1] https://github.com/llvm/llvm-project/blob/main/flang/docs/C%2B%2Bstyle.md#files

3 years ago[OpenCL][Docs] Fix typo in section label
Anastasia Stulova [Thu, 8 Apr 2021 09:59:44 +0000 (10:59 +0100)]
[OpenCL][Docs] Fix typo in section label

3 years ago[GreedyRA ORE] Add function level spill/reloads stats
Serguei Katkov [Thu, 8 Apr 2021 07:55:07 +0000 (14:55 +0700)]
[GreedyRA ORE] Add function level spill/reloads stats

Reviewers: reames, MatzeB, anemet, thegameg
Reviewed By: reames, thegameg
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100014

3 years ago[flang][driver] Add debug options not requiring semantic checks
Andrzej Warzynski [Tue, 30 Mar 2021 10:35:42 +0000 (10:35 +0000)]
[flang][driver] Add debug options not requiring semantic checks

This patch adds two debugging options in the new Flang driver
(flang-new):
  *fdebug-unparse-no-sema
  *fdebug-dump-parse-tree-no-sema
Each of these options combines two options from the "throwaway" driver
(left: f18, right: flang-new):
  * `-fdebug-uparse -fdebug-no-semantics` --> `-fdebug-unparse-no-sema`
  * `-fdebug-dump-parse-tree -fdebug-no-semantics` -->
    `-fdebug-dump-parse-tree-no-sema`

There are no plans to implement `-fdebug-no-semantics` in the new
driver.  Such option would be too powerful. Also, it would only make
sense when combined with specific frontend actions (`-fdebug-unparse`
and `-fdebug-dump-parse-tree`). Instead, this patch adds 2 specialised
options listed above. Each of these is implemented through a dedicated
FrontendAction (also added).

The new frontend actions are implemented in terms of a new abstract base
action: `PrescanAndSemaAction`. This new base class was required so that
we can have finer control over what steps within the frontend are
executed:
  * `PrescanAction`: run the _prescanner_
  * `PrescanAndSemaAction`: run the _prescanner_ and the _parser_ (new
     in this patch)
  * `PrescanAndSemaAction`: run the _prescanner_, _parser_ and run the
    _semantic checks_

This patch introduces `PrescanAndParseAction::BeginSourceFileAction`.
Apart from the semantic checks removed at the end, it is similar to
`PrescanAndSemaAction::BeginSourceFileAction`.

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

3 years ago[LV] Logical and/or select costs
David Green [Thu, 8 Apr 2021 09:39:47 +0000 (10:39 +0100)]
[LV] Logical and/or select costs

D99674 stopped the folding of certain select operations into and/or, due
to incorrect folding in the presence of poison. D97360 added some costs
to attempt to account for the change, but only worked at the getUserCost
level, not the getCmpSelInstrCost that the vectorizer will use directly.
This adds similar logic into the vectorizer to handle these logical
and/or selects, treating them like and/or directly.

This fixes 60% performance regressions from code like the attached test
case.

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

3 years ago[LV] Add a logical and/or select cost test. NFC
David Green [Thu, 8 Apr 2021 09:27:06 +0000 (10:27 +0100)]
[LV] Add a logical and/or select cost test. NFC

3 years ago[RISCV] Support OR/XOR/AND reductions on vector masks
Fraser Cormack [Wed, 7 Apr 2021 09:03:22 +0000 (10:03 +0100)]
[RISCV] Support OR/XOR/AND reductions on vector masks

This patch adds RVV codegen support for OR/XOR/AND reductions for both
scalable- and fixed-length vector types. There are a few possible
codegen strategies for each -- vmfirst.m, vmsbf.m, and vmsif.m could be
used to some extent -- but the vpopc.m instruction was chosen since it
produces the scalar result in one instruction, after which scalar
instructions can finish off the computation.

The reductions are lowered identically for both scalable- and
fixed-length vectors, although some alternate strategies may be more
optimal on fixed-length vectors since it's cheaper to get the length of
those types.

Other reduction types were not deemed to be relevant for mask vectors.

Reviewed By: craig.topper

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

3 years ago[OpenCL] Fix mipmap read_image return types
Sven van Haastregt [Thu, 8 Apr 2021 08:51:44 +0000 (09:51 +0100)]
[OpenCL] Fix mipmap read_image return types

The return type did not match the function name.

3 years agoReorg firmware corefile tests; add test for OS plugin loading
Jason Molenda [Thu, 8 Apr 2021 08:44:13 +0000 (01:44 -0700)]
Reorg firmware corefile tests; add test for OS plugin loading

A little cleanup to how these firmware corefile tests are done; add
a test that loads a dSYM that loads an OS plugin, and confirm that
the OS plugin's threads are created.

3 years ago[AMDGPU, test] Fix use of undef FileCheck var
Thomas Preud'homme [Sun, 4 Apr 2021 10:12:58 +0000 (11:12 +0100)]
[AMDGPU, test] Fix use of undef FileCheck var

Test CodeGen/AMDGPU/amdgpu.private-memory.ll and
CodeGen/AMDGPU/private-memory-r600.ll have a block of CHECK directives
whose prefix is inconsistent: R600-CHECK Vs R600. This leads to a
R600-NOT directive using an undefined CHAN variable due to R600-CHECK
directives never being considered by FileCheck. Fixing the prefix leads
to the testcase failing. As per https://reviews.llvm.org/D99865#2675235
this commit removes the directives instead since it is not possible to
write a reliable check.

Reviewed By: arsenm

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

3 years ago[mlir] add support for index type in vectors.
Tobias Gysi [Thu, 8 Apr 2021 08:15:14 +0000 (08:15 +0000)]
[mlir] add support for index type in vectors.

The patch enables the use of index type in vectors. It is a prerequisite to support vectorization for indexed Linalg operations. This refactoring became possible due to the newly introduced data layout infrastructure. The data layout of a module defines the bitwidth of the index type needed to verify bitcasts and similar vector operations.

Reviewed By: nicolasvasilache

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

3 years ago[clang] Speedup line offset mapping computation
serge-sans-paille [Thu, 1 Apr 2021 20:18:55 +0000 (22:18 +0200)]
[clang] Speedup line offset mapping computation

Clang spends a decent amount of time in the LineOffsetMapping::get(...)
function. This function used to be vectorized (through SSE2) then the
optimization got dropped because the sequential version was on-par performance
wise.

This provides an optimization of the sequential version that works on a word at
a time, using (documented) bithacks to provide a portable vectorization.

When preprocessing the sqlite amalgamation, this yields a sweet 3% speedup.

This is a recommit of 6951b72334bbe4c189c71751edc1e361d7b5632c with endianness
and unsigned long vs uint64_t issues fixed (hopefully).

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

3 years ago[AsmParser] Recognize more escaped characters between single quotes
LemonBoy [Thu, 8 Apr 2021 07:57:50 +0000 (09:57 +0200)]
[AsmParser] Recognize more escaped characters between single quotes

The GNU AS manual states the following about single-character constants enclosed within single quotes:

>  Some backslash escapes apply to characters, \b, \f, \n, \r, \t, and \" with the same meaning as for strings, plus \' for a single quote.

Add two more characters to the switch handling this case to match GAS behaviour, plus a test to make sure nothing regresses.

Reviewed By: MaskRay

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

3 years ago[GreedyRA ORE] Extract computeNumberOfSplillsReloads to use in different places....
Serguei Katkov [Thu, 8 Apr 2021 07:38:38 +0000 (14:38 +0700)]
[GreedyRA ORE] Extract computeNumberOfSplillsReloads to use in different places. NFC.

Extract one basic block handling to introduce stat computation for method scope.

Reviewers: reames, MatzeB, anemet, thegameg
Reviewed By: reames, thegameg
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100013

3 years ago[GreedyRA ORE] Extract stats in RAGreedyStats struct. NFC.
Serguei Katkov [Thu, 8 Apr 2021 07:27:37 +0000 (14:27 +0700)]
[GreedyRA ORE] Extract stats in RAGreedyStats struct. NFC.

Combine all collected stats into separate struct RAGreedyStats
with add and report methods.

The motivation is to extend the number of statistics to capture and instead of
adding new parameters, just combine all of them into one structure.
Additionally I plan to use report from different places in future to report data
for function as well.

Reviewers: reames, MatzeB, anemet, thegameg
Reviewed By: thegameg
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100012

3 years ago[GreedyRA ORE] Compute ORE stats if extra analysis is enabled
Serguei Katkov [Tue, 6 Apr 2021 14:32:02 +0000 (21:32 +0700)]
[GreedyRA ORE] Compute ORE stats if extra analysis is enabled

To save compile time, avoid computation of stats if ORE will not emit it.
The motivation is to add more stats and compute it only if it will dumped.

Reviewers: reames, MatzeB, anemet, thegameg
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100010

3 years ago[Debug-Info] Use inlined strings in .dwinfo section by default for DBX.
Esme-Yi [Thu, 8 Apr 2021 07:20:22 +0000 (07:20 +0000)]
[Debug-Info] Use inlined strings in .dwinfo section by default for DBX.

Summary: Set the default DwarfInlinedStrings as inlined strings for DBX, due to DBX does not support .dwstr section for now.

Reviewed By: dblaikie

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

3 years ago[RISCV] Add scalable offset under very large stack size.
Hsiangkai Wang [Thu, 8 Apr 2021 02:49:10 +0000 (10:49 +0800)]
[RISCV] Add scalable offset under very large stack size.

If the stack size is larger than 12 bits, we have to use a scratch
register to store the stack size. Before we introduce the scalable stack
offset, we could simplify

%0 = ADDI %stack.0, 0

=>

%scratch = ... # sequence of instructions to move the offset into
%%scratch
%0 = ADD %fp, %scratch

However, if the offset contains scalable part, we need to consider it.

%0 = ADDI %stack.0, 0

=>

%scratch = ... # sequence of instructions to move the offset into
%%scratch
%scratch = ADD %fp, %scratch
%scalable_offset = ... # sequence of instructions for vscaled-offset.
%0 = ADD/SUB %scratch, %scalable_offset

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

3 years ago[NFC][RISCV] Add test for scalable offset under large stack size.
Hsiangkai Wang [Thu, 8 Apr 2021 02:44:09 +0000 (10:44 +0800)]
[NFC][RISCV] Add test for scalable offset under large stack size.

This test case shows that we access wrong stack slots when the frame
object has scalable offset under large stack size.

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

3 years ago[Constant] Remove unused variable
Juneyoung Lee [Thu, 8 Apr 2021 06:44:42 +0000 (15:44 +0900)]
[Constant] Remove unused variable

3 years ago[Constant] ConstantStruct/Array should not lower poison to undef
Juneyoung Lee [Thu, 8 Apr 2021 06:20:08 +0000 (15:20 +0900)]
[Constant] ConstantStruct/Array should not lower poison to undef

This is a (late) follow-up patch of 8871a4b4cab8a56fd6ff12fd024002c3c79128b3 and
c95f39891a282ebf36199c73b705d4a2c78a46ce to make ConstantStruct::get/ConstantArray::getImpl
correctly return PoisonValue if all elements are poison.
This was found while discussing about the elements of a vector-typed UndefValue (D99853)

3 years ago[CSSPGO] Move pseudo probes to the beginning of a block to unblock SelectionDAG combine.
Hongtao Yu [Wed, 7 Apr 2021 01:32:23 +0000 (18:32 -0700)]
[CSSPGO] Move pseudo probes to the beginning of a block to unblock SelectionDAG combine.

Pseudo probes, when scattered in a block, can be chained dependencies of other regular DAG nodes and block DAG combine optimizations. To fix this, scattered probes in a block are grouped and placed at the beginning of the block. This shouldn't affect the profile quality.

Test Plan:

Reviewed By: wenlei, wmi

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

3 years agoChange the default value for `preloadDialectsInContext` for MlirOptMain
Mehdi Amini [Thu, 8 Apr 2021 03:46:56 +0000 (03:46 +0000)]
Change the default value for `preloadDialectsInContext` for MlirOptMain

This option has been deprecated for 6 months, change the default setting for now before
future removal.

While clients can set the option to true for now, they should start
updating their passes to define the right `dependentDialects` in
preparation of the removal of this option. See the FAQ for more info:
https://mlir.llvm.org/getting_started/Faq/

Reviewed By: rriddle, jpienaar

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

3 years agoInclude `llvm-config` and `not` in AppleClang toolchains.
Dan Liew [Thu, 8 Apr 2021 04:21:07 +0000 (21:21 -0700)]
Include `llvm-config` and `not` in AppleClang toolchains.

The motivation here is so that we can configure and run compiler-rt
tests from a standalone build against AppleClang.

rdar://75975846

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

3 years ago[docs] Document our norms around reverts
Philip Reames [Thu, 8 Apr 2021 03:59:40 +0000 (20:59 -0700)]
[docs] Document our norms around reverts

This has come up a few times recently, and I was surprised to notice that we don't have anything in the docs.

This patch deliberately sticks to stuff that is uncontroversial in the community. Everything herein is thought to be widely agreed to by a large majority of the community.  A few things were noted and removed in review which failed this standard, if you spot anything else, please point it out.

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

3 years ago[Driver] Drop $DEFAULT_TRIPLE-$name as a fallback program name
Fangrui Song [Thu, 8 Apr 2021 04:01:10 +0000 (21:01 -0700)]
[Driver] Drop $DEFAULT_TRIPLE-$name as a fallback program name

D13340 introduced this behavior which is not needed even for mips.
This was raised on https://lists.llvm.org/pipermail/cfe-dev/2020-May/065437.html
but no action was taken.

This was raised again in https://lists.llvm.org/pipermail/cfe-dev/2021-April/067974.html
"The LLVM host/target TRIPLE padding drama on Debian"
as it caused confusion. This patch drops the behavior.

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

3 years ago[RISCV] DAG nodes and pseudo instructions for CSR access
Serge Pavlov [Thu, 18 Mar 2021 15:07:27 +0000 (22:07 +0700)]
[RISCV] DAG nodes and pseudo instructions for CSR access

New custom DAG nodes were added to represent operations on CSR. These
nodes are lowered to corresponding pseudo instruction. Using the pseudo
instructions allows to specify different scheduling information for
operations on different system registers. It also make possible to
specify dependencies of instructions on specific system registers.

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

3 years ago[AMDGPU] Only use ds_read/write_b128 for alignment >= 16
hsmahesha [Thu, 8 Apr 2021 02:41:42 +0000 (08:11 +0530)]
[AMDGPU] Only use ds_read/write_b128 for alignment >= 16

PS: Submitting on behalf of Jay.

Reviewed By: rampitec

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

3 years ago[AMDGPU] Add some exhaustive ds read/write alignment tests
hsmahesha [Thu, 8 Apr 2021 02:37:32 +0000 (08:07 +0530)]
[AMDGPU] Add some exhaustive ds read/write alignment tests

PS: Submitting on behalf of Jay.

Reviewed By: rampitec

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

3 years ago[PowerPC] fixup killed flags for ri + addi to ri transformation
Chen Zheng [Thu, 8 Apr 2021 01:46:25 +0000 (21:46 -0400)]
[PowerPC] fixup killed flags for ri + addi to ri transformation

Fixup killed flags if DefMI and MI are not in the same basic blocks.

Reviewed By: nemanjai

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

3 years agoRevert "[LoopInterchange] Fix transformation bugs in loop interchange"
Congzhe Cao [Thu, 8 Apr 2021 01:15:15 +0000 (21:15 -0400)]
Revert "[LoopInterchange] Fix transformation bugs in loop interchange"

This reverts commit 6ec68bd815d00c1eec2a6b9766452554f0e6cb61.

3 years ago[NFC][AMDGPU] Correct indentation in AMDGPUUsage.rst
Tony Tye [Thu, 8 Apr 2021 00:58:02 +0000 (00:58 +0000)]
[NFC][AMDGPU] Correct indentation in AMDGPUUsage.rst

Correct indentation that results in rST syntax error.

3 years ago[LoopInterchange] Fix transformation bugs in loop interchange
CongzheUalberta [Thu, 8 Apr 2021 00:44:32 +0000 (20:44 -0400)]
[LoopInterchange] Fix transformation bugs in loop interchange

After loop interchange, the (old) outer loop header should not jump to
`LoopExit`. Note that the old outer loop becomes the new inner loop
after interchange. If we branched to `LoopExit` then after interchange
we would jump directly from the (new) inner loop header to `LoopExit`
without executing the rest of (new) outer loop.

This patch modifies adjustLoopBranches() such that the old outer
loop header (which becomes the new inner loop header) jumps to the
old inner loop latch which becomes the new outer loop latch after
interchange.

Reviewed By: bmahjour

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

3 years ago[RISCV] Use multiclass inheritance to simplify some of riscv_vector.td. NFCI
Craig Topper [Thu, 8 Apr 2021 00:33:20 +0000 (17:33 -0700)]
[RISCV] Use multiclass inheritance to simplify some of riscv_vector.td. NFCI

We don't need to instantiate single multiclasses inside of
other multiclasses. We can use inheritance and save writing 'defm ""'.

Reviewed By: khchen

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

3 years ago[lld-macho] Parallelize __LINKEDIT generation
Jez Ng [Wed, 7 Apr 2021 23:55:45 +0000 (19:55 -0400)]
[lld-macho] Parallelize __LINKEDIT generation

Benchmarking chromium_framework on a 3.2 GHz 16-Core Intel Xeon W Mac Pro:

      N           Min           Max        Median           Avg        Stddev
  x  20          4.33          4.42          4.37          4.37   0.021026299
  +  20          4.12          4.23          4.18         4.175   0.035318103
  Difference at 95.0% confidence
    -0.195 +/- 0.0186025
    -4.46224% +/- 0.425686%
    (Student's t, pooled s = 0.0290644)

Reviewed By: #lld-macho, gkm

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

3 years agoDisable use of SCC bit from asm
Stanislav Mekhanoshin [Wed, 7 Apr 2021 17:34:53 +0000 (10:34 -0700)]
Disable use of SCC bit from asm

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

3 years ago[AMDGPU] Update gfx90a memory model support
Tony Tye [Tue, 30 Mar 2021 22:38:19 +0000 (22:38 +0000)]
[AMDGPU] Update gfx90a memory model support

Reviewed By: rampitec

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

3 years ago[AMDGPU] Split GCNRegBankReassign
Stanislav Mekhanoshin [Wed, 7 Apr 2021 19:45:13 +0000 (12:45 -0700)]
[AMDGPU] Split GCNRegBankReassign

Allow pass to work separately with SGPR, VGPR registers or both.
This is NFC now but will be needed to split RA for separate
SGPR and VGPR passes.

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

3 years ago[BasicAA] Add another GEP modulo test with shl with odd op.
Florian Hahn [Wed, 7 Apr 2021 21:26:01 +0000 (22:26 +0100)]
[BasicAA] Add another GEP modulo test with shl with odd op.

3 years ago[InstCombine] fold not ops around min/max intrinsics
Sanjay Patel [Wed, 7 Apr 2021 21:19:15 +0000 (17:19 -0400)]
[InstCombine] fold not ops around min/max intrinsics

This is another step towards parity with the existing
cmp+select folds (see D98152).

3 years ago[InstCombine] add test for min/max intrinsic with not ops; NFC
Sanjay Patel [Wed, 7 Apr 2021 21:14:08 +0000 (17:14 -0400)]
[InstCombine] add test for min/max intrinsic with not ops; NFC

3 years ago[LLDB] Clarifying the documentation for variable formatting wrt to qualifiers and...
Shafik Yaghmour [Wed, 7 Apr 2021 21:29:12 +0000 (14:29 -0700)]
[LLDB] Clarifying the documentation for variable formatting wrt to qualifiers and adding a test that demonstrates this

When looking up user specified formatters qualifiers are removed from types before matching,
I have added a clarifying example to the document and added an example to a relevant test to demonstrate this behavior.

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

3 years ago[RISCV] Add a special case to lowerSELECT for select of 2 constants with a SETLT...
Craig Topper [Wed, 7 Apr 2021 20:46:16 +0000 (13:46 -0700)]
[RISCV] Add a special case to lowerSELECT for select of 2 constants with a SETLT condition.

If the constants have a difference of 1 we can convert one to
the other by adding or subtracting the condition.

We have a DAG combine for this, but it only runs before type
legalization. If the select is introduced later during type
legalization or op legalization we will miss it.

We don't need a specific condition, but some conditions are
harder to materialize than others on RISCV. I know that SETLT
will be a single instruction and it is what is used by the
motivating pattern from signed saturating add/sub.

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

3 years ago[libc++abi] Adjust XFAIL for misaligned exception header on ARM
Louis Dionne [Wed, 7 Apr 2021 20:14:00 +0000 (16:14 -0400)]
[libc++abi] Adjust XFAIL for misaligned exception header on ARM

On ARM, the alignment has always been the right one, so this test never
fails.

3 years ago[Driver][test] Test intended target only
Jinsong Ji [Wed, 7 Apr 2021 20:08:24 +0000 (20:08 +0000)]
[Driver][test] Test intended target only

6fe7de90b9e4e466a5c2baadafd5f72d3203651d changed GNU toolchain,
and added new RUN line to test expected behavior.

The change is for GNU toolchain only, so this will fail other toolchain,
eg: AIX.

Update the test with `-target` to test GNU tool chain only.

Reviewed By: MaskRay

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

3 years ago[lld-macho] Make time-trace* options more permissive.
Vy Nguyen [Wed, 7 Apr 2021 03:40:41 +0000 (23:40 -0400)]
[lld-macho] Make time-trace* options more permissive.

If either `time-trace-granularity` or `time-trace-file` is specified, then don't make users specify `-time-trace`.
It seems silly that I have to type all three options, eg, `-time-trace -time-trace-file=- -time-trace-granularity=...`.

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

3 years agoFix missing generate capture expression for novariants condition.
Jennifer Yu [Wed, 7 Apr 2021 16:26:14 +0000 (09:26 -0700)]
Fix missing generate capture expression for novariants condition.

3 years ago[clang] Move int <-> float scalar conversion to a separate function
Saurabh Jha [Wed, 7 Apr 2021 19:09:50 +0000 (12:09 -0700)]
[clang] Move int <-> float scalar conversion to a separate function

As prelude to this patch https://reviews.llvm.org/D99037, we want to
move the int-float conversion
into a separate function that can be reused by matrix cast

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

3 years ago[mlir] Fixed alignment attribute of alloc constant folding.
Haruki Imai [Wed, 7 Apr 2021 19:17:19 +0000 (19:17 +0000)]
[mlir] Fixed alignment attribute of alloc constant folding.

When allocLikeOp is updated in alloc constant folding,
alighnment attribute was ignored. This patch fixes it.

Signed-off-by: Haruki Imai <imaihal@jp.ibm.com>
Reviewed By: mehdi_amini

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

3 years agoRemove .gitignore entries not relevant in the monorepo.
Paul Robinson [Wed, 7 Apr 2021 17:21:39 +0000 (10:21 -0700)]
Remove .gitignore entries not relevant in the monorepo.

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

3 years ago[RISCV] Replace 'return ReplaceNode' with 'ReplaceNode; return;' NFC
Craig Topper [Wed, 7 Apr 2021 19:17:42 +0000 (12:17 -0700)]
[RISCV] Replace 'return ReplaceNode' with 'ReplaceNode; return;' NFC

ReplaceNode is a void function as is the function that we were
doing this in. While this is valid code, it was a bit confusing.

3 years ago[BasicAA] Extend test coverage for GEP modulo logic.
Florian Hahn [Wed, 7 Apr 2021 18:59:17 +0000 (19:59 +0100)]
[BasicAA] Extend test coverage for GEP modulo logic.

Add a few additional test cases which combine multiplies with
powers-of-2, different wrapping flags.

3 years ago[AArch64] Materialize FP constant in code for large code model
Jonas Hahnfeld [Tue, 30 Mar 2021 16:28:54 +0000 (18:28 +0200)]
[AArch64] Materialize FP constant in code for large code model

When using the large code model with FastISel (for example via
clang -O0 which adds the optnone attribute), FP constants could
still be materialized using adrp + ldr. Unconditionally enable
the existing path for MachO to materialize the constant in code.

For testing, restore literal_pools_float.ll to exercise the constant
pool and add two optnone-functions that return a float and a double,
respectively. Consolidate fpimm.ll and add a new fast-isel-fpimm.ll
to check the code paths taken with FastISel.

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

3 years agoRevert "[AsmPrinter] Delete dead takeDeletedSymbsForFunction()"
Arthur Eubanks [Wed, 7 Apr 2021 18:26:18 +0000 (11:26 -0700)]
Revert "[AsmPrinter] Delete dead takeDeletedSymbsForFunction()"

This reverts commit 9583a3f2625818b78c0cf6d473cdedb9f23ad82c.

This wasn't NFC as initially thought. Needed for D99707.

3 years ago[Windows] Remove global OF_None flag for Windows in ToolOutputFiles
Abhina Sreeskantharajan [Wed, 7 Apr 2021 18:09:21 +0000 (14:09 -0400)]
[Windows] Remove global OF_None flag for Windows in ToolOutputFiles

Since we have created a new OF_TextWithCRLF flag, we no longer need to worry about OF_Text flag turning on CRLF translation. I can remove this workaround I added to globally open all ToolOutputFiles as binary on Windows.

Reviewed By: rnk

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

3 years agoCorrect the tablegen logic for MutualExclusions attribute checking.
Aaron Ballman [Wed, 7 Apr 2021 17:59:54 +0000 (13:59 -0400)]
Correct the tablegen logic for MutualExclusions attribute checking.

Just because an attribute is a statement attribute doesn't mean it's
not also a declaration attribute. In Clang, there are not currently any
DeclOrStmtAttr attributes that require mutual exclusion checking, but
downstream clients discovered this issue.

3 years ago[lld-macho][nfc] Minor refactoring + clang-tidy fixes
Vy Nguyen [Wed, 7 Apr 2021 05:32:59 +0000 (01:32 -0400)]
[lld-macho][nfc] Minor refactoring + clang-tidy fixes

- use "empty()" instead of "size()"
- refactor the re-export code so it doesn't create a new vector every time.

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

3 years ago[lldb][Editline] Fix crash when navigating through empty command history.
Jordan Rupprecht [Wed, 7 Apr 2021 16:55:20 +0000 (09:55 -0700)]
[lldb][Editline] Fix crash when navigating through empty command history.

An empty history entry can happen by entering the expression evaluator an immediately hitting enter:

```
$ lldb
(lldb) e
Enter expressions, then terminate with an empty line to evaluate:
  1:  <hit enter>
```

The next time the user enters the expression evaluator, if they hit the up arrow to load the previous expression, lldb crashes. This patch treats empty history sessions as a single expression of zero length, instead of an empty list of expressions.

Fixes http://llvm.org/PR49845.

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

3 years ago[RISCV] Support vslide1up/down intrinsics for SEW=64 on RV32.
Craig Topper [Wed, 7 Apr 2021 17:14:59 +0000 (10:14 -0700)]
[RISCV] Support vslide1up/down intrinsics for SEW=64 on RV32.

This can't use our normal strategy of splatting the scalar and using
a .vv operation instead of .vx.

Instead this patch bitcasts the vector to the equivalent SEW=32
vector and inserts the scalar parts using two vslide1up/down. We
do that unmasked and apply the mask separately at the end with
a vmerge.

For vslide1up there maybe some other options here like getting
i64 into element 0 and using vslideup.vi with this vector as
vd and the original source as vs1. Masking would still need to
be done afterwards.

That idea doesn't work for vslide1down. We need to slidedown and
then insert a single scalar at vl-1 which we could do with a
vslideup, but that assumes vl > 0 which I don't think we can assume.

The i32 double slide1down implemented here is the best I could come
up with and I just made vslide1up consistent.

Reviewed By: frasercrmck

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

3 years ago[HIP] Fix rocm-detect.hip test path
Aaron En Ye Shi [Wed, 7 Apr 2021 17:19:28 +0000 (17:19 +0000)]
[HIP] Fix rocm-detect.hip test path

The ROCm installation directory may be another
directory, llvm/ inside the build directory.

Reviewed By: yaxunl

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

3 years ago[SelectionDAG] Teach SelectionDAG::FoldConstantArithmetic to handle SPLAT_VECTOR
Craig Topper [Wed, 7 Apr 2021 17:03:31 +0000 (10:03 -0700)]
[SelectionDAG] Teach SelectionDAG::FoldConstantArithmetic to handle SPLAT_VECTOR

This allows FoldConstantArithmetic to handle SPLAT_VECTOR in
addition to BUILD_VECTOR. This allows it to support scalable
vectors. I'm also allowing fixed length SPLAT_VECTOR which is
used by some targets, but I'm not familiar enough to write tests
for those targets.

I had to block this function from running on CONCAT_VECTORS to
avoid calling getNode for a CONCAT_VECTORS of 2 scalars.
This can happen because the 2 operand getNode calls this
function for any opcode. Previously we were protected because
CONCAT_VECTORs of BUILD_VECTOR is folded to a larger BUILD_VECTOR
before that call. But it's not always possible to fold a CONCAT_VECTORS
of SPLAT_VECTORs, and we don't even try.

This fixes PR49781 where DAG combine thought constant folding
should be possible, but FoldConstantArithmetic couldn't do it.

Reviewed By: david-arm

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

3 years ago[LoopIdiomRecognize] Minor cleanups to the FFS idiom matching. NFC
Craig Topper [Wed, 7 Apr 2021 16:44:52 +0000 (09:44 -0700)]
[LoopIdiomRecognize] Minor cleanups to the FFS idiom matching. NFC

-Make sure of the CreateShl/LShr/AShr methods that take a uint64_t
instead of creating a ConstantInt for 1 ourselves.
-Use Builder.getInt1 or ConstantInt::getBool instead of a conditional.
-Pull out repeated calls to getType.

3 years ago[mlir][sparse] support integral types i32,i16,i8 for *numerical* values
Aart Bik [Tue, 6 Apr 2021 23:46:27 +0000 (16:46 -0700)]
[mlir][sparse] support integral types i32,i16,i8 for *numerical* values

Some sparse matrices operate on integral values (in contrast with the common
f32 and f64 values). This CL expands the compiler and runtime support to deal
with several common type combinations.

Reviewed By: bixia

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