Richard Smith [Tue, 1 Sep 2020 02:04:35 +0000 (19:04 -0700)]
Fix -Wcompound-token-split to give the same warnings under -E
-frewrite-includes.
Remove the special-case (and highly implausible) diagnostic for a
compound token that crosses a file boundary, and instead model that case
the same as a compound token separated by whitespace, so that file
transitions and presumed file transitions behave the same way.
Richard Smith [Tue, 1 Sep 2020 01:03:18 +0000 (18:03 -0700)]
Remove -Wcompound-token-split-by-space from -Wall.
Use of a linebreak between the `(` and `{` in a GNU statement-expression
appears to be too common to include this warning in -Wall -- this occurs
in some Linux kernel headers, for example.
Petr Hosek [Mon, 31 Aug 2020 22:11:39 +0000 (15:11 -0700)]
[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
Alina Sbirlea [Mon, 31 Aug 2020 23:56:05 +0000 (16:56 -0700)]
[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.
Xing GUO [Tue, 1 Sep 2020 01:57:03 +0000 (09:57 +0800)]
[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
Hamilton Tobon Mosquera [Mon, 31 Aug 2020 23:37:23 +0000 (18:37 -0500)]
[OpenMPOpt][NFC] Moving constants as struct static attributes
Valentin Clement [Mon, 31 Aug 2020 23:49:44 +0000 (19:49 -0400)]
[mlir][openacc] Add missing attributes and operands for acc.loop
This patch add the missing operands to the acc.loop operation. Only the device_type
information is not part of the operation for now.
Reviewed By: rriddle, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D86753
peter klausler [Mon, 31 Aug 2020 18:54:48 +0000 (11:54 -0700)]
[flang] Check shape conformance on initializers
Specifically, ensure that initializers conform with their objects
according to 8.2 para 4.
Differential Revision: https://reviews.llvm.org/D86886
Mehdi Amini [Mon, 31 Aug 2020 22:39:39 +0000 (22:39 +0000)]
Fix mlir-reduce to explicitly register dialects and disable the global dialect registry by default
Clients who rely on the Context loading dialects from the global
registry can call `mlir::enableGlobalDialectRegistry(true);` before
creating an MLIRContext
Differential Revision: https://reviews.llvm.org/D86897
Christopher Tetreault [Mon, 31 Aug 2020 22:47:47 +0000 (15:47 -0700)]
[SVE] Remove calls to VectorType::getNumElements() from llvm-stress
Differential Revision: https://reviews.llvm.org/D86898
peter klausler [Tue, 25 Aug 2020 16:40:20 +0000 (09:40 -0700)]
[flang] Make `TypeParamInquiry` monomorphic
Change the expression representation TypeParamInquiry from being
a class that's templatized on the integer KIND of its result into
a monomorphic representation that results in a SubscriptInteger
that can then be converted.
This is a minor simplification, but it's worth doing because
it is believed to also be a work-around for bugs in the MSVC
compiler with overload resolution that affect the expression
traversal framework.
Differential Revision: https://reviews.llvm.org/D86551
Lang Hames [Mon, 31 Aug 2020 22:16:03 +0000 (15:16 -0700)]
[ORC] Remove an unused variable.
The unused Main variable was accidentally left in an earlier commit.
Jonas Devlieghere [Mon, 31 Aug 2020 22:13:49 +0000 (15:13 -0700)]
[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
Christopher Tetreault [Mon, 31 Aug 2020 21:38:18 +0000 (14:38 -0700)]
[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
Hubert Tong [Mon, 31 Aug 2020 21:57:22 +0000 (17:57 -0400)]
[analyzer][NFC] Add `override` keyword missing from D86027
Speculative fix for `-Werror,-Wsuggest-override` build failures on
the ppc64le-lld-multistage-test bot.
peter klausler [Mon, 31 Aug 2020 17:45:37 +0000 (10:45 -0700)]
[flang] Format label scope is independent of block scope
Compilation of the following program currently generates a warning message:
i = 1
if (i .eq. 0) then
write(6, 200) i
200 format (I8)
end if
write(6, 200) i
end
x.f90:6:9: Label '200' is not in scope
write(6, 200) i
^^^^^^^^^^^^^^^
Whereas branch targets must conform to the Clause 11.1.2.1 program
requirement "Transfer of control to the interior of a block from
outside the block is prohibited, ...", this doesn't apply to format
statement references.
Hamilton Tobon Mosquera [Mon, 31 Aug 2020 20:29:22 +0000 (15:29 -0500)]
[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
River Riddle [Mon, 31 Aug 2020 19:34:04 +0000 (12:34 -0700)]
[mlir][PDL] Move the formats for PatternOp and RewriteOp to the declarative form.
This is possible now that the declarative assembly form supports regions.
Differential Revision: https://reviews.llvm.org/D86830
River Riddle [Mon, 31 Aug 2020 19:33:55 +0000 (12:33 -0700)]
[mlir][OpFormatGen] Add initial support for regions in the custom op assembly format
This adds some initial support for regions and does not support formatting the specific arguments of a region. For now this can be achieved by using a custom directive that formats the arguments and then parses the region.
Differential Revision: https://reviews.llvm.org/D86760
River Riddle [Mon, 31 Aug 2020 19:33:46 +0000 (12:33 -0700)]
[mlir][ODS] Add new SymbolNameAttr and add support for in assemblyFormat
Symbol names are a special form of StringAttr that get treated specially in certain areas, such as formatting. This revision adds a special derived attr for them in ODS and adds support in the assemblyFormat for formatting them properly.
Differential Revision: https://reviews.llvm.org/D86759
River Riddle [Mon, 31 Aug 2020 19:33:36 +0000 (12:33 -0700)]
[mlir][OpFormatGen] Add support for specifiy "custom" directives.
This revision adds support for custom directives to the declarative assembly format. This allows for users to use C++ for printing and parsing subsections of an otherwise declaratively specified format. The custom directive is structured as follows:
```
custom-directive ::= `custom` `<` UserDirective `>` `(` Params `)`
```
`user-directive` is used as a suffix when this directive is used during printing and parsing. When parsing, `parseUserDirective` will be invoked. When printing, `printUserDirective` will be invoked. The first parameter to these methods must be a reference to either the OpAsmParser, or OpAsmPrinter. The type of rest of the parameters is dependent on the `Params` specified in the assembly format.
Differential Revision: https://reviews.llvm.org/D84719
Arthur Eubanks [Mon, 31 Aug 2020 20:19:21 +0000 (13:19 -0700)]
[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.
Craig Topper [Mon, 31 Aug 2020 19:39:50 +0000 (12:39 -0700)]
[X86][CGP] Add gather test cases for D86371.
Sanjay Patel [Mon, 31 Aug 2020 19:53:01 +0000 (15:53 -0400)]
[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.
Christopher Tetreault [Mon, 31 Aug 2020 19:17:51 +0000 (12:17 -0700)]
[SVE] Remove calls to VectorType::getNumElements from InstCombine
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D82237
Roman Lebedev [Mon, 31 Aug 2020 19:22:33 +0000 (22:22 +0300)]
[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.
Martin Storsjö [Mon, 31 Aug 2020 19:25:25 +0000 (22:25 +0300)]
[ORC] Remove a stray semicolon, silencing warnings. NFC.
Prathamesh Kulkarni [Mon, 31 Aug 2020 19:00:30 +0000 (20:00 +0100)]
[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
Martin Storsjö [Thu, 27 Aug 2020 11:48:22 +0000 (14:48 +0300)]
[LLD] [COFF] Error out if creating a DLL with too many exported symbols
The PE/DLL format has a limit on 64k exported symbols per DLL; make
sure to check this.
Differential Revision: https://reviews.llvm.org/D86701
Craig Topper [Mon, 31 Aug 2020 17:17:20 +0000 (10:17 -0700)]
[X86][CGP] Pre-commit test cases for D86371.
Nithin Vadukkumchery Rajendrakumar [Mon, 31 Aug 2020 17:25:33 +0000 (19:25 +0200)]
[analyzer] Add bool operator modeling for unque_ptr
Summary: Implemented boolean conversion operator for unique_ptr
Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun
Reviewed By: NoQ, xazax.hun
Subscribers: martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D86027
Qiu Chaofan [Mon, 31 Aug 2020 16:48:12 +0000 (00:48 +0800)]
[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
Qiu Chaofan [Mon, 31 Aug 2020 16:35:01 +0000 (00:35 +0800)]
[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.
Florian Hahn [Mon, 31 Aug 2020 15:33:46 +0000 (16:33 +0100)]
[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
Sean Fertile [Mon, 31 Aug 2020 15:14:17 +0000 (11:14 -0400)]
[PowerPC][AIX] Add test for returning a vector type. [NFC]
Shows error produced when trying to return a vector, which is not
yet supported.
Adam Balogh [Mon, 31 Aug 2020 14:29:01 +0000 (16:29 +0200)]
[clang-tidy] Buildbot failure fix for commit rGf5fd7486d6c0
Commit `rGf5fd7486d6c0` caused a buildbot failure because exceptions are
disabled by default on one of the buildbots. This patch forcibly enables
exceptions for the affected test.
Erik Pilkington [Mon, 31 Aug 2020 13:42:34 +0000 (09:42 -0400)]
[CodeGen] Make sure the EH cleanup for block captures is conditional when the block literal is in a conditional context
Previously, clang was crashing on the attached test because the EH cleanup for
the block capture was incorrectly emitted under the assumption that the
expression wasn't conditionally evaluated. This was because before
9a52de00260,
pushLifetimeExtendedDestroy was mainly used with C++ automatic lifetime
extension, where a conditionally evaluated expression wasn't possible. Now that
we're using this path for block captures, we need to handle this case.
rdar://
66250047
Differential revision: https://reviews.llvm.org/D86854
Arnold Schwaighofer [Wed, 19 Aug 2020 14:13:16 +0000 (07:13 -0700)]
Teach the swift calling convention about _Atomic types
rdar://
67351073
Differential Revision: https://reviews.llvm.org/D86218
LLVM GN Syncbot [Mon, 31 Aug 2020 14:02:39 +0000 (14:02 +0000)]
[gn build] Port
f5fd7486d6c
LLVM GN Syncbot [Mon, 31 Aug 2020 14:02:39 +0000 (14:02 +0000)]
[gn build] Port
14dd0737822
Adam Balogh [Fri, 5 Jun 2020 11:27:09 +0000 (13:27 +0200)]
[Clang-Tidy] New check `bugprone-redundant-branch-condition`
Checking the same condition again in a nested `if` usually make no sense,
except if the value of the expression could have been changed between
the two checks. Although compilers may optimize this out, such code is
suspicious: the programmer may have meant to check something else.
Therefore it is worth to find such places in the code and notify the
user about the problem.
This patch implements a basic check for this problem. Currently it
only detects redundant conditions where the condition is a variable of
integral type. It also detects the possible bug if the variable is in an
//or// or //and// logical expression in the inner if and/or the variable
is in an //and// logical expression in the outer if statement. Negated
cases are not handled yet.
Differential Revision: https://reviews.llvm.org/D81272
Adam Balogh [Thu, 12 Dec 2019 16:03:16 +0000 (17:03 +0100)]
[clang-tidy] New check readability-prefer-member-initializer
Finds member initializations in the constructor body which can
be placed to the member initializers of the constructor instead.
This does not only improves the readability of the code but also
affects positively its performance. Class-member assignments
inside a control statement or following the first control
statement are ignored.
Differential Revision: https://reviews.llvm.org/D71199
Sanjay Patel [Mon, 31 Aug 2020 13:31:15 +0000 (09:31 -0400)]
[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.
Sanjay Patel [Mon, 31 Aug 2020 13:13:33 +0000 (09:13 -0400)]
[AArch64] add another test for reciprocal sqrt; NFC
Sanjay Patel [Mon, 31 Aug 2020 12:42:04 +0000 (08:42 -0400)]
[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.
sameeran joshi [Mon, 31 Aug 2020 12:59:57 +0000 (18:29 +0530)]
[Flang][NFC] Remove license comments from files in docs/ folder.
Solves issue https://reviews.llvm.org/D86131#2247275
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D86875
Nithin Vadukkumchery Rajendrakumar [Mon, 31 Aug 2020 09:50:39 +0000 (11:50 +0200)]
[analyzer] Add modeling for unique_ptr move constructor
Summary:
Add support for handling move contructor of std::unique_ptr.
Reviewers: NoQ, Szelethus, vsavchenko, xazax.hun
Reviewed By: NoQ
Subscribers: martong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D86373
Sourabh Singh Tomar [Mon, 31 Aug 2020 12:16:46 +0000 (17:46 +0530)]
[NFCI] Silent a build warning due to an extra semi-colon
Gongyu Deng [Mon, 31 Aug 2020 12:15:58 +0000 (14:15 +0200)]
[lldb] tab completion for class `CommandObjectTypeFormatterDelete`
1. Added a dedicated completion to class `CommandObjectTypeFormatterDelete`
which can be used by these commands: `type filter/format/summary/synthetic delete`;
2. Added a related test case.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D84142
Alexandre Ganea [Mon, 31 Aug 2020 12:05:55 +0000 (08:05 -0400)]
Raphael Isemann [Mon, 31 Aug 2020 10:24:25 +0000 (12:24 +0200)]
[lldb][NFC] Remove trailing whitespace in TestCompletion
Raphael Isemann [Mon, 31 Aug 2020 09:58:26 +0000 (11:58 +0200)]
[lldb] Fix TestCompletion's pid completion failing randomly
TestCompletion is randomly failing on some bots. The error message however states
that the computed completions actually do contain the expected pid we're
looking for, so there shouldn't be any test failure.
The reason for that turns out to be that complete_from_to is actually used
for testing two different features. It can be used for testing what the
common prefix for the list of completions is and *also* for checking all the
possible completions that are returned for a command. Which one of the two
things should be checked can't be defined by a parameter to the function, but
is instead guessed by the test method instead based on the results that were
returned. If there is a common prefix in all completions, then that prefix
is searched and otherwise all completions are searched.
For TestCompletion's pid test this behaviour leads to the strange test failures.
If all the pid's that our test LLDB can see have a common prefix (e.g., it
can only see pids [123, 122, 10004, 10000] -> common prefix '1'), then
complete_from_to check that the common prefix contains our pid, which is
always fails ('1' doesn't contain '123' or any other valid pid). If there
isn't a common prefix (e.g., pids are [123, 122, 10004, 777]) then
complete_from_to will check the list of completions instead which works correctly.
This patch is fixing this by adding a simple check method that doesn't
have this behaviour and is simply searching the returned list of completions.
This should get the bots green while I'm working on a proper fix that fixes
complete_from_to.
Georgii Rymar [Fri, 28 Aug 2020 10:33:20 +0000 (13:33 +0300)]
[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
Raphael Isemann [Mon, 31 Aug 2020 09:14:09 +0000 (11:14 +0200)]
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.
Raphael Isemann [Mon, 31 Aug 2020 09:14:09 +0000 (11:14 +0200)]
[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
Raphael Isemann [Mon, 31 Aug 2020 09:12:32 +0000 (11:12 +0200)]
[lldb] Don't crash when LLDB can't extract the tsan report
Right now all tsan tests are crashing on Linux. The tests were already marked as
expected failures, but since commit
20ce8affce85d added an assert that every
StopInfo needs a non-empty stop description the tests actually started crash
(which is even with an expectedFailure a failed test).
The reason for that is that we never had any stop description when hitting tsan
errors on Linux. Before the assert that just made the test fail, but now the
empty description is hitting the assert. This patch just adds a generic stop
description mentioning tsan to prevent that we hit that assert on platforms
where we don't support extracting the tsan report.
Reviewed By: friss
Differential Revision: https://reviews.llvm.org/D86593
Xing GUO [Mon, 31 Aug 2020 06:03:02 +0000 (14:03 +0800)]
[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
Fangrui Song [Mon, 31 Aug 2020 05:51:00 +0000 (22:51 -0700)]
[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.
Fangrui Song [Mon, 31 Aug 2020 01:26:15 +0000 (18:26 -0700)]
[Sink][test] Add nounwind test and properly test convergent
Venkataramanan Kumar [Sun, 30 Aug 2020 22:39:05 +0000 (18:39 -0400)]
[InstCombine] add extra-use tests for fmul+sqrt; NFC
Sanjay Patel [Sun, 30 Aug 2020 22:36:28 +0000 (18:36 -0400)]
[GVN] add another commutable intrinsic test; NFC
This is a reduced version of a test-suite crasher with rG25597f7
Sanjay Patel [Sun, 30 Aug 2020 21:02:01 +0000 (17:02 -0400)]
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
Florian Hahn [Sun, 30 Aug 2020 20:53:31 +0000 (21:53 +0100)]
[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.
Sanjay Patel [Sun, 30 Aug 2020 19:32:45 +0000 (15:32 -0400)]
[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.
Sanjay Patel [Sun, 30 Aug 2020 15:47:17 +0000 (11:47 -0400)]
[NewGVN] add test for commutative intrinsic; NFC
Sanjay Patel [Sun, 30 Aug 2020 15:45:27 +0000 (11:45 -0400)]
[GVN] add test for commutative intrinsic; NFC
Florian Hahn [Sun, 30 Aug 2020 20:27:32 +0000 (21:27 +0100)]
[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.
Craig Topper [Sun, 30 Aug 2020 19:25:18 +0000 (12:25 -0700)]
[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.
Florian Hahn [Sun, 30 Aug 2020 18:36:46 +0000 (19:36 +0100)]
[llvm-reduce] Add test for BB reduction with non-void ret type.
Precommit test for D86849.
Thomas Preud'homme [Thu, 11 Jun 2020 15:14:24 +0000 (16:14 +0100)]
[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
Mehdi Amini [Sun, 30 Aug 2020 17:45:41 +0000 (17:45 +0000)]
Fix gcc warning by explicitly initializing the base class copy ctor (NFC)
Full diagnostic was:
warning: base class ‘class mlir::OptReductionBase<mlir::OptReductionPass>’ should be explicitly initialized in the copy constructor [-Wextra]
Florian Hahn [Sun, 30 Aug 2020 17:14:44 +0000 (18:14 +0100)]
[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.
Michael Park [Sun, 30 Aug 2020 16:42:35 +0000 (12:42 -0400)]
[libcxx/variant] Implement workaround for GCC bug.
A parameter pack is deemed to be uncaptured, which is bogus... but it seems to
be because it's within an expression that involves `decltype` of an uncaptured
pack or something: https://godbolt.org/z/b8z3sh
Drive-by fix for uglified name.
Differential Revision: https://reviews.llvm.org/D86827
Sanjay Patel [Sun, 30 Aug 2020 15:36:41 +0000 (11:36 -0400)]
[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
Sanjay Patel [Sun, 30 Aug 2020 14:51:28 +0000 (10:51 -0400)]
[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.
Sanjay Patel [Sun, 30 Aug 2020 12:51:17 +0000 (08:51 -0400)]
[AArch64] add tests for multi-use fast sqrt/recip; NFC
Sanjay Patel [Sun, 30 Aug 2020 12:40:27 +0000 (08:40 -0400)]
[x86] add tests for multi-use fast sqrt/recip; NFC
Sanjay Patel [Sun, 30 Aug 2020 12:32:13 +0000 (08:32 -0400)]
[SLP] make commutative check apply only to binops; NFC
As discussed in D86798, it's not clear if the caller code
works with a more liberal definition of "commutative" that
includes intrinsics like min/max. This makes the binop
restriction (current functionality is unchanged) explicit
until the code is audited/tested.
Nikita Popov [Sun, 30 Aug 2020 14:23:59 +0000 (16:23 +0200)]
[CVP] Regenerate test checks (NFC)
Anatoly Trosinenko [Sun, 30 Aug 2020 13:12:44 +0000 (16:12 +0300)]
[NFC][compiler-rt] Factor out __div[sdt]i3 and __mod[dt]i3 implementations
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D86400
Krzysztof Parzyszek [Sat, 29 Aug 2020 22:07:48 +0000 (17:07 -0500)]
[Hexagon] Fix perfect shuffle generation for single vectors
Perfect shuffle instruction (vdealvdd/vshuffvdd) work on vector
pairs. When given a single input vector, half of it first needs
to be transposed into the other vector before the generated
shuffles can take effect. Also the first transpose needs to be
undone at the end (this last step was missing).
David Green [Sun, 30 Aug 2020 11:27:51 +0000 (12:27 +0100)]
[LV] Add some const to RecurrenceDescriptor. NFC
Tyker [Sun, 30 Aug 2020 10:17:21 +0000 (12:17 +0200)]
[llvm-reduce] Function body reduction: don't forget to unset comdat
althought the interstingness test should usually fail when the module is invalid
this changes reduces the frequency at which llvm-reduce generate invalid IR.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D86404
sstefan1 [Sun, 30 Aug 2020 09:27:48 +0000 (11:27 +0200)]
Reland [OpenMPOpt] ICV tracking for calls
The problem with module slice has been addressed in D86319
Introduce two new AAs. AAICVTrackerFunctionReturned which checks if a
function can have a unique ICV value after it is finished, and
AAICVCallSiteReturned which checks AAICVTrackerFunctionReturned for a
call site. This enables us to check the value of a call and if it
changes the ICV. This also changes the approach in
`getReplacementValues()` to a worklist-based approach so we can explore
all relevant BBs.
Differential Revision: https://reviews.llvm.org/D85544
sstefan1 [Sun, 30 Aug 2020 08:29:07 +0000 (10:29 +0200)]
[Attributor] Introduce module slice.
Summary:
The module slice describes which functions we can analyze and transform
while working on an SCC as part of the Attributor-CGSCC pass. So far we
simply restricted it to the SCC.
Reviewers: jdoerfert
Differential Revision: https://reviews.llvm.org/D86319
Kamlesh Kumar [Sun, 30 Aug 2020 07:59:53 +0000 (13:29 +0530)]
Improve doc comments for several methods returning bools
Differential Revision: https://reviews.llvm.org/D86848
sstefan1 [Sun, 30 Aug 2020 07:59:25 +0000 (09:59 +0200)]
[OpenMPOpt][NFC] add reproducer for problem found in D85544
Juneyoung Lee [Sun, 30 Aug 2020 05:56:10 +0000 (14:56 +0900)]
[LangRef] Apply a missing comment from D86189
Juneyoung Lee [Wed, 19 Aug 2020 02:21:05 +0000 (11:21 +0900)]
[LangRef] State that storing an aggregate fills padding with undef
This patch makes LangRef be explicit about the value of padding when storing an aggregate.
It states that when an aggregate is stored into memory, padding is filled with undef.
Here is a clue that supports this change (edited to reflect the discussion from llvm-dev):
- IPSCCP ignores padding and directly stores a constant aggregate if possible. It loses the data stored in the padding. https://godbolt.org/z/xzenYs Memcpyopt ignores (the preexisting value of) padding when copying an aggregate or storing a constant: https://godbolt.org/z/hY6ndd / https://godbolt.org/z/3WMP5a
The two items below are not relevant with this patch because Clang lowers load/store of individual field of struct into load/stores of the corresponding pointer with a primitive type. Also, when copy is needed, it uses memcpy instead of load/store of an aggregate, as discussed in the llvm-dev. However, this patch is still valid (as discussed) because it is needed to explain the two optimizations above.
- According to C17, the value of padding bytes when storing values in structures or unions is unspecified.
- I updated Alive2 and it did not find any problematic transformation from LLVM unit tests and while running translation validation of a few C programs.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D86189
Shinji Okumura [Sun, 30 Aug 2020 04:17:02 +0000 (13:17 +0900)]
[Attributor] Fix callsite check in AAUndefinedBehavior
This is the next patch of D86842
When we check `noundef` attribute violation at callsites, we do not have to require `nonnull` in the following two cases.
1. An argument is known to be simplified to undef
2. An argument is known to be dead
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86845
Shinji Okumura [Sun, 30 Aug 2020 03:34:50 +0000 (12:34 +0900)]
[Attributor][NFC] Fix dependency type in AAUndefinedBehaviorImpl::updateImpl
This patch fixes wrong dependency type in AAUB.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86842
Fangrui Song [Sun, 30 Aug 2020 01:27:34 +0000 (18:27 -0700)]
Set alignment of .llvmbc and .llvmcmd to 1
Otherwise their alignment is dependent on the size of the section. If the size
is large than 16, the alignment will be 16.
16 is a bad choice for both .llvmbc and .llvmcmd because the padding between two
contributions from input sections is of a variable size.
A bitstream is actually guaranteed to be 4-byte aligned, but consumers don't
need this property.
Brad Smith [Sun, 30 Aug 2020 00:47:18 +0000 (20:47 -0400)]
Remove OpenBSD/sparc support
Lang Hames [Sat, 29 Aug 2020 21:05:04 +0000 (14:05 -0700)]
[ORC] Add getDFSLinkOrder / getReverseDFSLinkOrder methods to JITDylib.
DFS and Reverse-DFS linkage orders are used to order execution of
deinitializers and initializers respectively.
This patch replaces uses of special purpose DFS order functions in
MachOPlatform and LLJIT with uses of the new methods.
Louis Dionne [Sat, 29 Aug 2020 22:07:26 +0000 (18:07 -0400)]
[libc++] Temporarily force-set the LIBCXX_TEST_CONFIG cache value
This ensures that existing CMake build trees will start using the new
default without having to nuke their build directories.
Louis Dionne [Sat, 29 Aug 2020 21:13:02 +0000 (17:13 -0400)]
[libc++] Move the default site config template alongside other config files
Louis Dionne [Fri, 28 Aug 2020 21:56:24 +0000 (17:56 -0400)]
[libc++] Add from-scratch configuration files for the test suite
This commit adds the first from-scratch configuration files for running
the libc++ test suite without using the old configuration:
- libcxx-trunk-shared.cfg.py:
Runs the test suite against a trunk libc++ shared library.
- libcxx-trunk-static.cfg.py:
Runs the test suite against a trunk libc++ static library.
Differential Revision: https://reviews.llvm.org/D81866
Shinji Okumura [Sat, 29 Aug 2020 20:34:24 +0000 (05:34 +0900)]
[Attributor] Fix AANoUndef identification
Even though `noundef` IR attribute might be attached to non-void type values, AANoUndef is mistakenly identified for pointer type values only.
This patch fixes that.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86737
Nikita Popov [Sat, 29 Aug 2020 20:31:06 +0000 (22:31 +0200)]
[InstSimplify] Reduce code duplication in simplifySelectWithICmpCond (NFC)
Canonicalize icmp ne to icmp eq and implement all the folds only once.
Nikita Popov [Sat, 29 Aug 2020 08:55:55 +0000 (10:55 +0200)]
[InstSimplify] Protect against more poison in SimplifyWithOpReplaced (PR47322)
Replace the check for poison-producing instructions in
SimplifyWithOpReplaced() with the generic helper canCreatePoison()
that properly handles poisonous shifts and thus avoids the problem
from PR47322.
This additionally fixes a bug in IIQ.UseInstrInfo=false mode, which
previously could have caused this code to ignore poison flags.
Setting UseInstrInfo=false should reduce the possible optimizations,
not increase them.
This is not a full solution to the problem, as poison could be
introduced more indirectly. This is just a minimal, easy to backport
fix.
Differential Revision: https://reviews.llvm.org/D86834