Guillaume Chatelet [Tue, 30 Jun 2020 14:46:56 +0000 (14:46 +0000)]
[NFC] Remove dead code
Differential Revision: https://reviews.llvm.org/D81195
Ulrich Weigand [Tue, 30 Jun 2020 14:29:25 +0000 (16:29 +0200)]
[SystemZ] Simplify knownbits.ll test
The knownbits.ll test case is somewhat fragile since:
- it relies on undef inputs; and
- it operates just at the limits of the MaxRecursionDepth
This means that optimization changes may easily cause the test
to spuriously fail. Rewrite the test so it still validates
the same thing, but in a less fragile manner.
Haojian Wu [Tue, 30 Jun 2020 14:13:20 +0000 (16:13 +0200)]
[AST][RecoveryExpr] Avoid spurious 'missing typename' diagnostic when the NNS contains errors.
Differential Revision: https://reviews.llvm.org/D82631
Louis Dionne [Tue, 30 Jun 2020 14:10:30 +0000 (10:10 -0400)]
[runtimes] Rename newformat to just format, now that the old format has been removed
Louis Dionne [Tue, 30 Jun 2020 14:03:28 +0000 (10:03 -0400)]
[libc++] Remove dead code since the removal of the old testing format
Xing GUO [Tue, 30 Jun 2020 13:14:28 +0000 (21:14 +0800)]
[DWARFYAML][MachO] Remove endianness related tests.
fe08ab542bd6328a7906e38ae473cf655eb6a228 makes build bots unhappy
(http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/33624/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3ADWARF-debug_info.yaml).
This patch removes failed tests.
Haojian Wu [Tue, 30 Jun 2020 13:42:03 +0000 (15:42 +0200)]
[ASTMatcher] Fix a performance regression: memorize the child match.
D80025 introduced a performance regression: in some cases, it makes
clang-tidy readability-container-size-empty ~80x slower (running on an internal
huge TU, before that patch 12s vs after 950s).
after this patch, we go back to 12s.
Differential Revision: https://reviews.llvm.org/D82771
Pavel Labath [Mon, 29 Jun 2020 11:51:46 +0000 (13:51 +0200)]
[lldb/Test] Introduce "assertSuccess"
Summary:
A lot of our tests do 'self.assertTrue(error.Success()'. The problem
with that is that when this fails, it produces a completely useless
error message (False is not True) and the most important piece of
information -- the actual error message -- is completely hidden.
Sometimes we mitigate that by including the error message in the "msg"
argument, but this has two additional problems:
- as the msg argument is evaluated unconditionally, one needs to be
careful to not trigger an exception when the operation was actually
successful.
- it requires more typing, which means we often don't do it
assertSuccess solves these problems by taking the entire SBError object
as an argument. If the operation was unsuccessful, it can format a
reasonable error message itself. The function still accepts a "msg"
argument, which can include any additional context, but this context now
does not need to include the error message.
To demonstrate usage, I replace a number of existing assertTrue
assertions with the new function. As this process is not easily
automatable, I have just manually updated a representative sample. In
some cases, I did not update the code to use assertSuccess, but I went
for even higher-level assertion apis (runCmd, expect_expr), as these are
even shorter, and can produce even better failure messages.
Reviewers: teemperor, JDevlieghere
Subscribers: arphaman, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D82759
Simon Pilgrim [Tue, 30 Jun 2020 13:09:23 +0000 (14:09 +0100)]
[X86][SSE] LowerVectorAllZero - add support for masked OR-reductions
If we're masking the result of an OR-reduction before comparing against zero, we can fold this into the PTEST() / MOVMSK(CMPEQ()) codegen by pre-masking the source value.
This works particularly well on PTEST which performs the AND as part of its operation, but the MOVMSK variant also benefits for non-V2I64 cases.
Fixes PR44781
serge-sans-paille [Tue, 30 Jun 2020 12:11:28 +0000 (14:11 +0200)]
Make it possible for client code to consume CLANG_LINK_CLANG_DYLIB
If a client code wants to consume clang libraries, it needs to know
CLANG_LINK_CLANG_DYLIB value in order to decide whether to use the DYLIB or
individual components.
Differential Revision: https://reviews.llvm.org/D82291
Guillaume Chatelet [Tue, 30 Jun 2020 13:12:31 +0000 (13:12 +0000)]
[Alignment][NFC] Migrate SelectionDAGTargetInfo::EmitTargetCodeForMemcpy to Align
This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Differential Revision: https://reviews.llvm.org/D82849
Sam McCall [Mon, 29 Jun 2020 17:52:09 +0000 (19:52 +0200)]
[clangd] Suppress GCC -Woverloaded-virtual by renaming ThreadsafeFS extension point
Summary:
By making all overloads non-virtual and delegating to a differently-named
private method, we avoid any (harmless) name-hiding in the subclasses.
Reviewers: kadircet
Subscribers: kristof.beyls, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits, Quuxplusone, dblaikie
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82793
Guillaume Chatelet [Tue, 30 Jun 2020 12:46:59 +0000 (12:46 +0000)]
[Alignment][NFC] Migrate SelectionDAGTargetInfo::EmitTargetCodeForMemmove to Align
This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Differential Revision: https://reviews.llvm.org/D82850
Guillaume Chatelet [Tue, 30 Jun 2020 12:46:05 +0000 (12:46 +0000)]
[Alignment][NFC] Migrate SelectionDAGTargetInfo::EmitTargetCodeForMemset to Align
This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Differential Revision: https://reviews.llvm.org/D82851
Sam Parker [Tue, 30 Jun 2020 12:26:59 +0000 (13:26 +0100)]
[NFC][ARM] Tail predication reduction tests
dfukalov [Mon, 29 Jun 2020 00:43:26 +0000 (03:43 +0300)]
[PM] Fix new PM to perform SpeculativeExecution as in old PM
Summary:
Old PM runs SpeculativeExecutionPass for targets that have divergent branches.
It uses `createSpeculativeExecutionIfHasBranchDivergencePass` that creates
the pass with `OnlyIfDivergentTarget=true`, whereas new PM just created the
pass with default `OnlyIfDivergentTarget=fase` so it unexpectedly runs and
causes buildbot test fails.
Reviewers: chandlerc, arsenm
Reviewed By: arsenm
Subscribers: wdng, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82735
Raphael Isemann [Tue, 30 Jun 2020 12:05:10 +0000 (14:05 +0200)]
[lldb] Fix TestModuleGetXcodeSDK test after DWARFYAML change
D82622 /
fe08ab542bd6328a7906e38ae473cf655eb6a228 changes the YAML format
so this test was failing as the test yaml wasn't updated.
Simon Pilgrim [Tue, 30 Jun 2020 11:37:55 +0000 (12:37 +0100)]
[X86] Add tests for cmp-zero + and/trunc + or-reduction patterns
Expanding off the original PR44781 test case, show the failure to fold cmp-all-zero patterns when a demanded bits limiting and/trunc is in the way.
Gongyu Deng [Tue, 30 Jun 2020 11:14:46 +0000 (13:14 +0200)]
[lldb] Tab completion for `frame recognizer delete`
Summary: Provided tab completion for command `frame recognizer delete`.
Reviewers: teemperor, JDevlieghere
Reviewed By: teemperor, JDevlieghere
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D81241
Bevin Hansson [Tue, 30 Jun 2020 11:35:29 +0000 (13:35 +0200)]
[AST] Fix handling of some edge cases in fixed-point division.
Division by zero was not being handled, and division of
-EPSILON / MAX did not perform rounding correctly.
Gongyu Deng [Tue, 30 Jun 2020 11:02:18 +0000 (13:02 +0200)]
[lldb] Tab completion for `frame select`
Summary: Provided the tab completion for command `frame select`.
Reviewers: teemperor, JDevlieghere
Reviewed By: teemperor
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D81177
Raphael Isemann [Tue, 30 Jun 2020 10:06:04 +0000 (12:06 +0200)]
[lldb][NFC] Remove ImportInProgress lock in ClangASTSource
Summary:
The ClangASTSource has a lock that globally disables all lookups into the
external AST source when we explicitly "guarded" copy a type. It's not used for
anything else, so importing declarations or importing types that are
dependencies of a declaration actually won't activate that lock. The lookups it
is supposed to prevent also don't actually happen in our test suite. The check
in `ClangExpressionDeclMap::FindExternalVisibleDecls` is never executed and the
check in the `ClangASTSource::FindExternalVisibleDeclsByName` is only ever
reached by the `Import-std-module` tests (which explicitly do a lookup into the
expression context on purpose).
This lock was added in
6abfabff6158076eccdf6fcac5a12894039de2c9 as a replacement
for a list of types we already looked up which appeared to be an optimisation
strategy. I assume back then this lock had a purpose but these days the
ASTImporter and LLDB seem to be smart enough to avoid whatever lookups this
tried to prevent.
I would say we remove it from LLDB. The main reason is that it blocks D81561
(which explicitly does a specific lookup to resolve placeholder types produced
by `-flimit-debug-info`) but it's semantics are also very confusing. The naming
implies it's a flag to indicate when we import something at the moment which is
practically never true as described above. Also the fact that it makes our
ExternalASTSource alternate between doing lookups into the debug info and
pretending it doesn't know any external decls could really break our lookup in
some weird way if Clang decides to cache a fake empty lookup result that was
generated while the lock was active.
Reviewers: labath, shafik, JDevlieghere, aprantl
Reviewed By: labath, JDevlieghere, aprantl
Subscribers: aprantl, abidh
Differential Revision: https://reviews.llvm.org/D81749
Ilya Leoshkevich [Tue, 30 Jun 2020 10:44:30 +0000 (12:44 +0200)]
[SystemZ] Add NoMerge MIFlag
Summary:
This fixes ASan and MSan tests on SystemZ after
commit
6a822e20ce70 ("[ASan][MSan] Remove EmptyAsm and set the CallInst
to nomerge to avoid from merging.").
Based on commit
80e107ccd088 ("Add NoMerge MIFlag to avoid MIR branch
folding").
Reviewers: uweigand, jonpa
Reviewed By: uweigand
Subscribers: hiraditya, llvm-commits, Andreas-Krebbel
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82794
Balazs Benics [Tue, 30 Jun 2020 10:26:50 +0000 (12:26 +0200)]
[llvm][Z3][NFC] Improve mkBitvector performance
We convert `APSInt`s to Z3 Bitvectors in an inefficient way for most cases.
We should not serialize to std::string just to pass an int64 integer.
For the vast majority of cases, we use at most 64-bit width integers (at least
in the Clang Static Analyzer). We should simply call the `Z3_mk_unsigned_int64`
and `Z3_mk_int64` instead of the `Z3_mk_numeral` as stated in the Z3 docs.
Which says:
> It (`Z3_mk_unsigned_int64`, etc.) is slightly faster than `Z3_mk_numeral` since
> it is not necessary to parse a string.
If the `APSInt` is wider than 64 bits, we will use the `Z3_mk_numeral` with a
`SmallString` instead of a heap-allocated `std::string`.
Differential Revision: https://reviews.llvm.org/D78453
lh123 [Sun, 28 Jun 2020 12:32:26 +0000 (20:32 +0800)]
[clangd] Remove redundant `findRefs` calls. NFC.
Summary:
Remove redundant `findRefs` calls.
Reviewers: sammccall, kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82714
Marcel Koester [Tue, 30 Jun 2020 09:58:45 +0000 (11:58 +0200)]
[mlir] Extended BufferPlacement to support nested region control flow.
Summary: The current BufferPlacement implementation does not support
nested region control flow. This CL adds support for nested regions via
the RegionBranchOpInterface and the detection of branch-like
(ReturnLike) terminators inside nested regions.
Differential Revision: https://reviews.llvm.org/D81926
Haojian Wu [Thu, 25 Jun 2020 08:13:48 +0000 (10:13 +0200)]
[AST][RecoveryExpr] Add error-bit to NestNameSpecifierDependence and TemplateNameDependence.
Summary:
We might lose the error-bit if the error-bit goes through the code path
"error type/expr" -> "error template argument" -> "nested name specifier" ->
... -> "template Specialization type"
Template name also needs this, as a template can be nested into
an error specifier, e.g. templateName apply in
`TC<decltype(<recovery-expr>(Foo, int()))>::template apply`
Reviewers: sammccall
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82526
Guillaume Chatelet [Tue, 30 Jun 2020 09:54:45 +0000 (09:54 +0000)]
[Alignment][NFC] Migrate AtomicExpandPass to Align
This is a followup on D78403.
I'm unsure about `getAtomicOpAlign` overloads that take `AtomicRMWInst` and `AtomicCmpXchgInst`, shouldn't `getAlign` provide the correct answer already?
Differential Revision: https://reviews.llvm.org/D81369
Raphael Isemann [Mon, 29 Jun 2020 13:48:32 +0000 (15:48 +0200)]
[lldb] Modernize TestOperatorOverload.py asserts
sstefan1 [Tue, 30 Jun 2020 09:04:54 +0000 (11:04 +0200)]
[IR] NoFree IntrinsicProperty.
Summary:
Separate introduction of IntrNoFree property as suggested in D70365
Reviewers: arsenm, nhaehnle
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82587
Georgii Rymar [Tue, 23 Jun 2020 08:16:19 +0000 (11:16 +0300)]
[yaml2obj] - Support reading a content as an array of bytes using the new 'ContentArray' key.
It implements the way to describe a section content using a multi line description. E.g:
```
- Name: .foo
Type: SHT_PROGBITS
ContentArray: [ 0x11, 0x22, 0x33, 0x44, ## .long
11223344
0x55, 0x66, ## .short 5566.
0x77, ## .byte 0x77
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00 ] ## .quad 0x8899aabbccddeeff
```
It was briefly discussed in D75123 thread previously.
Differential revision: https://reviews.llvm.org/D82366
Georgii Rymar [Wed, 24 Jun 2020 12:18:53 +0000 (15:18 +0300)]
[yaml2obj] - Add a way to set default values for macros used in a YAML.
Currently we have to override all macros that are declared. But in many
cases it is convenient to use default values and to override only
a particular one or two.
This provides a way to set a default value for any macro:
```
Symbols:
- Name: [[FOO=foo]]
```
Differential revision: https://reviews.llvm.org/D82455
Petar Avramovic [Tue, 30 Jun 2020 08:57:41 +0000 (10:57 +0200)]
AMDGPU/GlobalISel: Select icmp intrinsic
Select into corresponding V_CMP instruction based on CmpInst predicate,
stored as immediate, in last operand.
Differential Revision: https://reviews.llvm.org/D82652
Petar Avramovic [Tue, 30 Jun 2020 08:49:05 +0000 (10:49 +0200)]
[GlobalISel][InlineAsm] Add support for matching input constraints
Find def operand that corresponds to matching constraint and
tie input to that operand.
Differential Revision: https://reviews.llvm.org/D82651
Marius Brehler [Tue, 30 Jun 2020 08:46:32 +0000 (01:46 -0700)]
[mlir] Fix case in MLIRGPUtoVulkanTransforms
This changes the casing of MLIRGPUtoVulkanTransforms to be consistent
with other transform libraries.
Differential Revision: https://reviews.llvm.org/D82840
Simon Tatham [Tue, 30 Jun 2020 08:28:41 +0000 (09:28 +0100)]
Revert "Fix missing build dependency on omp_gen."
This reverts commit
ed4328c607306a2aa6df4833a0dce4482edbc94c.
My change apparently caused a buildbot to fail with the error
CMake Error at /b/sanitizer-x86_64-linux-autoconf/build/tsan_release_build/lib/cmake/llvm/AddLLVM.cmake:869 (add_dependencies):
The dependency target "omp_gen" of target "ScudoBenchmarks.x86_64" does not
exist.
I don't at all understand why, because as far as I can see, the target
`omp_gen` is only added to `LLVM_COMMON_DEPENDS` after having been
created, so there //should// be no way it can end up on anything's
dependency list if it doesn't exist! But apparently it happened anyway.
Differential Revision: https://reviews.llvm.org/D82659
Frederik Gossen [Tue, 30 Jun 2020 08:33:49 +0000 (08:33 +0000)]
[MLIR][Shape] Fix lowering of `shape.get_extent`
The declarative conversion patterns caused crashes in the asan configuration.
The non-declarative implementation circumvents this.
Differential Revision: https://reviews.llvm.org/D82797
Xing GUO [Tue, 30 Jun 2020 07:07:45 +0000 (15:07 +0800)]
[DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.
'InitialLength' is replaced with 'Format' (DWARF32 by default) and 'Length' in this patch.
Besides, test cases for DWARFv4 and DWARFv5, DWARF32 and DWARF64 is
added.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D82622
Nathan James [Tue, 30 Jun 2020 08:17:48 +0000 (09:17 +0100)]
[clang-tidy][docs] Fix malformed link in ReleaseNotes
Guillaume Chatelet [Tue, 30 Jun 2020 08:16:59 +0000 (08:16 +0000)]
[Alignment][NFC] TargetLowering::allowsMemoryAccess
Second patch of a series to adapt TargetLowering::allowsXXX functions
This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Differential Revision: https://reviews.llvm.org/D82785
Guillaume Chatelet [Tue, 30 Jun 2020 08:08:45 +0000 (08:08 +0000)]
[Alignment][NFC] Migrate PPC, X86 and XCore backends to Align
This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Differential Revision: https://reviews.llvm.org/D82779
Anatoly Trosinenko [Tue, 30 Jun 2020 08:06:52 +0000 (11:06 +0300)]
[builtins] Change si_int to int in some helper declarations
This patch changes types of some integer function arguments or return values from `si_int` to the default `int` type to make it more compatible with `libgcc`.
The compiler-rt/lib/builtins/README.txt has a link to the [libgcc specification](http://gcc.gnu.org/onlinedocs/gccint/Libgcc.html#Libgcc). This specification has an explicit note on `int`, `float` and other such types being just illustrations in some cases while the actual types are expressed with machine modes.
Such usage of always-32-bit-wide integer type may lead to issues on 16-bit platforms such as MSP430. Provided [libgcc2.h](https://gcc.gnu.org/git/?p=gcc.git;a=blob_plain;f=libgcc/libgcc2.h;hb=HEAD) can be used as a reference for all targets supported by the libgcc, this patch fixes some existing differences in helper declarations.
This patch is expected to not change behavior at all for targets with 32-bit `int` type.
Differential Revision: https://reviews.llvm.org/D81285
Anatoly Trosinenko [Tue, 30 Jun 2020 08:04:17 +0000 (11:04 +0300)]
[MSP430] Declare comparison LibCalls as returning i16 instead of i32
For TI's distribution of msp430-gcc
```
msp430-elf-gcc -S -o- -Os -x c - <<< "int f(float a, float b) { return a != b; }"
```
does not mention `R13` at all. `__libgcc_cmp_return__` machine mode is 2 byte on MSP430, as well.
Differential Revision: https://reviews.llvm.org/D82635
Guillaume Chatelet [Tue, 30 Jun 2020 07:49:21 +0000 (07:49 +0000)]
[Alignment][NFC] Migrate AArch64, ARM, Hexagon, MSP and NVPTX backends to Align
This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Differential Revision: https://reviews.llvm.org/D82749
Simon Tatham [Tue, 30 Jun 2020 07:51:51 +0000 (08:51 +0100)]
Fix missing build dependency on omp_gen.
Summary:
`include/llvm/Frontend/OpenMP/CMakeLists.txt` creates a new target
called `omp_gen`, which is automatically added to
`LLVM_COMMON_DEPENDS` by the `add_public_tablegen_target` macro. But
it only gets added to the version of `LLVM_COMMON_DEPENDS` in the
scope of that subsidiary CMakeLists file, and it doesn't propagate all
the way back up to the permanent version of that variable which is
actually used to set dependencies.
The visible effect is that the output build scripts contain a missing
dependency. For example, if I run cmake in Ninja output mode, and then
run
ninja -t commands tools/clang/examples/PrintFunctionNames/CMakeFiles/PrintFunctionNames.dir/PrintFunctionNames.cpp.o
to list all the commands that are prerequisites of building that
object file, then the list does not include the llvm-tblgen command
that builds `include/llvm/Frontend/OpenMP/OMP.h.inc`, even though that
generated include file is needed (by a chain of includes starting from
`clang/AST/AST.h`), and that object file can't be compiled without it.
This missing dependency can cause intermittent build failures,
depending on the order that Ninja (or whatever) happens to schedule
its commands.
I've fixed it by adding a `set` command in two levels of
`CMakeLists.txt` to propagate the modified version of
`LLVM_COMMON_DEPENDS` back up through the parent scopes so that
`omp_gen` does end up on the version seen by the main
`llvm/CMakeLists.txt`.
Reviewers: clementval, thakis, chandlerc, jdoerfert
Reviewed By: clementval
Subscribers: jdenny, mgorny, sstefan1, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82659
Craig Topper [Tue, 30 Jun 2020 07:17:52 +0000 (00:17 -0700)]
[X86] Remove an isel pattern than can never match. Remove bitcasts of loads from a few others.
David Sherwood [Mon, 29 Jun 2020 07:13:50 +0000 (08:13 +0100)]
[CodeGen] Fix warning in getNode for EXTRACT_SUBVECTOR
Fix a warning in getNode() when extracting a subvector from a
concat vector. We can simply replace the call to getVectorNumElements
with getVectorMinNumElements as this follows the defined behaviour
for EXTRACT_SUBVECTOR.
Differential Revision: https://reviews.llvm.org/D82746
Jonas Paulsson [Thu, 26 Mar 2020 11:22:14 +0000 (12:22 +0100)]
[SystemZ] Improve handling of ZERO_EXTEND_VECTOR_INREG.
Instead of doing multiple unpacks when zero extending vectors (e.g. v2i16 ->
v2i64), benchmarks have shown that it is better to do a VPERM (vector
permute) since that is only one sequential instruction on the critical path.
This patch achieves this by
1. Expand ZERO_EXTEND_VECTOR_INREG into a vector shuffle with a zero vector
instead of (multiple) unpacks.
2. Improve SystemZ::GeneralShuffle to perform a single unpack as the last
operation if Bytes matches it.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D78486
Alexander Shaposhnikov [Tue, 30 Jun 2020 06:09:38 +0000 (23:09 -0700)]
[llvm-objcopy][MachO] Fix segment size alignment
This diff addresses the old TODO in MachOObjcopy.cpp and
correctly sets the page size used for alignment of segments.
In particular, now llvm-objcopy's output is consistent
with the input (the alignment of vmsize doesn't change).
Test plan:
1. make check-all
2. verify that a binary copied via llvm-objcopy now correctly works on iOS.
Differential revision: https://reviews.llvm.org/D82503
David Sherwood [Thu, 25 Jun 2020 13:46:16 +0000 (14:46 +0100)]
[SVE][CodeGen] Fix bug in DAGCombiner::reduceBuildVecToShuffle
When trying to reduce a BUILD_VECTOR to a SHUFFLE_VECTOR it's
important that we carefully check the vector types that led to
that BUILD_VECTOR. In the test I have attached to this commit
there is a case where the results of two SVE faddv instructions
are being stored to consecutive memory locations. With my fix,
as part of merging those stores we discover that each BUILD_VECTOR
element came from an extract of a SVE vector element and
therefore bail out.
Differential Revision: https://reviews.llvm.org/D82564
River Riddle [Tue, 30 Jun 2020 05:37:05 +0000 (22:37 -0700)]
Add front/back accessors to indexed_accessor_range.
These map to the similar accessors on ArrayRef and other random access containers.
This fixes a compilation error on MLIR ODS for variadic operands/results, which relied on the availability of front in certain situations.
Max Kazantsev [Tue, 30 Jun 2020 05:38:15 +0000 (12:38 +0700)]
[SimplifyCFG] Fix inconsistency in block size assessment for threading
Sometimes SimplifyCFG may decide to perform jump threading. In order
to do it, it follows the following algorithm:
1. Checks if the block is small enough for threading;
2. If yes, inserts a PR Phi relying that the next iteration will remove it
by performing jump threading;
3. The next iteration checks the block again and performs the threading.
This logic has a corner case: inserting the PR Phi increases block's size
by 1. If the block size at first check was max possible, one more Phi will
exceed this size, and we will neither perform threading nor remove the
created Phi node. As result, we will end up with worse IR than before.
This patch fixes this situation by excluding Phis from block size computation.
Excluding Phis from size computation for threading also makes sense by
itself because in case of threadign all those Phis will be removed.
Differential Revision: https://reviews.llvm.org/D81835
Reviewed By: asbirlea, nikic
David Blaikie [Tue, 30 Jun 2020 05:07:36 +0000 (22:07 -0700)]
Add missing #include
A forward declaration was insufficient here - since Regex needs to be
complete for the implicit dtor to be compiled correctly. (that, or the
dtor would have to be made explicit and out of line)
Alex Lorenz [Tue, 30 Jun 2020 03:11:55 +0000 (20:11 -0700)]
[clang] attempt to fix a linux test failure for the darwin-ld-platform-version-macos.c test
Clang should use explicit -target to ensure that the Darwin driver is used.
Also drop arm64e test-case for now.
Ye Luo [Tue, 30 Jun 2020 02:32:43 +0000 (22:32 -0400)]
[OpenMP] fix clang warning about printf format in CUDA plugin
Summary: Warnings are printed by clang when building LIBOMPTARGET_ENABLE_DEBUG=ON due incorrect format string.
Reviewers: tianshilei1992, jdoerfert
Reviewed By: tianshilei1992
Subscribers: yaxunl, guansong, sstefan1, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D82789
Alex Lorenz [Tue, 30 Jun 2020 01:39:26 +0000 (18:39 -0700)]
[darwin][driver] pass the minimum supported OS version to the linker
if it's newer than the target version
This change ensures that the arm64-apple-macOS slice is linked for
macOS 11 even if the deployment target is earlier than macOS 11.
Richard Smith [Tue, 30 Jun 2020 02:02:47 +0000 (19:02 -0700)]
[c++20] Fix handling of operator rewrites naming consteval operator<=>.
David Blaikie [Tue, 30 Jun 2020 01:02:12 +0000 (18:02 -0700)]
Move Sema::PragmaStack<ValueType>::Act into Sema.h so it can be instantiated as needed
Found by linker failures in ThinLTO where the definition wasn't
available when it needed to be. (eg: ThinLTO may've eliminated the one
caller in the same TU and dropped the definition - breaking accidental
implicit depenednce on that definition from elsewhere)
George Mitenkov [Tue, 30 Jun 2020 00:32:40 +0000 (20:32 -0400)]
[MLIR][SPIRVToLLVM] Added Bitcast conversion pattern
Added conversion pattern and tests for `spv.Bitcast` op. This one has
a direct mapping in LLVM dialect so `DirectConversionPattern` was used.
Differential Revision: https://reviews.llvm.org/D82748
Jacques Pienaar [Mon, 29 Jun 2020 23:40:52 +0000 (16:40 -0700)]
[ods] Update Operator to record Arg->[Attr|Operand]Index mapping
Also fixed bug in type inferface generator to address bug where operands and
attributes are interleaved.
Differential Revision: https://reviews.llvm.org/D82819
Craig Topper [Mon, 29 Jun 2020 23:26:53 +0000 (16:26 -0700)]
[X86] Prefer AND over PSHUFB for v64i8 when possible
If the shuffle is a blend and one input is a 0 vector, we should prefer AND over PSHUFB since its available on more execution ports.
Differential Revision: https://reviews.llvm.org/D82798
George Mitenkov [Mon, 29 Jun 2020 23:16:36 +0000 (19:16 -0400)]
[MLIR][SPIRVToLLVM] Convert bitwise and logical not
This patch introduces new conversion patterns for bit and logical
negation op: `spv.Not` and `spv.LogicalNot`. They are implemented
by applying xor on the operand and mask with all bits set.
Differential Revision: https://reviews.llvm.org/D82637
Joel E. Denny [Mon, 29 Jun 2020 22:35:22 +0000 (18:35 -0400)]
[FileCheck] Permit multiple -v or -vv
`FILECHECK_OPTS` was implemented so that a test runner, such as CI,
can specify FileCheck debugging options, such as `-v` and `-vv`.
However, if a test suite has a FileCheck call that already specifies
`-v` or `-vv`, then that call will fail if `FILECHECK_OPTS` also
specifies it.
For `-vv`, this problem already exists:
`clang/test/CodeGen/aarch64-v8.2a-fp16-intrinsics-constrained.c`
It's not yet clear if the `-vv` in that test was intentional, but this
usage shouldn't fail anyway. It's already true that FileCheck permits
`-vv` and `-v` together even though `-vv` implies `-v`.
Compare D70784, which fixed the same problem for `-dump-input`.
Reviewed By: jhenderson, thopre
Differential Revision: https://reviews.llvm.org/D82601
Joel E. Denny [Mon, 29 Jun 2020 22:35:11 +0000 (18:35 -0400)]
[FileCheck][NFC] Clean up RUN style in verbose.txt test
Reviewed By: jhenderson, thopre
Differential Revision: https://reviews.llvm.org/D82658
James Y Knight [Mon, 29 Jun 2020 22:27:02 +0000 (18:27 -0400)]
Clang Driver: refactor support for writing response files to be
specified at Command creation, rather than as part of the Tool.
This resolves the hack I just added to allow Darwin toolchain to vary
its level of support based on `-mlinker-version=`.
The change preserves the _current_ settings for response-file support.
Some tools look likely to be declaring that they don't support
response files in error, however I kept them as-is in order for this
change to be a simple refactoring.
Differential Revision: https://reviews.llvm.org/D82782
James Y Knight [Mon, 29 Jun 2020 22:26:53 +0000 (18:26 -0400)]
Clang Driver: Use Apple ld64's new @response-file support.
In XCode 12, ld64 got support for @files, in addition to the old
-filelist mechanism. Response files allow passing all command-line
arguments to the linker via a file, rather than just filenames, and is
therefore preferred.
Because of the way response-file support is currently implemented as
part of the Tool class in Clang, this change requires an ugly backdoor
function to access Args. A follow-up commit fixes this, but I've
ordered this change first, for easier backportability.
I've added no tests here, because unfortunately, there don't appear to
be _any_ response-file emission automated tests, and I don't see an
obvious way to add them. I've tested that this change works as
expected locally.
Differential Revision: https://reviews.llvm.org/D82777
Christopher Tetreault [Mon, 29 Jun 2020 21:46:25 +0000 (14:46 -0700)]
[SVE] Remove calls to VectorType::getNumElements from Instrumentation
Reviewers: efriedma, pcc, gchatelet, kmclaughlin, sdesmalen
Reviewed By: sdesmalen
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82241
Petr Hosek [Thu, 11 Jun 2020 03:00:53 +0000 (20:00 -0700)]
[CMake][compiler-rt] Only set lld as available when it was built
The `-fuse-ld=lld` check might succeed because there's a system lld,
but that lld may be out-of-date which would cause any tests that
attempt to use for LTO fail. This was observed on some of the bots.
Differential Revision: https://reviews.llvm.org/D81629
Rahul Joshi [Mon, 29 Jun 2020 14:31:48 +0000 (07:31 -0700)]
[MLIR] Add variadic isa<> for Type, Value, and Attribute
- Also adopt variadic llvm::isa<> in more places.
- Fixes https://bugs.llvm.org/show_bug.cgi?id=46445
Differential Revision: https://reviews.llvm.org/D82769
Christopher Tetreault [Mon, 29 Jun 2020 21:21:39 +0000 (14:21 -0700)]
[CMake] Fix incorrect handling of get_target_property failure
Summary:
add_unittest was checking that the result of get_target_property was not
"NOTFOUND", but despite what the documentation says, get_target_property
returns <the var>-NOTFOUND on failure.
Reviewers: efriedma, thakis, serge-sans-paille, chandlerc
Reviewed By: serge-sans-paille
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D81762
Richard Smith [Mon, 29 Jun 2020 21:12:14 +0000 (14:12 -0700)]
Fix a few cases that were incorrectly parsed as unary-expressions
instead of postfix-expressions, and improve error recovery for postfix
operators after unary-expressions.
This covers nullptr, __null, and some calls to type traits with special
parsing rules. We would previously not parse a postfix-expression suffix
for these expressions, so would reject expressions such as
__is_trivial(int)["foo"].
For the case where a postfix-expression suffix is *not* permitted after
a unary-expression (for example, after a new-expression or sizeof
expression), produce a diagnostic if one appears there anyway. That's
always ill-formed, but previously produced very bad diagnostics.
Adam D Straw [Mon, 29 Jun 2020 17:35:11 +0000 (19:35 +0200)]
[mlir] add unsigned comparison builders to Affine EDSC
Current Affine comparison builders, which use operator overload, default to signed comparison. This creates the possibility of misuse of these builders and potential correctness issues when dealing with unsigned integers. This change makes the distinction between signed and unsigned comparison builders and forces the caller to make a choice between the two.
Differential Revision: https://reviews.llvm.org/D82323
Eric Schweitz [Mon, 29 Jun 2020 17:28:12 +0000 (10:28 -0700)]
[flang] Add coarray lowering hooks.
Differential review: https://reviews.llvm.org/D82790
Lei Huang [Mon, 29 Jun 2020 21:13:02 +0000 (16:13 -0500)]
[PowerPC] Fix FeatureISA3_1 def in PPC.td to imply FeatureISA3_0.
Simon Pilgrim [Sun, 28 Jun 2020 22:26:48 +0000 (23:26 +0100)]
[X86] Add common prefixes to merge more hadd/sub tests checks
Sam McCall [Mon, 29 Jun 2020 21:05:07 +0000 (23:05 +0200)]
[clangd] config() -> Config::current to avoid confict with NS
Jason Molenda [Mon, 29 Jun 2020 21:04:44 +0000 (14:04 -0700)]
Simplify conditionals in DNBArchMachARM64::EnableHardwareSingleStep
aartbik [Mon, 29 Jun 2020 20:28:12 +0000 (13:28 -0700)]
[mlir] [VectorOps] Extend vector reduction integration test with reassoc=true cases.
Reviewed By: reidtatge
Differential Revision: https://reviews.llvm.org/D82674
Sam McCall [Mon, 29 Jun 2020 20:22:12 +0000 (22:22 +0200)]
[ADT] Use more explicit from to initialize member. Appease MSVC?
Or at least get a clearer error message:
http://lab.llvm.org:8011/builders/mlir-windows/builds/3958/steps/build-unified-tree/logs/stdio
Leonard Chan [Mon, 29 Jun 2020 20:06:42 +0000 (13:06 -0700)]
[clang][RelativeVTablesABI] Update CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
After
c7bcd431d9c4bfeb631a3599f1d628603e6351d6, this test started failing when
running with the new pass manager. One of the CHECKs in this file checks how the
vtable is loaded for a void cast, which involves taking 2 bitcasts from the pointer
to the original object. The order of these bitcasts changes under the new PM.
The order doesn't matter, so this relaxes the CHECKs.
Differential Revision: https://reviews.llvm.org/D82802
Nick Desaulniers [Mon, 29 Jun 2020 19:42:37 +0000 (12:42 -0700)]
Reland "[clang][SourceManager] cache Macro Expansions""
This reverts commit
33d63f02ce408d181e13089ee5a667fb2e1cdc78.
Differential Revision: https://reviews.llvm.org/D80681
Nick Desaulniers [Mon, 29 Jun 2020 19:41:56 +0000 (12:41 -0700)]
Revert "[clang][SourceManager] cache Macro Expansions"
This reverts commit
dffc1420451f674731cb36799c8ae084104ff0b5.
Missed a hunk (D82690).
Sam McCall [Mon, 29 Jun 2020 19:46:40 +0000 (21:46 +0200)]
Reland [clangd] Config: config struct propagated through Context
This reverts commit
a3684dfc45c3a7bbdf72750d8a527e07e776b608.
Sam McCall [Mon, 29 Jun 2020 19:41:57 +0000 (21:41 +0200)]
Revert "[clangd] Config: config struct propagated through Context"
This reverts commit
9963d93b0731e21dd1c9c1cebf8baaecf2010330.
Fails on mac/win:
http://45.33.8.238/win/18704/step_9.txt
http://45.33.8.238/mac/16341/step_9.txt
Sam McCall [Mon, 29 Jun 2020 19:00:46 +0000 (21:00 +0200)]
Reland [ADT] Support const-qualified unique_functions
This reverts commit
09b6dffb8ed19d624fddc7a57ce886f8be3c45b2.
Now compiles with GCC!
Davide Italiano [Mon, 29 Jun 2020 19:38:27 +0000 (12:38 -0700)]
[ProcessGDBRemote] Get rid of an unused function.
The define was wrong. I could've fixed it, but given this is
unused I decided to drop the function altogether.
peter klausler [Mon, 29 Jun 2020 17:45:02 +0000 (10:45 -0700)]
[flang] Defer stmt function body analysis until specification part complete
Expression analysis was being invoked on the bodies of statement functions
as they were being encountered during name resolution. This led to failures
on some FCVS tests in cases where those expressions contained implicitly
typed objects. Defer the analysis of statemet function bodies to the end
of the specification part, at which time the symbols of the enclosing scope
will have been typed.
Reviewed By: tskeith
Differential Revision: https://reviews.llvm.org/D82796
Mircea Trofin [Mon, 29 Jun 2020 15:44:38 +0000 (08:44 -0700)]
[llvm][NFC] Use llvm_canonicalize_cmake_booleans for LLVM_HAVE_TF_AOT
Reviewers: thakis
Subscribers: mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82776
Reid Kleckner [Mon, 29 Jun 2020 19:24:10 +0000 (12:24 -0700)]
[gn build] Add missing llvm-lipo dep to check-lld
Updates gn files for
918948db4dc8718cb7aae8765653c27cba3cfe86
Alex Lorenz [Mon, 29 Jun 2020 17:23:16 +0000 (10:23 -0700)]
[darwin][driver] isMacosxVersionLT should check against the minimum supported OS version
This change ensures that the Darwin driver doesn't add unsupported libraries to the link
invocation when linking the Apple Silicon macOS slice.
rdar://
61011136
Differential Revision: https://reviews.llvm.org/D82696
Matt Arsenault [Fri, 26 Jun 2020 19:18:30 +0000 (15:18 -0400)]
X86: Upgrade a test to not rely on byval pointee type
Matt Arsenault [Mon, 29 Jun 2020 18:21:46 +0000 (14:21 -0400)]
LowerConstantIntrinsics: Fix missing test for byval behavior
Matt Arsenault [Sun, 28 Jun 2020 14:46:56 +0000 (10:46 -0400)]
X86: Use MOV32r0 pseudo instead of directly emitting xor
This was producing reg = xor undef reg, undef reg. This looks similar
to a use of a value to define itself, and I want to disallow undef
uses for SSA virtual registers. If this were to use implicit_def,
there's no guarantee the two operands end up using the same register
(I think no guarantee exists even if the two operands start out as the
same register, but this was violated when I switched this to use an
explicit implicit_def). The MOV32r0 pseudo evidently exists to handle
this case, so use it instead. This was more work than I expected for
the 64-bit case, but I didn't see any helper for materializing a
64-bit 0.
Reid Kleckner [Mon, 29 Jun 2020 18:39:49 +0000 (11:39 -0700)]
Silence unused var warning in NDEBUG build
LLVM GN Syncbot [Mon, 29 Jun 2020 18:36:28 +0000 (18:36 +0000)]
[gn build] Port
9963d93b073
Martijn Vels [Fri, 19 Jun 2020 18:24:03 +0000 (14:24 -0400)]
Add optimization to basic_string::assign for compile-time known constant values.
Summary:
This change optimizes the assign() methods for string where either the contents or lengths are compile time known constants. For small strings (< min_cap) we can execute the assignment entirely inline. For strings up to 128 bytes we allow the compiler to efficiently inline the copy operation after we call the offline __resize<>() method. Short / long branches are taken at the call site for better branch prediction and allowing FDO optimizations.
Benchmarks (unstable / google perflab):
```
name old time/op new time/op delta
BM_StringAssignAsciiz_Empty_Opaque 5.69ns ± 7% 5.97ns ± 7% ~ (p=0.056 n=5+5)
BM_StringAssignAsciiz_Empty_Transparent 5.39ns ± 7% 0.79ns ± 8% -85.36% (p=0.008 n=5+5)
BM_StringAssignAsciiz_Small_Opaque 11.2ns ± 5% 11.0ns ± 6% ~ (p=0.548 n=5+5)
BM_StringAssignAsciiz_Small_Transparent 10.1ns ± 7% 1.0ns ± 8% -89.76% (p=0.008 n=5+5)
BM_StringAssignAsciiz_Large_Opaque 23.5ns ± 7% 23.8ns ± 7% ~ (p=0.841 n=5+5)
BM_StringAssignAsciiz_Large_Transparent 21.4ns ± 7% 12.7ns ± 7% -40.83% (p=0.008 n=5+5)
BM_StringAssignAsciiz_Huge_Opaque 336ns ± 4% 327ns ± 7% ~ (p=0.421 n=5+5)
BM_StringAssignAsciiz_Huge_Transparent 331ns ± 5% 324ns ± 7% ~ (p=0.548 n=5+5)
BM_StringAssignAsciizMix_Opaque 13.6ns ±10% 13.7ns ± 9% ~ (p=0.690 n=5+5)
BM_StringAssignAsciizMix_Transparent 12.9ns ± 8% 3.6ns ± 8% -71.82% (p=0.008 n=5+5)
```
Reviewers: EricWF, #libc!
Subscribers: jfb, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D82221
Nikita Popov [Mon, 29 Jun 2020 18:33:50 +0000 (20:33 +0200)]
[IndVars] Regenerate test checks (NFC)
Nikita Popov [Mon, 29 Jun 2020 18:26:22 +0000 (20:26 +0200)]
Revert "[ADT] Support const-qualified unique_functions"
This reverts commit
01bf8cdf5fa9bc71869e15e5e351b2b68c39feb6.
Breaks the build:
llvm/include/llvm/ADT/FunctionExtras.h:223:7: error: explicit template argument list not allowed
223 | Callbacks<CallableT, CalledAs, EnableIfTrivial<CallableT>>;
Sam McCall [Thu, 25 Jun 2020 21:42:36 +0000 (23:42 +0200)]
[clangd] Config: config struct propagated through Context
Summary:
This introduces the "semantic form" of config exposed to features,
contrasted with the "syntactic form" exposed to users in
e9fb1506b83d.
The two are not connected, CompiledFragment and Provider will bridge that gap.
Nor is configuration actually set: that needs changes to ClangdServer,
TUScheduler, and BackgroundQueue.
Reviewers: hokein, kadircet
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82606
Alexey Bataev [Mon, 29 Jun 2020 17:30:29 +0000 (13:30 -0400)]
[DEBUGINFO]Add a test for packed bitfields, NFC.