Adam Czachorowski [Wed, 6 May 2020 13:46:56 +0000 (15:46 +0200)]
[clangd] Do not offer "Add using" tweak in header files.
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79488
Renato Golin [Tue, 5 May 2020 09:03:26 +0000 (10:03 +0100)]
Check type for forward reference definition
The types of forward references are checked that they match with other
uses, but they do not check they match with the definition.
func @forward_reference_type_check() -> (i8) {
br ^bb2
^bb1:
return %1 : i8
^bb2:
%1 = "bar"() : () -> (f32)
br ^bb1
}
Would be parsed and the use site of '%1' would be silently changed to
'f32'.
This commit adds a test for this case, and a check during parsing for
the types to match.
Patch by Matthew Parkinson <mattpark@microsoft.com>
Closes D79317.
David Green [Wed, 6 May 2020 13:06:02 +0000 (14:06 +0100)]
[ARM] Convert a bitcast VDUP to a VDUP
The idea, under MVE, is to introduce more bitcasts around VDUP's in an
attempt to get the type correct across basic block boundaries. In order
to do that without other regressions we need a few fixups, of which this
is the first. If the code is a bitcast of a VDUP, we can convert that
straight into a VDUP of the new type, so long as they have the same
size.
Differential Revision: https://reviews.llvm.org/D78706
Alexandre Ganea [Wed, 6 May 2020 13:11:46 +0000 (09:11 -0400)]
[Debug][CodeView] Emit fully qualified names for globals
Emit S_[L|G][THREAD32|DATA32] records with a fully qualified name (namespace + class scope).
Differential Revision: https://reviews.llvm.org/D79447
Alexandre Ganea [Tue, 5 May 2020 20:01:36 +0000 (16:01 -0400)]
[Support] Silence warning: comparison of integers of different signs: 'const int' and 'const unsigned long'
Alexandre Ganea [Mon, 4 May 2020 22:14:25 +0000 (18:14 -0400)]
[InstrProf] Silence warnings when targeting x86 with VS2019 16.5.4
Differential Revision: https://reviews.llvm.org/D79337
Alexandre Ganea [Mon, 4 May 2020 22:12:52 +0000 (18:12 -0400)]
[Sema] Silence warnings when targeting x86 with VS2019 16.5.4
Differential Revision: https://reviews.llvm.org/D79337
Nicolas Vasilache [Wed, 6 May 2020 13:05:15 +0000 (09:05 -0400)]
[mlir] Add a MemRefCastOp canonicalization pattern.
Summary:
This revision adds a conservative canonicalization pattern for MemRefCastOp that are typically inserted during ViewOp and SubViewOp canonicalization.
Ideally such canonicalizations would propagate the type to consumers but this is not a local behavior. As a consequence MemRefCastOp are introduced to keep type compatibility but need to be cleaned up later, in the case where more dynamic behavior than necessary is introduced.
Differential Revision: https://reviews.llvm.org/D79438
Simon Pilgrim [Wed, 6 May 2020 12:58:46 +0000 (13:58 +0100)]
[X86][SSE] Move VZEXT_MOVL removal into SimplifyDemandedVectorEltsForTargetNode
This patch replaces the VZEXT_MOVL removal from combineShuffle with a more general version based in SimplifyDemandedVectorEltsForTargetNode.
By using computeKnownBits we can always remove the VZEXT_MOVL if the upper elements of the source operand are known to be zero.
This requires us to add the conversion ops to computeKnownBitsForTargetNode as well.
Reviewed By: @craig.topper
Differential Revision: https://reviews.llvm.org/D79335
Simon Pilgrim [Tue, 5 May 2020 17:34:45 +0000 (18:34 +0100)]
[X86][SSE] getShuffleScalarElt - minor NFC cleanup.
Use SelectionDAG::MaxRecursionDepth instead of (equal) hard coded constant.
clang-format
David Spickett [Wed, 6 May 2020 12:19:52 +0000 (13:19 +0100)]
Reland "[CodeGen] Make logic of CCState::resultsCompatible clearer"
This relands commit
d782d1f898eaafee49548d5332e84c3ae11ebac4.
With a typo fixed, which was causing the x86 test failure.
Raphael Isemann [Wed, 6 May 2020 11:58:25 +0000 (13:58 +0200)]
[lldb][NFC] Remove some redundant comment containing just the file name
Richard Sandiford [Mon, 2 Mar 2020 18:33:12 +0000 (18:33 +0000)]
[Sema][SVE] Fix handling of initialisers for built-in SVE types
The built-in SVE types are supposed to be treated as opaque types.
This means that for initialisation purposes they should be treated
as a single unit, much like a scalar type.
However, as Eli pointed out, actually using "scalar" in the diagnostics
is likely to cause confusion, given the types are logically vectors.
The patch therefore uses custom diagnostics or generalises existing
ones. Some of the messages use the word "indivisible" to try to make
it clear(er) that these types can't be initialised elementwise.
I don't think it's possible to trigger warn_braces_around_(scalar_)init
for sizeless types as things stand, since the types can't be used as
members or elements of more complex types. But it seemed better to be
consistent with ext_many_braces_around_(scalar_)init, so the patch
changes it anyway.
Differential Revision: https://reviews.llvm.org/D76689
Kadir Cetinkaya [Wed, 6 May 2020 11:16:50 +0000 (13:16 +0200)]
Revert "[clangd] Handle PresumedLocations in IncludeCollector"
This reverts commit
4f7917c269d65cd3c85eddee19385861c4b8390c as it is
breaking windows build bots.
Denys Petrov [Wed, 6 May 2020 11:16:39 +0000 (14:16 +0300)]
[analyzer] Stability improvement for IteratorModeling
Summary:
Some function path may lead to crash.
Fixed using local variable outside the scope through a pointer.
Fixed minor misspellings.
Added regression test.
This patch covers a bug https://bugs.llvm.org/show_bug.cgi?id=41485
Reviewed By: baloghadamsoftware
Differential Revision: https://reviews.llvm.org/D78289
Dmitry Preobrazhensky [Wed, 6 May 2020 11:11:02 +0000 (14:11 +0300)]
[AMDGPU][MC][GFX9+] Enabled 21-bit signed offsets for SMEM instructions
Reviewers: arsenm, rampitec
Differential Revision: https://reviews.llvm.org/D79288
Kadir Cetinkaya [Thu, 23 Apr 2020 15:48:47 +0000 (17:48 +0200)]
[clangd] Handle PresumedLocations in IncludeCollector
Summary:
This will enable extraction of correct line locations in preamble patch
for includes.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D78740
Stefan Pintilie [Wed, 6 May 2020 10:19:09 +0000 (05:19 -0500)]
[PowerPC] Fix missing GOT indirect variant kind
The function MCSymbolRefExpr::getVariantKindForName was missing the entry for
VK_PPC_GOT_PCREL. This patch adds the missing entry.
Differential Revision: https://reviews.llvm.org/D79015
Raphael Isemann [Wed, 6 May 2020 10:21:53 +0000 (12:21 +0200)]
[lldb] Warn the user about starting the --func-regex parameter with an asterisk
Summary:
Sometimes users think that setting a function regex for all function that contain the word 'needle' in their
name looks like this: `*needle*`. However, LLDB only searches the function name and doesn't fully match
it against the regex, so the leading and trailing '*' operators don't do anything and actually just cause the
regex engine to reject the regular expression with "repetition-operator operand invalid".
This patch makes this a bit more obvious to the user by printing a warning that a leading '*' before this
regular expression here doesn't have any purpose (and will cause an error). This doesn't attempt to detect
a case where there is only a trailing '*' as that would involve parsing the regex and it seems the most
common way to end up in this situation is by doing `rbreak *needle*`.
Reviewers: JDevlieghere
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D78809
Tamás Zolnai [Wed, 6 May 2020 08:45:03 +0000 (10:45 +0200)]
[clang-tidy]: Add cert-str34-c alias for bugprone-signed-char-misuse.
Summary:
Added `DiagnoseSignedUnsignedCharComparisons` option to
filter out unrelated use cases. The SEI cert catches explicit
integer casts (two use cases), while in the case of
`signed char` \ `unsigned char` comparison, we have implicit
conversions.
Reviewers: aaron.ballman
Reviewed By: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79334
Richard Sandiford [Fri, 1 May 2020 13:26:34 +0000 (14:26 +0100)]
[Sema] Put existing warning under -Wexcess-initializers
I have a follow-on patch that uses an alternative wording for
ext_excess_initializers in some cases. This patch puts it and
a couple of related warnings under their own -W option in order
to avoid a regression in Misc/warning-flags.c.
Differential Revision: https://reviews.llvm.org/D79244
Jay Foad [Wed, 6 May 2020 10:07:45 +0000 (11:07 +0100)]
Fix misleading comments.
Haojian Wu [Wed, 6 May 2020 06:56:42 +0000 (08:56 +0200)]
[clang] Fix a crash on invalid auto.
Summary:
The crash is triggered on accessing a null InitExpr.
For group declaration, e.g. `auto c = a, &d = {a};`, what's happening:
1. each VarDecl is built separately during the parsing stage.
2. perform the semantic analysis (Sema::BuildDeclaratorGroup) to check
whether the type of the two VarDecl is the same, if not mark it as invalid.
in step 1, VarDecl c and d are built, both of them are valid (after D77395),
but d is without the InitExpr attached (under -fno-recovery-ast), crash
happens in step 2 when accessing the source range of d's InitExpr.
Reviewers: sammccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D79473
Richard Sandiford [Fri, 1 May 2020 15:14:18 +0000 (16:14 +0100)]
[docs] Regenerate DiagnosticsReference.rst
It looks like it has been a while since the checked-in version of
DiagnosticsReference.rst was regenerated. I realise there probably
isn't any expectation that the checked-in version is kept up-to-date,
but now that the project is on github and the rst can be viewed directly
from the repo's web interface, it seemed worth having something a bit
more recent.
Differential Revision: https://reviews.llvm.org/D79236
Benjamin Kramer [Wed, 6 May 2020 09:22:31 +0000 (11:22 +0200)]
Quiet some -Wdocumentation warnings.
David Spickett [Wed, 6 May 2020 09:13:20 +0000 (10:13 +0100)]
Revert "[CodeGen] Make logic of CCState::resultsCompatible clearer"
This reverts commit
d782d1f898eaafee49548d5332e84c3ae11ebac4
which caused test CodeGen/X86/sibcall.ll to fail.
Jaroslav Sevcik [Wed, 6 May 2020 08:59:32 +0000 (10:59 +0200)]
Fix error handling after [<index>] in 'frame variable'
Summary:
This fixes a bug where
frame var a[0]+5
returns the value a[0] without any warning because the current logic simply ignores everything after ']' as long as there is no '.', '-' or '[' in the rest of the string.
The fix simplifies the termination condition of the expression path parsing loop to check if have a non-empty remaining string to parse. Previously, the condition checked if a separator was found. That condition coincided with the remaining string-to-parse condition except for the buggy indexed case where non-empty string was left ("+5" in the example above), but the separator index was 'npos'.
Reviewed By: teemperor, labath
Differential Revision: https://reviews.llvm.org/D79404
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