Xing GUO [Wed, 6 May 2020 09:00:55 +0000 (17:00 +0800)]
[llvm-nm/objdump/size] Add tests for dumping symbol tables with invalid sh_size.
This change adds tests for llvm-nm, llvm-objdump and llvm-size when dumping symbol tables with invalid sh_size (sh_size % sizeof(Elf_Sym) != 0).
Reviewed By: jhenderson, MaskRay
Differential Revision: https://reviews.llvm.org/D77864
David Spickett [Wed, 6 May 2020 08:48:58 +0000 (09:48 +0100)]
[CodeGen] Make logic of CCState::resultsCompatible clearer
Paula Toth [Wed, 6 May 2020 08:21:38 +0000 (01:21 -0700)]
[libc] Change target name for testing benchmark utils infrastructure.
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: gchatelet, mgorny, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D79466
Konstantin Schwarz [Wed, 8 Apr 2020 18:04:13 +0000 (20:04 +0200)]
[GlobalISel][InlineAsm] Add support for basic output operand constraints
Reviewers: arsenm, dsanders, aemerson, volkan, t.p.northover, paquette
Reviewed By: arsenm
Subscribers: gargaroff, wdng, rovka, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78318
Dmitri Gribenko [Wed, 6 May 2020 06:50:40 +0000 (08:50 +0200)]
Fix ForRangeCopyCheck not triggering on iterators returning elements by value in C++17.
Summary:
The AST is different in C++17 in that there is no MaterializeTemporaryExpr for in the AST for a loop variable that is initialized from an iterator that returns its elements by value.
Account for this by checking that the variable is not initialized by an operator* call that returns a value type.
Reviewers: gribozavr2
Reviewed By: gribozavr2
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79440
Uday Bondhugula [Wed, 6 May 2020 06:17:16 +0000 (11:47 +0530)]
[MLIR][NFC] Fix/update debug messages for analysis utils and affine fusion
Drop trailing period in debug messages. Add an extra line for fusion
debug info.
Differential Revision: https://reviews.llvm.org/D79471
Vitaly Buka [Wed, 22 Apr 2020 02:22:00 +0000 (19:22 -0700)]
[local-bounds] Ignore volatile operations
Summary:
-fsanitize=local-bounds is very similar to ``object-size`` and
should also ignore volatile pointers.
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#volatile
Reviewers: chandlerc, rsmith
Reviewed By: rsmith
Subscribers: cfe-commits, hiraditya, llvm-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D78607
Vitaly Buka [Wed, 6 May 2020 05:42:14 +0000 (22:42 -0700)]
[lsan] Fix warnings lit config
Vitaly Buka [Wed, 6 May 2020 05:21:09 +0000 (22:21 -0700)]
[dfsan] Remove realloc from done_abilist.txt
Summary:
Currently, realloc is marked as "discard" in done_abilist.txt. As discussed in PR#45583, this is probably not the expected behavior; a custom wrapper seems to be required. Since this wrapper has not been implemented yet, realloc should not be in the done_abilist.txt file so that a warning is displayed when it is called.
Reviewers: kcc, pcc, vitalybuka
Reviewed By: vitalybuka
Subscribers: #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D78379
Craig Topper [Wed, 6 May 2020 04:16:51 +0000 (21:16 -0700)]
[X86] Add v32i16/v64i8 into the handling for 512-bit inline assembly constraints.
Jan Korous [Tue, 5 May 2020 22:42:33 +0000 (15:42 -0700)]
[libclang] Remove duplicate dependency on LLVMSupport
Differential Revision: https://reviews.llvm.org/D79451
Johannes Doerfert [Tue, 5 May 2020 20:14:36 +0000 (15:14 -0500)]
[Attributor][NFC] Cleanup some AAMemoryLocation code
This is the first step to resolve a TODO in AAMemoryLocation and to fix
a bug we have when handling `byval` arguments of `readnone` call sites.
No functional change intended.
Johannes Doerfert [Tue, 5 May 2020 16:20:08 +0000 (11:20 -0500)]
[Attributor][NFC] Minor code cleanups to minimize follow up diffs
Johannes Doerfert [Tue, 5 May 2020 16:18:03 +0000 (11:18 -0500)]
[Attributor][NFC] Avoid dependences on known information
Craig Topper [Wed, 6 May 2020 02:47:39 +0000 (19:47 -0700)]
[X86] Allow Yz inline assembly constraint to choose ymm0 or zmm0 when avx/avx512 are enabled and type is 256 or 512 bits
gcc supports selecting ymm0/zmm0 for the Yz constraint when used with 256 or 512 bit vector types.
Fixes PR45806
Differential Revision: https://reviews.llvm.org/D79448
Puyan Lotfi [Wed, 6 May 2020 03:25:13 +0000 (23:25 -0400)]
[NFC] Outliner label name clean up.
Just simplifying how the label name is generated while using
std::to_string instead of Twine.
Differential Revision: https://reviews.llvm.org/D79464
Jessica Paquette [Fri, 1 May 2020 23:57:12 +0000 (16:57 -0700)]
[AArch64][GlobalISel] Fold shifts into G_ICMP
Since G_ICMP can be selected to a SUBS, we can fold shifts into such compares.
E.g.
```
cmp w1, w0, lsl #3
cmp w1, w0, lsr #3
cmp w1, w0, asr #3
```
This is done the same way as for adds and subtracts, using
`selectShiftedRegister`.
This gives some minor code size savings on CTMark.
https://reviews.llvm.org/D79365
Wenlei He [Sat, 2 May 2020 15:34:10 +0000 (08:34 -0700)]
[llvm-profdata] Support -detailed-summary for Sample Profile
Summary: Add -detailed-summary support for sample profile dump to match that of instrumentation profile.
Reviewers: wmi, davidxl, hoyFB
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79291
Justice Adams [Tue, 5 May 2020 23:58:44 +0000 (16:58 -0700)]
Fix SelectionDAG Graph Printing on Windows
Currently, when compiling to IR (presumably at the clang level) LLVM
mangles symbols and sometimes they have illegal file characters
including `?`'s in them. This causes a problem when building a graph via
llc on Windows because the code currently passes the machine function
name all the way down to the Windows API which frequently returns error
123 **ERROR_INVALID_NAME**
https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
Thus, we need to remove those illegal characters from the machine
function name before generating a graph, which is the purpose of this
patch.
https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
I've created a static helper function replace_illegal_filename_chars
which within GraphWriter.cpp to help with replacing illegal file
character names before generating a dot graph filename.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D76863
Jonas Devlieghere [Tue, 5 May 2020 22:59:43 +0000 (15:59 -0700)]
[lldb/Utils] Serialize exit code in lldb-repro.py
After
61d5b0e66394 more shell test are expected to exit with a non-zero
status code. Because the exit status is computed in the driver and not
behind the SB API layer, reproducers don't know about it and always
return 0 unless replay failed.
This discrepancy means that these tests don't work with lldb-repro.py
and skipping them for this reason would be a pity. To solve this
problem, the script now serializes the exit code during capture and
returns that during replay.
These is an assert that ensures that replay exits with a zero exit
status to prevent replay failures from being silently ignored.
Azharuddin Mohammed [Tue, 5 May 2020 22:08:12 +0000 (15:08 -0700)]
Reapply "NFC: utils/perf-training: Python 3 compatibility for lit.cfg"
This is in response to the recent move to Python 3.
This reverts commit
5f4426e517fc26d10db2fd09f3e254e80446d62d.
Jason Molenda [Tue, 5 May 2020 22:48:46 +0000 (15:48 -0700)]
Log the NSError str and object description on app launch fail
Update CallBoardSystemServiceOpenApplication to unconditionally log
the NSError's localizedDescription to Console on app launch failure
(as it was already doing), and also to log the NSError object's
full description to the console, which may contain additional nested
error messages. I'm experimenting to find cases where we will get
more detailed information from app launch failures and will start
by logging both to the console.
<rdar://problem/
62709160>
Artem Belevich [Tue, 5 May 2020 21:55:21 +0000 (14:55 -0700)]
[CUDA] Make NVVM builtins available with CUDA-11/PTX6.5
Differential Revision: https://reviews.llvm.org/D79449
Sergej Jaskiewicz [Tue, 5 May 2020 22:10:57 +0000 (01:10 +0300)]
[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake
Now that https://reviews.llvm.org/D78200 has landed, there should be
no problem with those tests. If there is, it is OK to revert this.
Craig Topper [Tue, 5 May 2020 21:40:01 +0000 (14:40 -0700)]
[X86] Fix usage of Align constructing MachineMemOperands.
Similar to D77687, but for the X86 specific code.
Differential Revision: https://reviews.llvm.org/D79381
Sergej Jaskiewicz [Tue, 5 May 2020 22:22:55 +0000 (01:22 +0300)]
[libc++] [test] Generate static_test_env on the fly
Summary:
Instead of storing `static_test_env` (with all the symlinks) in the repo, we create it on the fly to be cross-toolchain-friendly. The primary use case for this are Windows-hosted cross-toolchains. Windows doesn't really have a concept of symlinks. So, when the monorepo is cloned, those symlinks turn to ordinary text files. Previously, if we cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and ran tests on the target system, some tests would fail. This patch makes them pass.
Reviewers: ldionne, #libc
Reviewed By: ldionne, #libc
Subscribers: EricWF, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D78200
Sergej Jaskiewicz [Tue, 5 May 2020 22:19:48 +0000 (01:19 +0300)]
Revert "[libc++] Generate symlinks in static_test_env on the fly"
This reverts commit
645ad5badbabdeca31de5c98ea8135c5a6e7d710.
This commit did not incorporate all the changes intended.
Reid Kleckner [Tue, 5 May 2020 03:03:19 +0000 (20:03 -0700)]
[Support] Move LLD's parallel algorithm wrappers to support
Essentially takes the lld/Common/Threads.h wrappers and moves them to
the llvm/Support/Paralle.h algorithm header.
The changes are:
- Remove policy parameter, since all clients use `par`.
- Rename the methods to `parallelSort` etc to match LLVM style, since
they are no longer C++17 pstl compatible.
- Move algorithms from llvm::parallel:: to llvm::, since they have
"parallel" in the name and are no longer overloads of the regular
algorithms.
- Add range overloads
- Use the sequential algorithm directly when 1 thread is requested
(skips task grouping)
- Fix the index type of parallelForEachN to size_t. Nobody in LLVM was
using any other parameter, and it made overload resolution hard for
for_each_n(par, 0, foo.size(), ...) because 0 is int, not size_t.
Remove Threads.h and update LLD for that.
This is a prerequisite for parallel public symbol processing in the PDB
library, which is in LLVM.
Reviewed By: MaskRay, aganea
Differential Revision: https://reviews.llvm.org/D79390
Christopher Tetreault [Tue, 5 May 2020 21:21:59 +0000 (14:21 -0700)]
[SVE] Fix invalid usage of getNumElements() in InstCombineMulDivRem
Summary:
getLogBase2 tries to iterate over the number of vector elements. Since
the number of elements of a scalable vector is unknown at compile time,
we must return null if the input type is scalable.
Identified by test LLVM.Transforms/InstCombine::nsw.ll
Reviewers: efriedma, fpetrogalli, kmclaughlin, spatel
Reviewed By: efriedma, fpetrogalli
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79197
Sergej Jaskiewicz [Wed, 15 Apr 2020 13:21:27 +0000 (16:21 +0300)]
[libc++] Generate symlinks in static_test_env on the fly
Instead of storing static_test_env (with all the symlinks) in the repo,
we create it on the fly to be cross-toolchain-friendly. The primary
use case for this are Windows-hosted cross-toolchains. Windows doesn't
really have a concept of symlinks. So, when the monorepo is cloned,
those symlinks turn to ordinary text files. Previously, if we
cross-compiled libc++ for some symlink-friendly system (e. g. Linux) and
ran tests on the target system, some tests would fail. This patch makes
them pass.
Differential Revision: https://reviews.llvm.org/D78200
Konrad Kleine [Tue, 5 May 2020 14:29:57 +0000 (10:29 -0400)]
[clang/clang-tools-extra] Fix BZ44437 - add_new_check.py does not work with Python 3
Summary:
This fixes https://bugs.llvm.org/show_bug.cgi?id=44437.
Thanks to Arnaud Desitter for providing the patch in the bug report!
A simple example program to reproduce this error is this:
```lang=python
import sys
with open(sys.argv[0], 'r') as f:
lines = f.readlines()
lines = iter(lines)
line = lines.next()
print(line)
```
which will error with this in python python 3:
```
Traceback (most recent call last):
File "./mytest.py", line 8, in <module>
line = lines.next()
AttributeError: 'list_iterator' object has no attribute 'next'
```
Here's the same strategy applied to my test program as applied to the `add_new_check.py` file:
```lang=python
import sys
with open(sys.argv[0], 'r') as f:
lines = f.readlines()
lines = iter(lines)
line = next(lines)
print(line)
```
The built-in function `next()` is new since Python 2.6: https://docs.python.org/2/library/functions.html#next
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79419
Artem Belevich [Tue, 5 May 2020 20:54:26 +0000 (13:54 -0700)]
Revert D77954 -- it breaks Eigen & Tensorflow.
This reverts commit
55bcb96f3154808bcb5afc3fb46d8e00bf1db847.
Jonas Devlieghere [Tue, 5 May 2020 21:06:24 +0000 (14:06 -0700)]
[lldb/Test] Update expressions.test for non-zero exit code
Updates Windows test for
61d5b0e66394.
Jan Korous [Tue, 5 May 2020 20:54:37 +0000 (13:54 -0700)]
[VFS][NFC] Fix typo in comment
Stanislav Mekhanoshin [Tue, 5 May 2020 20:52:04 +0000 (13:52 -0700)]
[AMDGPU] Added 'a' constraint documentation. NFC.
AGPR inline asm constraint was missing from the LangRef.rst.
Sean Silva [Tue, 5 May 2020 20:19:30 +0000 (13:19 -0700)]
[mlir][shape] Extract ShapeBase.td
Alina Sbirlea [Tue, 5 May 2020 00:25:14 +0000 (17:25 -0700)]
[MemorySSA] Make MemoryLocation unknown when phi translation cannot be performed.
Summary: When phi translation cannot be performed, be conservative and make the MemoryLocation unknown.
Reviewers: george.burgess.iv
Subscribers: Prazek, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79386
Siva Chandra Reddy [Tue, 5 May 2020 20:06:49 +0000 (13:06 -0700)]
[libc] Add no_sanitize("address") attribute to the getMPFRMatcher function.
This dramtically reduces the run time of tests. For example,
sincosf_test takes over 25 minutes without this attribute but only 8
seconds with this attribute.
Davide Italiano [Tue, 5 May 2020 20:13:46 +0000 (13:13 -0700)]
[TestIndirectSymbol] This tests an Apple-specific feature.
Remove a redundant check.
Davide Italiano [Tue, 5 May 2020 20:13:16 +0000 (13:13 -0700)]
[TestIndirectSymbols] This now runs and works on iOS (arm64).
Sanjay Patel [Tue, 5 May 2020 20:02:45 +0000 (16:02 -0400)]
[ValueTracking] fix CannotBeNegativeZero() to disregard 'nsz' FMF
The 'nsz' flag is different than 'nnan' or 'ninf' in that it does not create poison.
Make that explicit in the LangRef and fix ValueTracking analysis that misinterpreted
the definition.
This manifests as bugs in InstSimplify shown in the test diffs and as discussed in
PR45778:
https://bugs.llvm.org/show_bug.cgi?id=45778
Differential Revision: https://reviews.llvm.org/D79422
River Riddle [Tue, 5 May 2020 19:39:29 +0000 (12:39 -0700)]
[mlir][DenseStringElementsAttr] Fix AttributeElementIterator in the case of a splat.
River Riddle [Tue, 5 May 2020 19:39:22 +0000 (12:39 -0700)]
[mlir][DenseElementsAttr] Add support for opaque APFloat/APInt complex values.
This revision allows for creating DenseElementsAttrs and accessing elements using std::complex<APInt>/std::complex<APFloat>. This allows for opaquely accessing and transforming complex values. This is used by the printer/parser to provide pretty printing for complex values. The form for complex values matches that of std::complex, i.e.:
```
// `(` element `,` element `)`
dense<(10,10)> : tensor<complex<i64>>
```
Differential Revision: https://reviews.llvm.org/D79296
River Riddle [Tue, 5 May 2020 19:39:12 +0000 (12:39 -0700)]
[mlir][DenseElementsAttr] Add support for ComplexType elements
This revision adds support for storing ComplexType elements inside of a DenseElementsAttr. We store complex objects as an array of two elements, matching the definition of std::complex. There is no current attribute storage for ComplexType, but DenseElementsAttr provides API for access/creation using std::complex<>. Given that the internal implementation of DenseElementsAttr is already fairly opaque, the only real complexity here is in the printing/parsing. This revision keeps it simple for now and always uses hex when printing complex elements. A followup will add prettier syntax for this.
Differential Revision: https://reviews.llvm.org/D79281
Stephen Neuendorffer [Tue, 5 May 2020 19:26:48 +0000 (12:26 -0700)]
[MLIR] mlir-opt needs PUBLIC dependence
We see intermittent build errors on the windows buildbot because
mlir-opt is including Linalg headers which haven't been built yet.
This dependence should be resolved by declaring a PUBLIC dependence
on the Linalg library when building MLIROptMain.
Michael Liao [Tue, 5 May 2020 04:55:13 +0000 (00:55 -0400)]
[clang][codegen] Hoist parameter attribute setting in function prolog.
Summary:
- If the coerced type is still a pointer, it should be set with proper
parameter attributes, such as `noalias`, `nonnull`, and etc. Hoist
that (pointer) parameter attribute setting so that the coerced pointer
parameter could be marked properly.
Depends on D79394
Reviewers: rjmccall, kerbowa, yaxunl
Subscribers: jvesely, nhaehnle, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79395
Michael Liao [Tue, 5 May 2020 03:53:24 +0000 (23:53 -0400)]
[clang][codegen] Refactor argument loading in function prolog. NFC.
Summary:
- Skip copying function arguments and unnecessary casting by using them
directly.
Reviewers: rjmccall, kerbowa, yaxunl
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79394
Erik Pilkington [Tue, 5 May 2020 18:01:04 +0000 (14:01 -0400)]
[AST] Print fixed enum type regardless of language mode
These are permitted in all language modes, not just C++11.
Erik Pilkington [Tue, 5 May 2020 17:32:08 +0000 (13:32 -0400)]
[SemaObjC] Add a warning for dictionary literals with duplicate keys
Duplicate keys in a literal break NSDictionary's invariants. rdar://
50454461A
Differential revision: https://reviews.llvm.org/D78660
Lei Zhang [Tue, 5 May 2020 18:54:23 +0000 (14:54 -0400)]
[mlir] Specify CMAKE_CXX_STANDARD to standalone dialect
This addresses a compilation failure on GCC 5:
error: #error This file requires compiler and library support for the
ISO C++ 2011 standard. This support must be enabled with the -std=c++11
or -std=gnu++11 compiler options.
#error This file requires compiler and library support
Differential Revision: https://reviews.llvm.org/D79439
Christudasan Devadasan [Tue, 5 May 2020 18:40:14 +0000 (00:10 +0530)]
[AMDGPU] Fixed the test by adding the triple.
Alex Zinenko [Tue, 5 May 2020 12:09:35 +0000 (14:09 +0200)]
[mlir] Harden verifiers for DMA ops
DMA operation classes in the Standard dialect (`DmaStartOp` and `DmaWaitOp`)
provide helper functions that make numerous assumptions about the number and
order of operands, and about their types. However, these assumptions were not
checked in the verifier, leading to assertion failures or crashes when helper
functions were used on ill-formed ops. Some of the assuptions were checked in
the custom parser (and thus could not check assumption violations in ops
constructed programmatically, e.g., during rewrites) and others were not
checked at all. Introduce the verifiers for all these assumptions and drop
unnecessary checks in the parser that are now covered by the verifier.
Addresses PR45560.
Differential Revision: https://reviews.llvm.org/D79408
Tim Keith [Mon, 4 May 2020 14:25:02 +0000 (07:25 -0700)]
[flang] Fix bug in tests for standalone build
When doing a standalone build of flang against an LLVM that contains a
built flang, the tests were run on the flang from LLVM rather than on
the one that was just built.
The problem was in the lit configuration for finding %flang etc.
Fix it to look only in the directory where it was built.
Differential Revision: https://reviews.llvm.org/D79327
Momchil Velikov [Tue, 5 May 2020 17:53:52 +0000 (18:53 +0100)]
Revert "[ARM] CMSE code generation"
This reverts commit
7cbbf89d230d46c3de9a7affc29b23f08c4377a1.
The regression tests fail with the expensive checks.
David Blaikie [Tue, 5 May 2020 18:04:43 +0000 (11:04 -0700)]
Collapse variable into assert to remove non-assert unused variable
Kazu Hirata [Mon, 4 May 2020 20:49:27 +0000 (13:49 -0700)]
[Inlining] Teach shouldBeDeferred to take the total cost into account
Summary:
This patch teaches shouldBeDeferred to take into account the total
cost of inlining.
Suppose we have a call hierarchy {A1,A2,A3,...}->B->C. (Each of A1,
A2, A3, ... calls B, which in turn calls C.)
Without this patch, shouldBeDeferred essentially returns true if
TotalSecondaryCost < IC.getCost()
where TotalSecondaryCost is the total cost of inlining B into As.
This means that if B is a small wraper function, for example, it would
get inlined into all of As. In turn, C gets inlined into all of As.
In other words, shouldBeDeferred ignores the cost of inlining C into
each of As.
This patch adds an option, inline-deferral-scale, to replace the
expression above with:
TotalCost < Allowance
where
- TotalCost is TotalSecondaryCost + IC.getCost() * # of As, and
- Allowance is IC.getCost() * Scale
For now, the new option defaults to -1, disabling the new scheme.
Reviewers: davidxl
Subscribers: eraman, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79138
Jonas Devlieghere [Tue, 5 May 2020 17:58:03 +0000 (10:58 -0700)]
[lldb/Driver] Exit with a non-zero exit code in case of error in batch mode.
We have the option to stop running commands in batch mode when an error
occurs. When that happens we should exit the driver with a non-zero exit
code.
Differential revision: https://reviews.llvm.org/D78825
Nico Weber [Tue, 5 May 2020 01:15:29 +0000 (21:15 -0400)]
Let normalize() for posix style convert backslash to slash unconditionally.
Currently, normalize() for posix replaces backslashes to slashes, except
that two backslashes in sequence are kept as-is.
clang calls normalize() to convert \ to / is microsoft compat mode. This
generally works well, but a path like "c:\\foo\\bar.h" with two
backslashes doesn't work due to the exception in normalize().
These paths happen naturally on Windows hosts with e.g.
`#include __FILE__`, and them not working on other hosts makes it
more difficult to write tests for this case.
The special case has been around without justification since this code
was added in r203611 (since then moved around in r215241 r215243). No
integration tests fail if I remove it.
Try removing the special case.
Differential Revision: https://reviews.llvm.org/D79265
Andy Davis [Tue, 5 May 2020 17:29:09 +0000 (10:29 -0700)]
[MLIR][LoopOps] Adds the loop unroll transformation for loop::ForOp.
Summary:
Adds the loop unroll transformation for loop::ForOp.
Adds support for promoting the body of single-iteration loop::ForOps into its containing block.
Adds check tests for loop::ForOps with dynamic and static lower/upper bounds and step.
Care was taken to share code (where possible) with the AffineForOp unroll transformation to ease maintenance and potential future transition to a LoopLike construct on which loop transformations for different loop types can implemented.
Reviewers: ftynse, nicolasvasilache
Reviewed By: ftynse
Subscribers: bondhugula, mgorny, zzheng, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, frgossen, Kayjukh, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79184
Nico Weber [Tue, 5 May 2020 17:41:24 +0000 (13:41 -0400)]
Add a test to Support.NormalizePath.
Christudasan Devadasan [Fri, 27 Mar 2020 07:46:51 +0000 (03:46 -0400)]
[AMDGPU] Introduce more scratch registers in the ABI.
The AMDGPU target has a convention that defined all VGPRs
(execept the initial 32 argument registers) as callee-saved.
This convention is not efficient always, esp. when the callee
requiring more registers, ended up emitting a large number of
spills, even though its caller requires only a few.
This patch revises the ABI by introducing more scratch registers
that a callee can freely use.
The 256 vgpr registers now become:
32 argument registers
112 scratch registers and
112 callee saved registers.
The scratch registers and the CSRs are intermixed at regular
intervals (a split boundary of 8) to obtain a better occupancy.
Reviewers: arsenm, t-tye, rampitec, b-sumner, mjbedy, tpr
Reviewed By: arsenm, t-tye
Differential Revision: https://reviews.llvm.org/D76356
Lei Zhang [Tue, 5 May 2020 16:41:28 +0000 (12:41 -0400)]
[mlir] Add missing dependency to MLIRMlirOptMain
Differential Revision: https://reviews.llvm.org/D79429
Louis Dionne [Tue, 5 May 2020 17:13:56 +0000 (13:13 -0400)]
[libc++] Rewrite the tests for cin, cout, clog, cerr and friends
The tests were disabled with `#if 0`, most likely because there was no
way of writing shell tests when they were first written.
Siva Chandra Reddy [Fri, 1 May 2020 07:54:33 +0000 (00:54 -0700)]
[libc] Improve information printed on failure of a math test which uses MPFR.
A new test matcher class MPFRMatcher is added along with helper macros
EXPECT|ASSERT_MPFR_MATCH.
New type traits classes RemoveCV and IsFloatingPointType have been
added and used to implement the above class and its helpers.
Reviewers: abrachet, phosek
Differential Revision: https://reviews.llvm.org/D79256
Momchil Velikov [Tue, 5 May 2020 16:04:29 +0000 (17:04 +0100)]
[ARM] CMSE code generation
This patch implements the final bits of CMSE code generation:
* emit special linker symbols
* restrict parameter passing to not use memory
* emit BXNS and BLXNS instructions for returns from non-secure entry
functions, and non-secure function calls, respectively
* emit code to save/restore secure floating-point state around calls
to non-secure functions
* emit code to save/restore non-secure floating-pointy state upon
entry to non-secure entry function, and return to non-secure state
* emit code to clobber registers not used for arguments and returns
when switching to no-secure state
Patch by Momchil Velikov, Bradley Smith, Javed Absar, David Green,
possibly others.
Differential Revision: https://reviews.llvm.org/D76518
Louis Dionne [Tue, 5 May 2020 17:20:38 +0000 (13:20 -0400)]
[libc++abi] NFC: Remove pragma mark in favor of normal comment
Stanislav Mekhanoshin [Mon, 4 May 2020 19:47:23 +0000 (12:47 -0700)]
[AMDGPU] Fix FoldImmediate for 16 bit operand
Differential Revision: https://reviews.llvm.org/D79362
Hans Wennborg [Tue, 5 May 2020 13:43:54 +0000 (15:43 +0200)]
Don't assert about missing profile info in createProfileWeightsForLoop
The compiler shouldn't crash if the profile info is slightly off. We hit
this in Chromium.
Differential revision: https://reviews.llvm.org/D79417
Sid Manning [Tue, 28 Apr 2020 20:43:54 +0000 (15:43 -0500)]
[Hexagon] Add R_HEX_GD_PLT_B22/32_PCREL relocations
Extended versions of GD_PLT_B22_PCREL. These surface when -mlong-calls
is used.
Differential Revision: https://reviews.llvm.org/D79191
Sanjay Patel [Tue, 5 May 2020 16:32:15 +0000 (12:32 -0400)]
[SLP] add another bailout for load-combine patterns
This builds on the or-reduction bailout that was added with D67841.
We still do not have IR-level load combining, although that could
be a target-specific enhancement for -vector-combiner.
The heuristic is narrowly defined to catch the motivating case from
PR39538:
https://bugs.llvm.org/show_bug.cgi?id=39538
...while preserving existing functionality.
That is, there's an unmodified test of pure load/zext/store that is
not seen in this patch at llvm/test/Transforms/SLPVectorizer/X86/cast.ll.
That's the reason for the logic difference to require the 'or'
instructions. The chances that vectorization would actually help a
memory-bound sequence like that seem small, but it looks nicer with:
vpmovzxwd (%rsi), %xmm0
vmovdqu %xmm0, (%rdi)
rather than:
movzwl (%rsi), %eax
movl %eax, (%rdi)
...
In the motivating test, we avoid creating a vector mess that is
unrecoverable in the backend, and SDAG forms the expected bswap
instructions after load combining:
movzbl (%rdi), %eax
vmovd %eax, %xmm0
movzbl 1(%rdi), %eax
vmovd %eax, %xmm1
movzbl 2(%rdi), %eax
vpinsrb $4, 4(%rdi), %xmm0, %xmm0
vpinsrb $8, 8(%rdi), %xmm0, %xmm0
vpinsrb $12, 12(%rdi), %xmm0, %xmm0
vmovd %eax, %xmm2
movzbl 3(%rdi), %eax
vpinsrb $1, 5(%rdi), %xmm1, %xmm1
vpinsrb $2, 9(%rdi), %xmm1, %xmm1
vpinsrb $3, 13(%rdi), %xmm1, %xmm1
vpslld $24, %xmm0, %xmm0
vpmovzxbd %xmm1, %xmm1 # xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero
vpslld $16, %xmm1, %xmm1
vpor %xmm0, %xmm1, %xmm0
vpinsrb $1, 6(%rdi), %xmm2, %xmm1
vmovd %eax, %xmm2
vpinsrb $2, 10(%rdi), %xmm1, %xmm1
vpinsrb $3, 14(%rdi), %xmm1, %xmm1
vpinsrb $1, 7(%rdi), %xmm2, %xmm2
vpinsrb $2, 11(%rdi), %xmm2, %xmm2
vpmovzxbd %xmm1, %xmm1 # xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero
vpinsrb $3, 15(%rdi), %xmm2, %xmm2
vpslld $8, %xmm1, %xmm1
vpmovzxbd %xmm2, %xmm2 # xmm2 = xmm2[0],zero,zero,zero,xmm2[1],zero,zero,zero,xmm2[2],zero,zero,zero,xmm2[3],zero,zero,zero
vpor %xmm2, %xmm1, %xmm1
vpor %xmm1, %xmm0, %xmm0
vmovdqu %xmm0, (%rsi)
movl (%rdi), %eax
movl 4(%rdi), %ecx
movl 8(%rdi), %edx
movbel %eax, (%rsi)
movbel %ecx, 4(%rsi)
movl 12(%rdi), %ecx
movbel %edx, 8(%rsi)
movbel %ecx, 12(%rsi)
Differential Revision: https://reviews.llvm.org/D78997
Pete Steinfeld [Fri, 1 May 2020 20:00:28 +0000 (13:00 -0700)]
[flang] New implementation for checks for constraints C741 through C750
Summary:
Most of these checks were already implemented, and I just added references to
them to the code and tests. Also, much of this code was already
reviewed in the old flang/f18 GitHub repository, but I didn't get to
merge it before we switched repositories.
I implemented the check for C747 to not allow coarray components in derived
types that are of type C_PTR, C_FUNPTR, or type TEAM_TYPE.
I implemented the check for C748 that requires a data component whose type has
a coarray ultimate component to be a nonpointer, nonallocatable scalar and not
be a coarray.
I implemented the check for C750 that adds additional restrictions to the
bounds expressions of a derived type component that's an array.
These bounds expressions are sepcification expressions as defined in
10.1.11. There was already code in lib/Evaluate/check-expression.cpp to
check semantics for specification expressions, but it did not check for
the extra requirements of C750.
C750 prohibits specification functions, the intrinsic functions
ALLOCATED, ASSOCIATED, EXTENDS_TYPE_OF, PRESENT, and SAME_TYPE_AS. It
also requires every specification inquiry reference to be a constant
expression, and requires that the value of the bound not depend on the
value of a variable.
To implement these additional checks, I added code to the intrinsic proc
table to get the intrinsic class of a procedure. I also added an
enumeration to distinguish between specification expressions for
derived type component bounds versus for type parameters. I then
changed the code to pass an enumeration value to
"CheckSpecificationExpr()" to indicate that the expression was a bounds
expression and used this value to determine whether to emit an error
message when violations of C750 are found.
I changed the implementation of IsPureProcedure() to handle statement
functions and changed some references in the code that tested for the
PURE attribute to call IsPureProcedure().
I also fixed some unrelated tests that got new errors when I implemented these
new checks.
Reviewers: tskeith, DavidTruby, sscalpone
Subscribers: jfb, llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D79263
Francesco Petrogalli [Mon, 27 Apr 2020 22:11:43 +0000 (22:11 +0000)]
[clang][OpenMP] Fix getNDSWDS for aarch64.
Summary:
This change fixes an aarch64-specific bug in the generation of the NDS and WDS values used to compute the signature of the vector functions out of OpenMP directives like `declare simd`. When the directive is used in conjunction with the `linear` clause, the size of the pointee must be used instead of the size of the pointer to compute NDS and WDS.
The code-fix is strictly related to the behavior for `linear`, but given that the only way we have to test the NDS and WDS values is to check the resulting `<vlen>` token in the mangled name of the vector function, the tests have been extended to cover all the possible values of WDS and NDS as defined in the ABI at https://github.com/ARM-software/abi-aa/tree/master/vfabia64.
Reviewers: ABataev, jdoerfert, andwar
Reviewed By: jdoerfert
Subscribers: yaxunl, kristof.beyls, guansong, danielkiss, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78969
Stephen Neuendorffer [Wed, 22 Apr 2020 17:52:07 +0000 (10:52 -0700)]
[MLIR] Add a tests for out of tree dialect example.
This attempts to ensure that out of tree usage remains stable.
Differential Revision: https://reviews.llvm.org/D78656
Vedant Kumar [Tue, 5 May 2020 16:17:55 +0000 (09:17 -0700)]
[lldb/unittest] Avoid relying on compiler character encoding in unicode test
This is a speculative fix for a unit test failure on a Win/MSVC2017 bot
(http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/16106/steps/test/logs/stdio).
Jinsong Ji [Tue, 5 May 2020 14:27:59 +0000 (14:27 +0000)]
[MachinePipeliner] Add ORE for MachinePipeliner
This patch adds ORE for MachinePipeliner, so that people can anaylyze
their code using opt-viewer or other tools, then optimize the code to
catch more piplining opportunities.
Reviewed By: bcahoon
Differential Revision: https://reviews.llvm.org/D79368
Simon Pilgrim [Tue, 5 May 2020 15:57:55 +0000 (16:57 +0100)]
[TTI] getScalarizationOverhead - use explicit VectorType operand
getScalarizationOverhead is only ever called with vectors (and we already had a load of cast<VectorType> calls immediately inside the functions).
Followup to D78357
Reviewed By: @samparker
Differential Revision: https://reviews.llvm.org/D79341
Stephen Neuendorffer [Tue, 5 May 2020 15:54:03 +0000 (08:54 -0700)]
[MLIR] GPUToCUDA conversion: MC is only needed if NVPTX is enabled.
This patch conditionally links with MC
Stephen Neuendorffer [Mon, 4 May 2020 21:49:53 +0000 (14:49 -0700)]
[flang] update tools/f18 to use LLVM_LINK_COMPONENTS.
This will prevent conflicts with libLLVM.so when using LLVM_LINK_LLVM_DYLIB=on.
Differential Revision: https://reviews.llvm.org/D79370
Pengxuan Zheng [Thu, 23 Apr 2020 22:07:03 +0000 (15:07 -0700)]
[RISCV] Update debug scratch register names
Summary:
The RISC-V debug register was named dscratch in a previous draft of the RISC-V
debug mode spec. The number of registers has been increased to 2 in the latest
ratified version of the debug mode spec and the registers were named dscratch0
and dscratch1. We still support using the old register name "dscratch", but it
would be disassembled as "dscratch0" with this change.
Reviewers: apazos, asb, lenary, luismarques
Reviewed By: asb
Subscribers: hiraditya, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, sameer.abuasal, evandro, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D78764
Fangrui Song [Mon, 4 May 2020 16:40:47 +0000 (09:40 -0700)]
[llvm-objcopy][ELF] Allow --dump-section to dump an empty non-SHT_NOBITS section
This is the ELF part of D75949.
GNU objcopy from binutils 2.35 onwards will support an empty non-SHT_NOBITS section as
well
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
e052e2ba295a65b6ea80cbc3f90495beca299c42
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D79339
Fangrui Song [Tue, 5 May 2020 15:16:10 +0000 (08:16 -0700)]
[llvm-objcopy][test] ELF/dump-section.test: change #CHECK to # CHECK
The latter is more common and thus the preferred way to use CHECK lines.
Arthur Eubanks [Mon, 4 May 2020 17:37:38 +0000 (10:37 -0700)]
Remove unnecessary check for inalloca in IPConstantPropagation
Summary:
This was added in https://reviews.llvm.org/D2449, but I'm not sure it's
necessary since an inalloca value is never a Constant (should be an
AllocaInst).
Reviewers: hans, rnk
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79350
Jay Foad [Tue, 5 May 2020 12:32:59 +0000 (13:32 +0100)]
[InstCombine] Allow denormal C in pow(C,y) -> exp2(log2(C)*y)
We check that C is finite and strictly positive, but there's no need to
check that it's normal too. exp2 should be just as accurate on denormals
as pow is.
Differential Revision: https://reviews.llvm.org/D79413
Fangrui Song [Mon, 4 May 2020 16:45:41 +0000 (09:45 -0700)]
[Support] Allow FileOutputBuffer::create to create an empty file
Size==0 triggers `assert(Size != 0)` in mapped_file_region::init.
I plan to use an empty file in D79339 (llvm-objcopy --dump-section).
According to POSIX, "If len is zero, mmap() shall fail and no mapping
shall be established." Just specialize case Size=0 to use
createInMemoryBuffer.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D79338
Jay Foad [Tue, 5 May 2020 12:28:14 +0000 (13:28 +0100)]
Precommit new test cases for D79413 [InstCombine] Allow denormal C in pow(C,y) -> exp2(log2(C)*y)
David Green [Tue, 5 May 2020 06:15:21 +0000 (07:15 +0100)]
[LSR] Don't require register reuse under postinc
LSR has some logic that tries to aggressively reuse registers in
formula. This can lead to sub-optimal decision in complex loops where
the backend it trying to use shouldFavorPostInc. This disables the
re-use in those situations.
Differential Revision: https://reviews.llvm.org/D79301
Jay Foad [Mon, 4 May 2020 16:41:08 +0000 (17:41 +0100)]
[AMDGPU] Better support for VMEM soft clauses in GCNHazardRecognizer
VMEM soft clauses only contain VMEM and FLAT instructions. Teaching
GCNHazardRecognizer::checkSoftClauseHazards that other kinds of
instructions will naturally break the clause means there are far fewer
cases where it has to insert an s_nop instruction to forcibly break the
clause.
Differential Revision: https://reviews.llvm.org/D79353
Yitzhak Mandelbaum [Tue, 5 May 2020 00:00:41 +0000 (20:00 -0400)]
[clang-tidy] In TransformerClangTidyCheck, support option IncludeStyle.
Summary:
The new option allows the user to specify which file naming convention is used
by the source code ('llvm' or 'google').
Reviewers: gribozavr2
Subscribers: xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79380
Sam Parker [Tue, 5 May 2020 14:28:40 +0000 (15:28 +0100)]
[NFC] Update tests
Run the update script on a couple of tests.
Louis Dionne [Tue, 5 May 2020 13:53:16 +0000 (09:53 -0400)]
[libc++] Remove unused functions and minor features of the test suite
This commit removes minor features of the test suite that I've never
seen used and that are basically just a maintenance burden:
- color_diagnostics: Diagnostics are colored by default when running
from a terminal, and not colored otherwise. This is the right behavior.
Being able to tweak this has minor value, and could be achieved by
modifying the %{compile_flags} instead if absolutely needed.
- ccache: This can be achieved by using a wrapper for the %{cxx}
substitution.
- _dump_macros_verbose is just a dead function now.
Ehsan Toosi [Tue, 28 Apr 2020 12:44:21 +0000 (14:44 +0200)]
[MLIR][LINALG] Convert Linalg on Tensors to Buffers
This is a basic pass to convert Linalg.GenericOp which works on tensors to use
buffers instead.
Differential Revision: https://reviews.llvm.org/D78996
Jay Foad [Tue, 5 May 2020 10:35:23 +0000 (11:35 +0100)]
[InstCombine] Remove hasOneUse check for pow(C,x) -> exp2(log2(C)*x)
I don't think there's any good reason not to do this transformation when
the pow has multiple uses.
Differential Revision: https://reviews.llvm.org/D79407
Louis Dionne [Tue, 5 May 2020 13:43:54 +0000 (09:43 -0400)]
[libc++] Allow <__config_site> not being included
Otherwise, we can't test other standard libraries.
Matt Arsenault [Tue, 28 Apr 2020 01:44:46 +0000 (21:44 -0400)]
Elaborate more on --rocm-path flag.
I'm not sure what the conventions are for this documentation. The
format seems limiting. I don't see how to refer to other flags, or
mark flags as deprecated. The rst I believe these generate seems to be
in source, and out of date.
Louis Dionne [Mon, 4 May 2020 21:05:21 +0000 (17:05 -0400)]
[libc++] Move parsing of <__config_site> macros to the DSL
Raphael Isemann [Tue, 5 May 2020 13:23:34 +0000 (15:23 +0200)]
Revert "[lldb][cmake] Also use local submodule visibility on Darwin"
This reverts commit
8baa0b9439b5788bc5a0a2ee45dfda01b7a5a43f. This broke the
LLDB Green Dragon bot where htonl is getting miscompiled on macOS 10.14 and 10.15
SDKs, causing networking tests to fail as IP addressed were being inverted
(e.g., 127.0.0.1 became 1.0.0.127 with an enabled modules build).
Reverting until this is fixed.
Jonathan Coe [Tue, 5 May 2020 13:05:00 +0000 (14:05 +0100)]
[clang-format] C# always regards && as a binary operator
Reviewers: krasimir, MyDeveloperDay
Reviewed By: MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang-format, #clang
Differential Revision: https://reviews.llvm.org/D79414
Sebastian Neubauer [Tue, 17 Mar 2020 12:14:24 +0000 (13:14 +0100)]
[AMDGPU] Don't mark the .note section as ALLOC
Marking a section as ALLOC tells the ELF loader to load the section into memory.
As we do not want to load the notes into VRAM, the flag should not be there.
On AMDHSA, .note is still marked as ALLOC, apparently this is currently
needed for OpenCL (see https://reviews.llvm.org/D74995).
Differential Revision: https://reviews.llvm.org/D76278
Sander de Smalen [Tue, 5 May 2020 12:15:19 +0000 (13:15 +0100)]
[AArch64][SVE] Guard bitcast patterns under IsLE predicate
Reviewed By: efriedma
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79352
David Green [Tue, 5 May 2020 10:27:12 +0000 (11:27 +0100)]
[ARM] Correct the type on a predicate cast
A PREDICATE_CAST(PREDICATE_CAST(X)) can be converted to a
PREDICATE_CAST(X) as the operation can convert between any forms of
predicates (v4i1/v8i1/v16i1/i32). Unfortunately I got the type wrong on
one of the rarer converts, which would lead to invalid nodes during
isel. This fixes it up to use the correct type.
Differential Revision: https://reviews.llvm.org/D79402