Commit Graph

203054 Commits

Author SHA1 Message Date
Max Kazantsev
6748e7476e [Test] Move IndVars test to a proper place 2020-09-01 12:17:31 +07:00
Petr Hosek
11e2ca0270 [CMake] Use find_library for ncurses
Currently it is hard to avoid having LLVM link to the system install of
ncurses, since it uses check_library_exists to find e.g. libtinfo and
not find_library or find_package.

With this change the ncurses lib is found with find_library, which also
considers CMAKE_PREFIX_PATH. This solves an issue for the spack package
manager, where we want to use the zlib installed by spack, and spack
provides the CMAKE_PREFIX_PATH for it.

This is a similar change as https://reviews.llvm.org/D79219, which just
landed in master.

Patch By: haampie

Differential Revision: https://reviews.llvm.org/D85820
2020-08-31 20:06:21 -07:00
Alina Sbirlea
c9a8d991e6 [MemorySSA] Clean up single value phis.
MemoryPhis with a single value are correct, but can lead to errors when
updating. Clean up single entry Phis newly added when cloning blocks.
Resolves PR46574.
2020-08-31 19:26:08 -07:00
Xing GUO
45321f3e73 [DWARFYAML] Make the debug_str section optional.
This patch makes the debug_str section optional. When the debug_str
section exists but doesn't contain anything, yaml2obj will emit a
section header for it.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D86860
2020-09-01 10:02:09 +08:00
Hamilton Tobon Mosquera
aef078ab19 [OpenMPOpt][NFC] Moving constants as struct static attributes 2020-08-31 19:05:00 -05:00
Christopher Tetreault
b93c073189 [SVE] Remove calls to VectorType::getNumElements() from llvm-stress
Differential Revision: https://reviews.llvm.org/D86898
2020-08-31 15:51:15 -07:00
Lang Hames
8c3159bb6b [ORC] Remove an unused variable.
The unused Main variable was accidentally left in an earlier commit.
2020-08-31 15:35:55 -07:00
Jonas Devlieghere
7448020ce4 [lldb] Add reproducer verifier
Add a reproducer verifier that catches:

 - Missing or invalid home directory
 - Missing or invalid working directory
 - Missing or invalid module/symbol paths
 - Missing files from the VFS

The verifier is enabled by default during replay, but can be skipped by
passing --reproducer-no-verify.

Differential revision: https://reviews.llvm.org/D86497
2020-08-31 15:14:18 -07:00
Christopher Tetreault
bcc3cadef7 [SVE] Mark VectorType::getNumElements() deprecated
getNumElements() is being removed from base VectorType in
order to eliminate the class of bugs in which a scalable vector
is accidentally treated like a fixed length vector. Clients of
this function should either call getElementCount(), and handle
the case where getElementCount().isScalable() is true, or they can
cast to FixedVectorType and call getNumElements() if they are
sure that the vector has fixed width.

Deprecated VectorType functions will be removed after the LLVM
12 branch.

See: http://lists.llvm.org/pipermail/llvm-dev/2020-March/139811.html

Reviewed By: fpetrogalli

Differential Revision: https://reviews.llvm.org/D78127
2020-08-31 15:13:04 -07:00
Hamilton Tobon Mosquera
b5757ca2c4 [OpenMPOpt][HideMemTransfersLatency] Get values stored in offload arrays
getValuesInOffloadArrays goes through the offload arrays in __tgt_target_data_begin_mapper getting the values stored in them before the call is issued.

call void @__tgt_target_data_begin_mapper(arg0, arg1,
    i8** %offload_baseptrs, i8** %offload_ptrs, i64* %offload_sizes,
...)

Diferential Revision: https://reviews.llvm.org/D86300
2020-08-31 15:33:05 -05:00
Arthur Eubanks
8e53f78912 [docs] Fix indentation in FileCheck.rst
Fixes
C:\src\llvm-project\llvm\docs\CommandGuide\FileCheck.rst:745:Bullet list ends without a blank line; unexpected unindent.
2020-08-31 13:20:04 -07:00
Craig Topper
0ce780b084 [X86][CGP] Add gather test cases for D86371. 2020-08-31 13:12:53 -07:00
Sanjay Patel
251968146e [IR][GVN] allow intrinsics in Instruction's isCommutative query (2nd try)
The 1st try was reverted because I missed an assert that
needed softening.

As discussed in D86798 / rG09652721 , we were potentially
returning a different result for whether an Instruction
is commutable depending on if we call the base class or
derived class method.

This requires relaxing asserts in GVN, but that pass
seems to be working otherwise.

NewGVN requires more work because it uses different
code paths for numbering binops and calls.
2020-08-31 16:01:19 -04:00
Christopher Tetreault
6b50d3055a [SVE] Remove calls to VectorType::getNumElements from InstCombine
Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D82237
2020-08-31 12:59:10 -07:00
Roman Lebedev
4aba95741f [NFC][InstCombine] visitPHINode(): cleanup PHI CSE instruction replacement
As @nikic is pointing out in https://reviews.llvm.org/rGbf21ce7b908e#inline-4647
this must be sufficient otherwise `EliminateDuplicatePHINodes()`
would have hit issues with it already.
2020-08-31 22:29:39 +03:00
Martin Storsjö
ecdd8dabe2 [ORC] Remove a stray semicolon, silencing warnings. NFC. 2020-08-31 22:25:25 +03:00
Prathamesh Kulkarni
e87ae397a6 [ARM] Register pressure with -mthumb forces register reload before each call
This patch implements the foldMemoryOperand hook in Thumb1InstrInfo,
allowing tBLXr and a spilled function address to be combined back into a
tBL. This can help with codesize at Oz, especailly in the tinycrypt
library.

Differential Revision: https://reviews.llvm.org/D79785
2020-08-31 20:00:30 +01:00
Craig Topper
94e25784f5 [X86][CGP] Pre-commit test cases for D86371. 2020-08-31 10:48:56 -07:00
Qiu Chaofan
55050110d2 [NFC] [DAGCombiner] Refactor bitcast folding within fabs/fneg
fabs and fneg share a common transformation:

(fneg (bitconvert x)) -> (bitconvert (xor x sign))
(fabs (bitconvert x)) -> (bitconvert (and x ~sign))

This patch separate the code into a single method.

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D86862
2020-09-01 00:48:12 +08:00
Qiu Chaofan
9b5b508e71 [NFC] [DAGCombiner] Remove unnecessary negation in visitFNEG
In visitFNEG of DAGCombiner, the folding of (fneg (fsub c, x)) is
redundant since getNegatedExpression already handles it.
2020-09-01 00:35:01 +08:00
Florian Hahn
102583c8b4 [llvm-reduce] Create returns with undef values for non-void functions.
Currently replaceBranchTerminator/removeUninterestingBBsFromSwitch
always creates `ret void` instructions if no successor is in the chunk.

This results in invalid IR for functions with non-void return types,
which makes those reductions unfeasible. Instead, create `ret ty undef`
for functions with non-void return types.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D86849
2020-08-31 16:33:46 +01:00
Sean Fertile
73015ddfca [PowerPC][AIX] Add test for returning a vector type. [NFC]
Shows error produced when trying to return a vector, which is not
yet supported.
2020-08-31 11:14:17 -04:00
LLVM GN Syncbot
a4b07894ec [gn build] Port f5fd7486d6c 2020-08-31 14:02:39 +00:00
LLVM GN Syncbot
28847d4563 [gn build] Port 14dd0737822 2020-08-31 14:02:39 +00:00
Sanjay Patel
4302187593 [DAGCombiner] skip reciprocal divisor optimization for x/sqrt(x), better
I tried to fix this in:
rG716e35a0cf53
...but that patch depends on the order that we encounter the
magic "x/sqrt(x)" expression in the combiner's worklist.

This patch should improve that by waiting until we walk the
user list to decide if there's a use to skip.

The AArch64 test reveals another (existing) ordering problem
though - we may try to create an estimate for plain sqrt(x)
before we see that it is part of a 1/sqrt(x) expression.
2020-08-31 09:35:59 -04:00
Sanjay Patel
efe88f899f [AArch64] add another test for reciprocal sqrt; NFC 2020-08-31 09:35:59 -04:00
Sanjay Patel
09667cb955 [x86] add another test for reciprocal sqrt; NFC
The change in rG716e35a0cf53 depends on the order that
we encounter the expression x/sqrt(x), so we need to
adjust the logic to be more flexible.
2020-08-31 09:35:59 -04:00
Sourabh Singh Tomar
b75e186b38 [NFCI] Silent a build warning due to an extra semi-colon 2020-08-31 17:49:31 +05:30
Alexandre Ganea
4be21d8696 Fix sphinx documentation after a6a37a2fcd2a8048a75bd0d8280497ed89d73224 2020-08-31 08:06:13 -04:00
Georgii Rymar
e56dc2e569 [llvm-readobj/elf] - Don't fail when dumping an archive with a member that can't be recognized.
Imagine we have an archive that has 3 objects in the following order:
<valid known object>,<unknown object> and <valid known object>.

Currently llvm-readelf/obj report an error and stops dumping in the middle.
This patch changes the error reported to warning.

Differential revision: https://reviews.llvm.org/D86771
2020-08-31 13:16:15 +03:00
Raphael Isemann
20366c891d Revert "[FileCheck] Move FileCheck implementation out of LLVMSupport into its own library"
This reverts commit e9a3d1a401b07cbf7b11695637f1b549782a26cd. Seems the new
FileCheck library doesn't link on some bots. Reverting for now.
2020-08-31 11:38:40 +02:00
Raphael Isemann
aecb52031b [FileCheck] Move FileCheck implementation out of LLVMSupport into its own library
The actual FileCheck logic seems to be implemented in LLVMSupport. I don't see a
good reason for having FileCheck implemented there as it has a very specific use
while LLVMSupport is a dependency of pretty much every LLVM tool there is. In
fact, the only use of FileCheck I could find (outside the FileCheck tool and the
FileCheck unit test) is a single call in GISelMITest.h.

This moves the FileCheck logic to its own LLVMFileCheck library. This way only
FileCheck and the GlobalISelTests now have a dependency on this code.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D86344
2020-08-31 11:24:41 +02:00
Xing GUO
e15bcf56b0 [Test] Simplify DWARF test cases. NFC.
The Length, AbbrOffset and Values fields of the debug_info section are
optional. This patch helps remove them and simplify test cases.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D86857
2020-08-31 14:03:48 +08:00
Fangrui Song
c727302d39 [Sink] Optimize/simplify sink candidate finding with nearest common dominator
For an instruction in the basic block BB, SinkingPass enumerates basic blocks
dominated by BB and BB's successors. For each enumerated basic block,
SinkingPass uses `AllUsesDominatedByBlock` to check whether the basic
block dominates all of the instruction's users. This is inefficient.

Use the nearest common dominator of all users to avoid enumerating the
candidate. The nearest common dominator may be in a parent loop which is
not beneficial. In that case, find the ancestors in the dominator tree.

In the case that the instruction has no user, with this change we will
not perform unnecessary move. This causes some amdgpu test changes.

A stage-2 x86-64 clang is a byte identical with this change.
2020-08-30 22:51:00 -07:00
Fangrui Song
e148cbff94 [Sink][test] Add nounwind test and properly test convergent 2020-08-30 18:26:42 -07:00
Venkataramanan Kumar
3f6f7f6b7b [InstCombine] add extra-use tests for fmul+sqrt; NFC 2020-08-30 18:41:01 -04:00
Sanjay Patel
7d3ad258b7 [GVN] add another commutable intrinsic test; NFC
This is a reduced version of a test-suite crasher with rG25597f7
2020-08-30 18:36:28 -04:00
Sanjay Patel
56bc7f03f4 Revert "[IR][GVN] allow intrinsics in Instruction's isCommutative query"
This reverts commit 25597f7783e7038b8a2ee88bb49ac605b211b564.
It is causing crashing on bots such as:
http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/10523/steps/ninja-build/logs/stdio
2020-08-30 17:02:51 -04:00
Florian Hahn
6de6df75cc [DSE,MemorySSA] Skip defs without analyzable write locations.
Similar to other checks above, if there is no write location for a def,
it cannot be considered for elimination and can be skipped.
2020-08-30 21:56:25 +01:00
Sanjay Patel
d58c2f282d [IR][GVN] allow intrinsics in Instruction's isCommutative query
As discussed in D86798 / rG09652721 , we were potentially
returning a different result for whether an Instruction
is commutable depending on if we call the base class or
derived class method.

This requires relaxing an assert in GVN, but that pass
seems to be working otherwise.

NewGVN requires more work because it uses different
code paths for numbering binops and calls.
2020-08-30 16:49:22 -04:00
Sanjay Patel
c84adaaae2 [NewGVN] add test for commutative intrinsic; NFC 2020-08-30 16:33:45 -04:00
Sanjay Patel
6a90c8322d [GVN] add test for commutative intrinsic; NFC 2020-08-30 16:33:45 -04:00
Florian Hahn
49edbbbd7c [DSE,MemorySSA] Simplify code, EarlierAccess is be a MemoryDef (NFC).
After recent changes, we return early if Current is a MemoryPhi, so
EarlierAccess can only be a MemoryDef.
2020-08-30 21:31:57 +01:00
Craig Topper
ccd9fe1e8e [X86] Pre-commit the test-shrink.ll changes from D86578.
The conditions in these tests are guaranteed to always
go one direction. InstCombine would have folded them away.
2020-08-30 12:25:18 -07:00
Florian Hahn
2b972baedb [llvm-reduce] Add test for BB reduction with non-void ret type.
Precommit test for D86849.
2020-08-30 20:11:07 +01:00
Thomas Preud'homme
14ecb9c6d9 [FileCheck] Add precision to format specifier
Add printf-style precision specifier to pad numbers to a given number of
digits when matching them if the value is smaller than the given
precision. This works on both empty numeric expression (e.g. variable
definition from input) and when matching a numeric expression. The
syntax is as follows:

[[#%.<precision><format specifier>, ...]

where <format specifier> is optional and ... can be a variable
definition or not with an empty expression or not. In the absence of a
precision specifier, a variable definition will accept leading zeros.

Reviewed By: jhenderson, grimar

Differential Revision: https://reviews.llvm.org/D81667
2020-08-30 19:40:57 +01:00
Florian Hahn
11bbe69ccc [LV] Update CFG before adding runtime checks.
addRuntimeChecks uses SCEVExpander, which relies on the DT/LoopInfo to
be up-to-date. Changing the CFG afterwards may invalidate some inserted
instructions, especially LCSSA phis.

Reorder the code to first update the CFG and then create the runtime
checks. This should not have any impact on the generated code, as we
adjust the CFG and generate runtime checks together.

Fixes PR47343.
2020-08-30 18:21:44 +01:00
Sanjay Patel
d6a2f460c7 [FastISel] update to use intrinsic's isCommutative(); NFC
This requires adding a missing 'const' to the definition because
the callers are using const args, but there should be no change
in behavior.

The intrinsic method was added with D86798 / rG096527214033
2020-08-30 11:36:41 -04:00
Sanjay Patel
5b3abe923f [DAGCombiner] skip reciprocal divisor optimization for x/sqrt(x)
In general, we probably want to try the multi-use reciprocal
transform before sqrt transforms, but x/sqrt(x) is a special-case
because that will always reduce to plain sqrt(x) or an estimate.

The AArch64 tests show that the transform is limited by TLI
hook to patterns where there are 3 or more uses of the divisor.
So this change can result in an extra division compared to
what we had, but that's the intended behvior based on the
current setting of that hook.
2020-08-30 10:55:45 -04:00
Sanjay Patel
8c6fc8ff22 [AArch64] add tests for multi-use fast sqrt/recip; NFC 2020-08-30 10:55:44 -04:00