Georgii Rymar [Wed, 1 Jul 2020 12:25:33 +0000 (15:25 +0300)]
[llvm-readelf] - Do not error out when dumping symbols.
When the --symbols option/--dyn-symbols is given we might report an
error and exit when something goes not right. E.g. when the SHT_SYMTAB
section is broken. Though we could report a warning and try to continue
dumping instead in many cases.
This patch removes `unwrapOrErr` calls from the code involved in the
flow described.
Differential revision: https://reviews.llvm.org/D82955
Guillaume Chatelet [Fri, 3 Jul 2020 08:54:27 +0000 (08:54 +0000)]
[Alignment][NFC] Use 5 bits to store Instructions Alignment
As per [MaxAlignmentExponent]{https://github.com/llvm/llvm-project/blob/
b7338fb1a6a464472850211165391983d2c8fdf3/llvm/include/llvm/IR/Value.h#L688} alignment is not allowed to be more than 2^29.
Encoded as Log2, this means that storing alignment uses 5 bits.
This patch makes sure all instructions store their alignment in a consistent way, encoded as Log2 and using 5 bits.
Differential Revision: https://reviews.llvm.org/D83119
Jean Perier [Fri, 3 Jul 2020 08:01:35 +0000 (10:01 +0200)]
[flang][NFC] Move and rework pgmath description used in folding
This change prepares usage of lipgmath description in lowering.
- Removes the static variable templates that were used to abstract
libpgmath description
- Move the description to pgmath.h.inc header and rework the macros
so that they can both be used to declare pgmath functions and use
them.
The way they are to be used is left to pgmath.h.inc user that
must define PGMATH_USE_XX macros that will be called for all pgmath
functions in pgmath.h.inc.
- In intrinsic-library.cpp define PGMATH_USE_XX macro callbacks in
order to capture function pointers to pgmath functions as well as
a description of their type. This will be used for constant folding
using pgmath.
- Change atan/atan2 handling to use atan2 instead of atan when there are two
arguments because it is easier to handle in the runtime description.
Also fixes lipgmath linking regression after D78215 cmake changes.
This change is motivated by the need to use a similar pgmath
description in lowering. The difference is that no function pointers will
be taken there, and instead only the function name and type are needed.
Reviewed By: schweitz, sscalpone
Differential Revision: https://reviews.llvm.org/D83051
Guillaume Chatelet [Fri, 3 Jul 2020 08:06:43 +0000 (08:06 +0000)]
[Alignment][NFC] Use proper getter to retrieve alignment from ConstantInt and ConstantSDNode
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/D83082
Joachim Protze [Mon, 15 Jun 2020 22:31:14 +0000 (00:31 +0200)]
[OpenMP][OMPT]Add event callbacks for taskwait with depend
This adds the missing event callbacks to express dependencies on included tasks
and taskwait with depend clause.
The test fails for GCC, see bug report:
https://bugs.llvm.org/show_bug.cgi?id=46573
Reviewed by: hbae
Differential Revision: https://reviews.llvm.org/D81891
Luofan Chen [Fri, 3 Jul 2020 07:22:18 +0000 (15:22 +0800)]
[Attributor] Create getName() method for abstract attribute
Summary: The `getName()` method returns the name of the abstract attribute
Reviewers: jdoerfert, sstefan1, uenoku, homerdin, baziotis
Reviewed By: sstefan1
Subscribers: uenoku, kuter, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83109
serge-sans-paille [Tue, 30 Jun 2020 12:04:00 +0000 (14:04 +0200)]
Fix stack-clash probing for large static alloca
Differential Revision: https://reviews.llvm.org/D82867
Guillaume Chatelet [Fri, 3 Jul 2020 07:20:22 +0000 (07:20 +0000)]
[NFC] Use ADT/Bitfields in Instructions
This is an example patch for D81580.
Differential Revision: https://reviews.llvm.org/D81662
Craig Topper [Fri, 3 Jul 2020 07:13:59 +0000 (00:13 -0700)]
[X86] Remove MODRM_SPLITREGM from the disassembler tables.
This offers a very minor table size reduction due to only being
used for one AMX opcode.
Haojian Wu [Fri, 3 Jul 2020 06:54:36 +0000 (08:54 +0200)]
[clang] Check ValueDependent instead of InstantiationDependent before executing the align expr for builtin align functions.
in general, value dependent is a subset of instnatiation dependent. This
would allows us to produce diagnostics for the align expression (which
is instantiation dependent but not value dependent).
Differential Revision: https://reviews.llvm.org/D83074
Sam Parker [Thu, 2 Jul 2020 11:13:23 +0000 (12:13 +0100)]
[CostModel] Fix cast crash
Don't presume instruction operands while matching reductions.
Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=46430
Differential Revision: https://reviews.llvm.org/D82453
Kai Luo [Fri, 3 Jul 2020 05:27:25 +0000 (05:27 +0000)]
[PowerPC] Implement probing for dynamic stack allocation
This patch is part of supporting `-fstack-clash-protection`. Mainly do
such things compared to existing `lowerDynamicAlloc`
- Added a new pseudo instruction PPC::PREPARE_PROBED_ALLOC to get
actual frame pointer and final stack pointer.
- Synthesize a loop to probe by blocks.
- Use DYNAREAOFFSET to get MaxCallFrameSize which is calculated in
prologepilog.
Differential Revision: https://reviews.llvm.org/D81358
Craig Topper [Fri, 3 Jul 2020 05:11:52 +0000 (22:11 -0700)]
[X86] Add back support for matching VPTERNLOG from back to back logic ops.
I think this mostly looks ok. The only weird thing I noticed was
a couple rotate vXi8 tests picked up an extra logic op where we have
(and (or (and), (andn)), X). Previously we matched the (or (and), (andn))
to vpternlog, but now we match the (and (or), X) and leave the and/andn
unmatched.
Carl Ritson [Fri, 3 Jul 2020 03:25:33 +0000 (12:25 +0900)]
[AMDGPU] Insert PS early exit at end of control flow
Exit early if the exec mask is zero at the end of control flow.
Mark the ends of control flow during control flow lowering and
convert these to exits during the insert skips pass.
Reviewed By: nhaehnle
Differential Revision: https://reviews.llvm.org/D82737
Kai Luo [Fri, 3 Jul 2020 04:17:01 +0000 (04:17 +0000)]
[PowerPC][NFC] Prevent unused error when assertion is disabled.
Jez Ng [Fri, 3 Jul 2020 04:19:55 +0000 (21:19 -0700)]
[lld-macho] Support binding dysyms to any section
Previously, we only supported binding dysyms to the GOT. This
diff adds support for binding them to any arbitrary section. C++
programs appear to use this, I believe for vtables and type_info.
This diff also makes our bind opcode encoding a bit smarter -- we now
encode just the differences between bindings, which will make things
more compact.
I was initially concerned about the performance overhead of iterating
over these relocations, but it turns out that the number of such
relocations is small. A quick analysis of my llvm-project build
directory showed that < 1.3% out of ~7M relocations are RELOC_UNSIGNED
bindings to symbols (including both dynamic and static symbols).
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D83103
Carl Ritson [Fri, 3 Jul 2020 04:03:33 +0000 (13:03 +0900)]
Revert "[AMDGPU] Insert PS early exit at end of control flow"
This reverts commit
2bfcacf0ad362956277a1c2c9ba00ddc453a42ce.
There appears to be an issue to analysis preservation.
Kai Luo [Fri, 3 Jul 2020 03:30:38 +0000 (03:30 +0000)]
[PowerPC][NFC] Refactor lowerDynamicAlloc
When performing dynamic stack allocation, calculation of frame pointer
and actual negsize can be separated. This patch refactors
`lowerDynamicAlloc` in preparation of supporting
`-fstack-clash-protection` which also has to calculate actual frame
pointer and negsize.
Differential Revision: https://reviews.llvm.org/D81354
Carl Ritson [Fri, 3 Jul 2020 03:25:33 +0000 (12:25 +0900)]
[AMDGPU] Insert PS early exit at end of control flow
Exit early if the exec mask is zero at the end of control flow.
Mark the ends of control flow during control flow lowering and
convert these to exits during the insert skips pass.
Reviewed By: nhaehnle
Differential Revision: https://reviews.llvm.org/D82737
Carl Ritson [Fri, 3 Jul 2020 00:57:42 +0000 (09:57 +0900)]
[AMDGPU] Unify early PS termination blocks
Generate a single early exit block out-of-line and branch to this
if all lanes are killed. This avoids branching if lanes are active.
Reviewed By: nhaehnle
Differential Revision: https://reviews.llvm.org/D82641
peter klausler [Thu, 2 Jul 2020 22:51:07 +0000 (15:51 -0700)]
[flang] External I/O runtime work, repackaged (part 2)
Clean up the input editing path so external input works better
when combined with further changes. List-directed input needed
to allow for advancement to following records.
Reviewed By: tskeith, sscalpone
Differential Revision: https://reviews.llvm.org/D83104
Roman Lebedev [Thu, 2 Jul 2020 23:37:29 +0000 (02:37 +0300)]
[NFC][Scalarizer] Also scalarize loads in newly-added tests
Should help better showcase improvements
Roman Lebedev [Thu, 2 Jul 2020 22:53:13 +0000 (01:53 +0300)]
[NFC][Scalarizer] Add some insertelement/extractelement tests
See D82961/D82970/D83101/D83102.
Nico Weber [Thu, 2 Jul 2020 22:52:05 +0000 (18:52 -0400)]
[gn build] get everything to build when llvm_targets_to_build is just AArch64
Craig Topper [Thu, 2 Jul 2020 22:35:47 +0000 (15:35 -0700)]
[X86] Teach lower512BitShuffle to try bitmask and bitblend before splitting v32i16/v64i8 on av512f only targets.
We consider v32i16/v64i8 to be legal types on avx512f, but we
don't have most operations until avx512bw. But we can use
and/or/xor operations. So try those before splitting.
This is especially helpful since we turn some ands with constant
masks into shuffles in early DAG combines. So we should make sure
we recover those back to AND.
peter klausler [Thu, 2 Jul 2020 21:11:14 +0000 (14:11 -0700)]
[flang] External I/O runtime work, repackaged (part 1)
Add a isFixedRecordLength flag member to Connection to
disambiguate the state of "record has known variable length"
from "record has fixed length". Code that sets and tests this
flag will appear in later patches. Rearrange data members to
reduce storage requirements, since Connection might indirectly
end up on a program stack frame. Add a utility member function
BeginRecord(); use it in internal I/O processing.
Reviewed By: tskeith, sscalpone
Differential Revision: https://reviews.llvm.org/D83098
Biplob Mishra [Thu, 2 Jul 2020 21:14:27 +0000 (16:14 -0500)]
[PowerPC] Implement Vector Blend Builtins in LLVM/Clang
Implements vec_blendv()
Differential Revision: https://reviews.llvm.org/D82774
Sameer Arora [Thu, 2 Jul 2020 21:42:01 +0000 (14:42 -0700)]
Fix typo and check commit access.
Sanjay Patel [Thu, 2 Jul 2020 21:45:57 +0000 (17:45 -0400)]
[x86] remove redundant tests with no check lines; NFC
These were accidentally included with:
rGb93e6650c8ac
Sanjay Patel [Thu, 2 Jul 2020 20:48:09 +0000 (16:48 -0400)]
[SelectionDAG] don't split branch on logic-of-vector-compares
SelectionDAGBuilder converts logic-of-compares into multiple branches based
on a boolean TLI setting in isJumpExpensive(). But that probably never
considered the pattern of extracted bools from a vector compare - it seems
unlikely that we would want to turn vector logic into control-flow.
The motivating x86 reduction case is shown in PR44565:
https://bugs.llvm.org/show_bug.cgi?id=44565
...and that test shows the expected improvement from using pmovmsk codegen.
For AArch64, I modified the test to include an extra op because the simpler
test gets transformed by a codegen invocation of SimplifyCFG.
Differential Revision: https://reviews.llvm.org/D82602
Amy Kwan [Thu, 2 Jul 2020 20:15:14 +0000 (15:15 -0500)]
[PowerPC]Add Vector Insert Instruction Definitions and MC Test
Adds td definitions and asm/disasm tests for the following instructions:
VINSBVLX
VINSBVRX
VINSHVLX
VINSHVRX
VINSWVLX
VINSWVRX
VINSBLX
VINSBRX
VINSHLX
VINSHRX
VINSWLX
VINSWRX
VINSDLX
VINSDRX
VINSW
VINSD
Differential Revision: https://reviews.llvm.org/D83052
Craig Topper [Thu, 2 Jul 2020 20:43:27 +0000 (13:43 -0700)]
[X86] Add vpternlog to the broadcast unfolding table.
Craig Topper [Thu, 2 Jul 2020 20:29:30 +0000 (13:29 -0700)]
[X86] Add test case for unfolding broadcast load from vpternlog.
Vedant Kumar [Thu, 2 Jul 2020 20:28:48 +0000 (13:28 -0700)]
[test] Deflake test/profile/ContinuousSyncMode/online-merging.c
This test spawns 32 child processes which race to update counters on
shared memory pages. On some Apple-internal machines, two processes race
to perform an update in approximately 0.5% of the test runs, leading to
dropped counter updates. Deflake the test by using atomic increments.
Tested with:
```
$ for I in $(seq 1 1000); do echo ":: Test run $I..."; ./bin/llvm-lit projects/compiler-rt/test/profile/Profile-x86_64h/ContinuousSyncMode/online-merging.c -av || break; done
```
rdar://
64956774
Nikita Popov [Thu, 2 Jul 2020 20:21:23 +0000 (22:21 +0200)]
[InstSimplify] Add test for sext/zext comparisons (NFC)
aartbik [Thu, 2 Jul 2020 20:21:14 +0000 (13:21 -0700)]
[mlir] [VectorOps] Add choice between dot and axpy lowering of vector.contract
Default vector.contract lowering essentially yields a series of sdot/ddot
operations. However, for some layouts a series of saxpy/daxpy operations,
chained through fma are more efficient. This CL introduces a choice between
the two lowering paths. A default heuristic is to follow.
Some preliminary avx2 performance numbers for matrix-times-vector.
Here, dot performs best for 64x64 A x b and saxpy for 64x64 A^T x b.
```
------------------------------------------------------------
A x b A^T x b
------------------------------------------------------------
GFLOPS sdot (reassoc) saxpy sdot (reassoc) saxpy
------------------------------------------------------------
1x1 0.6 0.9 0.6 0.9
2x2 2.5 3.2 2.4 3.5
4x4 6.4 8.4 4.9 11.8
8x8 11.7 6.1 5.0 29.6
16x16 20.7 10.8 7.3 43.3
32x32 29.3 7.9 6.4 51.8
64x64 38.9 79.3
128x128 32.4 40.7
------------------------------------------------------------
```
Reviewed By: nicolasvasilache, ftynse
Differential Revision: https://reviews.llvm.org/D83012
Sanjay Patel [Wed, 1 Jul 2020 22:17:16 +0000 (18:17 -0400)]
[x86] add tests for vector select with bit-test condition; NFC
Craig Topper [Thu, 2 Jul 2020 19:23:02 +0000 (12:23 -0700)]
[X86] Modify the conditions for when we stop making v16i8/v32i8 rotate Custom based on having avx512 features.
The comments here indicate that we prefer to promote the shifts
instead of allowing rotate to be pattern matched. But we weren't
taking into account whether 512-bit registers are enabled or
whethever we have vpsllvw/vpsrlvw instructions.
splatvar_rotate_v32i8 is a slight regrssion, but the other cases
are neutral or improved.
Craig Topper [Thu, 2 Jul 2020 18:26:32 +0000 (11:26 -0700)]
[X86] Add test cases for v32i8 rotate with min-legal-vector-width=256
We currently don't mark ROTL as custom when avx512bw is enabled
under the assumption we'll be able to promote the shifts in the
rotate idiom. But if we don't have 512-bit registers enabled we
can't promote.
Lei Zhang [Thu, 2 Jul 2020 19:42:10 +0000 (15:42 -0400)]
Revert "[MLIR][SPIRV] Support two memory access attributes in OpCopyMemory."
This reverts commit
ef2f46e1f6a63040734c48ed53893298df14b6fa, which
likely triggers a compiler internal error for MSVC.
Differential Revision: https://reviews.llvm.org/D83075
Biplob Mishra [Thu, 2 Jul 2020 19:49:47 +0000 (14:49 -0500)]
[PowerPC]Implement Vector Permute Extended Builtin
Implements vector permute builtin: vec_permx()
Differential Revision: https://reviews.llvm.org/D82869
Nico Weber [Thu, 2 Jul 2020 19:30:39 +0000 (15:30 -0400)]
ld64.lld: Make janky support for tbd files actually work sometimes
Also fix a bug in the test input that made the test miss this issue.
peter klausler [Thu, 2 Jul 2020 16:52:48 +0000 (09:52 -0700)]
[flang] Clean up binary dependences of runtime libraries
There were dependences upon LLVM libraries in the Fortran
runtime support library binaries due to some indirect #includes
of llvm/Support/raw_ostream.h, which caused some kind of internal
ABI version consistency checking to get pulled in. Fixed by
cleaning up some includes.
Reviewed By: tskeith, PeteSteinfeld, sscalpone
Differential Revision: https://reviews.llvm.org/D83060
Tim Keith [Thu, 2 Jul 2020 19:24:34 +0000 (12:24 -0700)]
[flang] Fix bug determining alternate return
The arguments have been moved out of the analyzer so we can't get the
expected number there. Instead use the argument count from the newly
built callee.
Differential Revision: https://reviews.llvm.org/D83063
Bruno Ricci [Thu, 2 Jul 2020 18:38:46 +0000 (19:38 +0100)]
Revert "[clang][NFC] Store a pointer to the ASTContext in ASTDumper and TextNodeDumper"
This reverts commit
aa7fd905e4e1bc510448431da9310e8cf5197523.
I missed some dump() functions.
David Tenty [Thu, 2 Jul 2020 18:35:30 +0000 (14:35 -0400)]
[DebugInfo] Fix LineTest byteswap for cross-targeting builds
Summary:
The byte swap fix for big endian hosts in
9782c922cb21 (for D81570)
swaps based on the host endianess, but for cross-targeting builds (i.e.
big endian host targeting little endian) the host-endianess won't
necessarily match the generated DWARF. This change updates the test
to use symmetrical constants so the results aren't endian dependent.
Reviewers: jhenderson, hubert.reinterpretcast, stevewan, ikudrin
Reviewed By: ikudrin
Subscribers: ikudrin, aprantl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82827
Bruno Ricci [Thu, 2 Jul 2020 17:55:07 +0000 (18:55 +0100)]
[clang][NFC] Store a pointer to the ASTContext in ASTDumper and TextNodeDumper
In general there is no way to get to the ASTContext from most AST nodes
(Decls are one of the exception). This will be a problem when implementing
the rest of APValue::dump since we need the ASTContext to dump some kinds of
APValues.
The ASTContext* in ASTDumper and TextNodeDumper is not always
non-null. This is because we still want to be able to use the various
dump() functions in a debugger.
No functional changes intended.
Arthur Eubanks [Thu, 2 Jul 2020 18:27:38 +0000 (11:27 -0700)]
[NewPM] Add -basic-aa to pr33196.ll
The legacy pass manager implicitly adds BasicAA, but the new PM does
not. This causes pr33196.ll to fail under NPM.
There are almost certainly lots of other failures like this, wanted to
get some input on if adding -basic-aa to tests makes sense at scale.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D82915
George Mitenkov [Thu, 2 Jul 2020 18:21:35 +0000 (14:21 -0400)]
[MLIR][SPIRVToLLVM] Convert spv.constant scalars and vectors
This patch introduces conversion pattern for `spv.constant` with scalar
and vector types. There is a special case when the constant value is a
signed/unsigned integer (vector of integers). Since LLVM dialect does not
have signedness semantics, the types had to be converted to signless ints.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D82936
Nico Weber [Thu, 2 Jul 2020 18:22:31 +0000 (14:22 -0400)]
[gn build] make building on an arm mac work
Currently requires `llvm_targets_to_build = [ "X86", "AArch64" ]`:
building just the host arch (i.e. aarch64) causes some linker errors.
Arthur Eubanks [Thu, 2 Jul 2020 18:15:29 +0000 (11:15 -0700)]
[NewPM][LSR] Rename strength-reduce -> loop-reduce
The legacy pass was called "loop-reduce".
This lowers the number of check-llvm failures under NPM by 83.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D82925
sstefan1 [Thu, 2 Jul 2020 17:50:39 +0000 (19:50 +0200)]
[OpenMPOpt][Fix] Remove double initialization of omp::types.
Jonas Hahnfeld [Thu, 2 Jul 2020 17:34:03 +0000 (19:34 +0200)]
[OpenMP][CMake] Fix version detection of testing compiler
When configuring in-tree, the correct names are LLVM_VERSION_MAJOR
and LLVM_VERSION_MINOR. This has been wrong since the code was added
in commits
fc473dee98 and
821649229e.
Nemanja Ivanovic [Thu, 2 Jul 2020 17:28:17 +0000 (12:28 -0500)]
[LLD] Add required dependency after shared libs break due to
ba5087f13025
The dependency on TextAPI was not added and is required for shared
libs builds.
Nemanja Ivanovic [Thu, 2 Jul 2020 15:14:54 +0000 (10:14 -0500)]
[PowerPC] Remove undefs from splat input when changing shuffle mask
As of
1fed131660b2c5d3ea7007e273a7a5da80699445, we have code that
changes shuffle masks so that we can put the shuffle in a canonical
form that can be matched to a single instruction. However, it
does not properly account for undef elements in the BUILD_VECTOR
that is the RHS splat so we can end up with undefs where they
shouldn't be. This patch converts the splat input with undefs to
one without.
ergawy [Thu, 2 Jul 2020 17:14:29 +0000 (13:14 -0400)]
[MLIR][SPIRV] Support two memory access attributes in OpCopyMemory.
This commit augments spv.CopyMemory's implementation to support 2 memory
access operands. Hence, more closely following the spec. The following
changes are introduces:
- Customize logic for spv.CopyMemory serialization and deserialization.
- Add 2 additional attributes for source memory access operand.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D82710
George Mitenkov [Thu, 2 Jul 2020 16:34:27 +0000 (12:34 -0400)]
[MLIR][SPIRVToLLVM] SPIR-V function call conversion pattern
Added conversion pattern for SPIR-V `FunctionCallOp`. Based on
specification, it returns no results or a single result, so
can be mapped directly to LLVM dialect's `llvm.call`.
Reviewed By: antiagainst, ftynse
Differential Revision: https://reviews.llvm.org/D83030
George Mitenkov [Thu, 2 Jul 2020 16:19:05 +0000 (12:19 -0400)]
[MLIR][SPIRVToLLVM] Implementation of spv.BitFieldInsert pattern
This patch introduces conversion pattern for `spv.BitFiledInsert` op,
as well as some utility functions to facilitate code reading.
Since `spv.BitFiledInsert` may take both vector and integer operands,
this case was specifically handled by broadcasting values (`count`
and `offset` here) to vectors. Moreover, the types had to be converted
to same bitwidth in order to conform with LLVM dialect rules.
This was done with `zext` when extending (Note that `count` and
`offset` are treated as unsigned) and `trunc` in the opposite case.
For the latter one, truncation is safe since the op is defined only when
`count`/`offset`/their sum is less than the bitwidth of the result.
This introduces a natural bound of the value of 64, which can be
expressed as `i8`.
Reviewed By: antiagainst, ftynse
Differential Revision: https://reviews.llvm.org/D82639
Simon Pilgrim [Thu, 2 Jul 2020 16:11:38 +0000 (17:11 +0100)]
[InstCombine] Add some sext/trunc tests to show missing support for non-uniform vectors
Pavel Labath [Mon, 29 Jun 2020 14:17:29 +0000 (16:17 +0200)]
[lldb] Fix type conversion in the Scalar getters
Summary:
The Scalar class claims to follow the C type conversion rules. This is
true for the Promote function, but it is not true for the implicit
conversions done in the getter methods.
These functions had a subtle bug: when extending the type, they used the
signedness of the *target* type in order to determine whether to do
sign-extension or zero-extension. This is not how things work in C,
which uses the signedness of the *source* type. I.e., C does
(sign-)extension before it does signed->unsigned conversion, and not the
other way around.
This means that: (unsigned long)(int)-1
is equal to (unsigned long)0xffffffffffffffff
and not (unsigned long)0x00000000ffffffff
Unsurprisingly, we have accumulated code which depended on this
inconsistent behavior. It mainly manifested itself as code calling
"ULongLong/SLongLong" as a way to get the value of the Scalar object in
a primitive type that is "large enough". Previously, the ULongLong
conversion did not do sign-extension, but now it does.
This patch makes the Scalar getters consistent with the declared
semantics, and fixes the couple of call sites that were using it
incorrectly.
Reviewers: teemperor, JDevlieghere
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D82772
Sander de Smalen [Thu, 2 Jul 2020 13:40:08 +0000 (14:40 +0100)]
[AArch64][SVE] NFC: Rename isOrig -> isReverseInstr
This is a non-functional to clarify some of the terminology in the
AArch64SVEInstrInfo/SVEInstrFormats.td files around the tables
for mapping an instruction to it's reverse instruction counter part,
and vice versa. e.g. DIV -> DIVR and DIVR -> DIV.
Reviewers: paulwalker-arm, cameron.mcinally, rengolin, efriedma
Reviewed By: paulwalker-arm, efriedma
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82979
Simon Pilgrim [Thu, 2 Jul 2020 15:56:33 +0000 (16:56 +0100)]
[InstCombine] Add (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) support for non-uniform vectors
As noted on PR46531, we were only performing this transform on uniform vectors as we were using the m_APInt pattern matcher to extract the shift amount.
Differential Revision: https://reviews.llvm.org/D83035
Simon Pilgrim [Thu, 2 Jul 2020 14:09:52 +0000 (15:09 +0100)]
[InstCombine] Add some (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) tests for vectors with undef elements
Suggested on D83035
James Henderson [Tue, 30 Jun 2020 10:17:53 +0000 (11:17 +0100)]
[ELF][test] Add some additional .eh_frame/.eh_frame_hdr testing
This patch adds a few extra cases to the existing testing for eh_frame
and eh_frame_hdr behaviour in LLD. They all come from a private
testsuite we are trying to migrate to lit.
Reviewed by: grimar, MaskRay
Differential Revision: https://reviews.llvm.org/D82852
Ryan Santhiraraja [Thu, 2 Jul 2020 12:53:20 +0000 (13:53 +0100)]
Preserve GlobalsAA analysis result in LowerConstantIntrinsics
LowerConstantIntrinsics fails to preserve the analysis result of
GlobalsAA. Not preserving the analysis might affect benchmark
performance. This change fixes this issue.
Patch by Ryan Santhiraraja <rsanthir@quicinc.com>
Reviewers: fpetrogalli, joerg, fhahn
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D82342
Vince Bridgers [Wed, 1 Jul 2020 21:49:08 +0000 (16:49 -0500)]
[ASTImporter] Add unittest case for friend decl import
Summary:
This change adds a matching test case for the recent bug fix to
VisitFriendDecl in ASTImporterLookup.cpp.
See https://reviews.llvm.org/D82882 for details.
Reviewers: martong, a.sidorin, shafik
Reviewed By: martong
Subscribers: rnkovacs, teemperor, cfe-commits, dkrupp
Tags: #clang
Differential Revision: https://reviews.llvm.org/D83006
Arjun P [Thu, 2 Jul 2020 13:48:18 +0000 (19:18 +0530)]
[MLIR] Exact integer emptiness checks for FlatAffineConstraints
This patch adds the capability to perform exact integer emptiness checks for FlatAffineConstraints using the General Basis Reduction algorithm (GBR). Previously, only a heuristic was available for emptiness checks, which was not guaranteed to always give a conclusive result.
This patch adds a `Simplex` class, which can be constructed using a `FlatAffineConstraints`, and can find an integer sample point (if one exists) using the GBR algorithm. Additionally, it adds two classes `Matrix` and `Fraction`, which are used by `Simplex`.
The integer emptiness check functionality can be accessed through the new `FlatAffineConstraints::isIntegerEmpty()` function, which runs the existing heuristic first and, if that proves to be inconclusive, runs the GBR algorithm to produce a conclusive result.
Differential Revision: https://reviews.llvm.org/D80860
Dmitry Preobrazhensky [Thu, 2 Jul 2020 14:16:11 +0000 (17:16 +0300)]
[AMDGPU][CODEGEN] Added support of new inline assembler constraints
Added support for constraints 'I', 'J', 'B', 'C', 'DA', 'DB'.
See https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints.
Reviewers: arsenm, rampitec
Differential Revision: https://reviews.llvm.org/D81651
Jon Roelofs [Thu, 2 Jul 2020 13:54:57 +0000 (07:54 -0600)]
Fix missing build dependencies on omp_gen
Differential Revision: https://reviews.llvm.org/D83003
Nathan James [Thu, 2 Jul 2020 13:52:24 +0000 (14:52 +0100)]
[ASTMatchers] Enhanced support for matchers taking Regex arguments
Added new Macros `AST(_POLYMORPHIC)_MATCHER_REGEX(_OVERLOAD)` that define a matchers that take a regular expression string and optionally regular expression flags. This lets users match against nodes while ignoring the case without having to manually use `[Aa]` or `[A-Fa-f]` in their regex. The other point this addresses is in the current state, matchers that use regular expressions have to compile them for each node they try to match on, Now the regular expression is compiled once when you define the matcher and used for every node that it tries to match against. If there is an error while compiling the regular expression an error will be logged to stderr showing the bad regex string and the reason it couldn't be compiled. The old behaviour of this was down to the Matcher implementation and some would assert, whereas others just would never match. Support for this has been added to the documentation script as well. Support for this has been added to dynamic matchers ensuring functionality is the same between the 2 use cases.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D82706
Pavel Labath [Thu, 2 Jul 2020 13:27:25 +0000 (15:27 +0200)]
[lldb] Add a host-independent test for handling -flimit-debug-info
This complements the existing TestLimitDebugInfo.py, which tests this
scenario more comprehensively, but is not able to run on all hosts.
Specifically, it's hard to trigger this code from windows because clang
tries hard to ensure that debug info for types marked with
__declspec(dllexport) is emitted even under -flimit-debug-info (and
dllexport is needed to use a type across shared libraries).
This assembly-based test serves two purposes:
- it tests that -flimit-debug-info code path works for windows binaries
(even though the aforementioned feature means its less likely to be
used there)
- it gives basic test coverage for the -flimit-debug-info handling code
when running the test suite on windows hosts.
Nathan James [Thu, 2 Jul 2020 13:41:03 +0000 (14:41 +0100)]
call ::pthread_detach on llvm_execute_on_thread_impl
Fixes all TSAN bugs in clangd
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D83039
Simon Pilgrim [Thu, 2 Jul 2020 12:21:21 +0000 (13:21 +0100)]
Regenerate sext/trunc tests and replace %tmp variable names to silence update_test_checks warnings
Sander de Smalen [Thu, 2 Jul 2020 13:14:24 +0000 (14:14 +0100)]
[AArch64][SVE] Put zeroing pseudos and patterns under flag.
This patch puts the _ZERO pseudos and corresponding patterns
under the predicate 'UseExperimentalZeroingPseudos', so that they
can be enabled/disabled through compile flags.
This is done because the zeroing pseudos use MOVPRFX to do merging of
the inactive lanes, but it depends on the uarch whether this operation
is actually merged with the destructive operation. If not, it may be
more profitable to use a SELECT and to give the compiler the freedom to
schedule these instructions as normal, rather than keeping them bundled
together. Additionally, this feature is not yet fully implemented and
there are still known bugs (see D80410) that need to be resolved before
the 'experimental' can be dropped from the name.
Reviewers: paulwalker-arm, cameron.mcinally, efriedma
Reviewed By: paulwalker-arm
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82780
Bruno Ricci [Thu, 2 Jul 2020 13:13:35 +0000 (14:13 +0100)]
[clang][Serialization] Don't duplicate the body of LambdaExpr during deserialization
05843dc6ab97a00cbde7aa4f08bf3692eb83109d changed the serialization of the body
of LambdaExpr to avoid a mutation in LambdaExpr::getBody and to avoid a missing
body in LambdaExpr::children.
Unfortunately this replaced one bug by another: we are now duplicating the body
during deserialization; that is after deserialization the identity:
E->getBody() == E->getCallOperator()->getBody() does not hold.
Fix that by instead lazily loading the body from the call operator when needed.
Differential Revision: https://reviews.llvm.org/D83009
Reviewed By: martong, aaron.ballman, vabridgers
Eric Schweitz [Thu, 2 Jul 2020 00:00:02 +0000 (17:00 -0700)]
[flang] Add inliner pass.
This adds a minimalist inliner implementation. Along with the inliner, a
minimum number of support files are also included. These will pave the
way for future diffs to add more transformation passes to flang. A
future diff will add the inline test, which cannot be run successfully
quite yet as some components have not yet been upstreamed.
Differential revision:
Eric Schweitz [Thu, 2 Jul 2020 01:40:32 +0000 (18:40 -0700)]
[flang] Add changes to codegen to convert it to tablegen passes.
This upstreams changes to codegen to convert the passes to the new
tablegen pass support from MLIR.
Differential revision: https://reviews.llvm.org/D83018
David Green [Thu, 2 Jul 2020 09:56:58 +0000 (10:56 +0100)]
[BasicAA] Fix recursive phi MustAlias calculations
With the option -basic-aa-recphi we can detect recursive phis that loop
through constant geps, which allows us to detect more no-alias case for
pointer IV's. If the other phi operand and the other alias value are
MustAlias though, we cannot presume that every element in the loop is
also MustAlias. We need to instead be conservative and return MayAlias.
Differential Revision: https://reviews.llvm.org/D82987
Haojian Wu [Thu, 2 Jul 2020 12:58:32 +0000 (14:58 +0200)]
[clang] Fix a null-NSS-access crash in DependentNameType.
The DependentNameType must have a non-null NSS. This property could be
violated during typo correction.
Differential Revision: https://reviews.llvm.org/D82738
Pavel Labath [Thu, 2 Jul 2020 12:28:03 +0000 (14:28 +0200)]
[lldb] Skip TestLimitDebugInfo on windows
The test does not work on windows, because clang will emit full type
information for __declspec(dllexport) types even under
-flimit-debug-info. __declspec(dllexport) is needed to be able to use
the type across shared library boundaries on windows, which makes this a
pretty good heuristic, but defeats the purpose of this test.
I am going to create (in another patch) an basic assembly test, so that
the relevant code gets at least some coverage on windows hosts.
This also reverts commit
1276855f2b4485ec312b379c1b8eaf5510d9b157, which
added the __declspec annotations -- they are not necessary anymore, and
they needlessly complicate the test.
Gabor Marton [Mon, 22 Jun 2020 09:00:02 +0000 (11:00 +0200)]
[analyzer][StdLibraryFunctionsChecker] Add POSIX file handling functions
Adding file handling functions from the POSIX standard (2017).
A new checker option is introduced to enable them.
In follow-up patches I am going to upstream networking, pthread, and other
groups of POSIX functions.
Differential Revision: https://reviews.llvm.org/D82288
Kadir Cetinkaya [Wed, 1 Jul 2020 10:16:54 +0000 (12:16 +0200)]
[clangd] Switch FindSymbolsTests to use TestTU
Summary:
This gets rid of the dependency on ClangdServer and a bunch of extra
infrastructure coming with it. Also enables us to clear SyncAPI, as it was the
sole user of runWorkspace/DocumentSymbols.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82944
Whisperity [Thu, 2 Jul 2020 12:14:57 +0000 (14:14 +0200)]
[NFC][clang] Add missing VALIDATE_DIAG_SIZE()
Originally when libCrossTU was introduced in commit
e350b0a19629c4cce87f28913b3137f4c7015de3, the macro which thus had all
diagnostic kinds covered was not added.
Guillaume Chatelet [Thu, 2 Jul 2020 11:28:01 +0000 (11:28 +0000)]
[Alignment][NFC] Transition and simplify calls to DL::getABITypeAlignment
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/D82977
Guillaume Chatelet [Thu, 2 Jul 2020 11:25:54 +0000 (11:25 +0000)]
[Alignment][NFC] VectorLayout now uses Align internally
By rewritting `ScalarizerVisitor::getVectorLayout` in such a way it returns `VectorLayout` (or `None`) it becomes obvious that `VectorLayout::VecAlign` cannot be `0`.
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/D82981
Kerry McLaughlin [Thu, 2 Jul 2020 09:41:49 +0000 (10:41 +0100)]
[AArch64][SVE] Add reg+imm addressing mode for unpredicated stores
Reviewers: sdesmalen, efriedma, david-arm
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82985
Simon Pilgrim [Thu, 2 Jul 2020 10:56:32 +0000 (11:56 +0100)]
[InstCombine] Add some (vXi1 trunc(lshr(x,c))) -> icmp_eq(and(x,c')) tests for non-uniform vectors
As noticed on PR46531
Simon Pilgrim [Thu, 2 Jul 2020 10:39:50 +0000 (11:39 +0100)]
Regenerate apint-shift tests and replace %tmp variable names to silence update_test_checks warnings
Aaron Ballman [Thu, 2 Jul 2020 10:40:38 +0000 (06:40 -0400)]
Fix some typos (unkown -> unknown); NFC
Anna Welker [Thu, 2 Jul 2020 10:34:49 +0000 (11:34 +0100)]
[LV] Enable the LoopVectorizer to create pointer inductions
This patch enables the LoopVectorizer to build a phi of pointer
type and provide the vector loads and stores with vector type
getelementptrs built from the pointer induction variable, which
produces much less instructions than the previous approach of
creating scalar getelementpointers and glue them together to a
vector.
Differential Revision: https://reviews.llvm.org/D81267
Roman Lebedev [Thu, 2 Jul 2020 10:35:30 +0000 (13:35 +0300)]
Regenerate llvm/test/CodeGen/X86/optimize-max-0.ll
It surprizingly appears to be affected by the last SCEV patch
Roman Lebedev [Thu, 2 Jul 2020 09:44:48 +0000 (12:44 +0300)]
[ScalarEvolution] createSCEV(): recognize `udiv`/`urem` disguised as an `sdiv`/`srem`
Summary:
While InstCombine trivially converts that `srem` into a `urem`,
it might happen later than wanted, in particular i'd like
for that to happen on https://godbolt.org/z/bwuEmJ test case
early in pipeline, before first instcombine run, just before `-mem2reg`.
SCEV should recognize this case natively.
Reviewers: mkazantsev, efriedma, nikic, reames
Reviewed By: efriedma
Subscribers: clementval, hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82721
David Green [Thu, 2 Jul 2020 07:03:37 +0000 (08:03 +0100)]
[BasicAA] New basic-aa-recphi test. NFC
LLVM GN Syncbot [Thu, 2 Jul 2020 09:46:36 +0000 (09:46 +0000)]
[gn build] Port
804d9687443
Kazushi (Jam) Marukawa [Wed, 1 Jul 2020 14:17:27 +0000 (23:17 +0900)]
[VE] Rename VE toolchain source files
Summary:
Rename VE.cpp and VE.h to VEToolchain.cpp and VEToolchain.h respectively
in order to avoid link warning message. Linker warns that VE.cpp.o and
Arch/VE.cpp.o have the same name.
Reviewers: simoll, k-ishizaka
Reviewed By: simoll
Subscribers: mgorny, cfe-commits
Tags: #llvm, #ve, #clang
Differential Revision: https://reviews.llvm.org/D82968
David Sherwood [Wed, 1 Jul 2020 14:20:01 +0000 (15:20 +0100)]
[SVE] Add warnings checks in four more LLVM SVE tests
I have added CHECK lines to the following tests:
llvm/test/CodeGen/AArch64/sve-breakdown-scalable-vectortype.ll
llvm/test/CodeGen/AArch64/sve-calling-convention-tuple-types.ll
llvm/test/CodeGen/AArch64/sve-intrinsics-create-tuple.ll
llvm/test/CodeGen/AArch64/sve-intrinsics-loads.ll
since they are now free of warnings related to invalid use of
EVT::getVectorNumElements() and VectorType::getNumElements().
Differential Revision: https://reviews.llvm.org/D82957
Ben Dunbobbin [Wed, 1 Jul 2020 16:49:30 +0000 (17:49 +0100)]
[Support][Windows] Prevent 2s delay when renaming a file that does not exist
Differential Revision: https://reviews.llvm.org/D82542
Nuno Lopes [Thu, 2 Jul 2020 09:27:09 +0000 (10:27 +0100)]
DSE: fix builtin function recognition to take decl into account
Jay Foad [Thu, 2 Jul 2020 09:17:03 +0000 (10:17 +0100)]
[AMDGPU] Fix formatting in MIR tests
Sander de Smalen [Thu, 2 Jul 2020 09:06:41 +0000 (10:06 +0100)]
[CodeGen][SVE] Don't drop scalable flag in DAGCombiner::visitEXTRACT_SUBVECTOR
There was a rogue 'assert' in AArch64ISelLowering for the tuple.get intrinsics,
that shouldn't really have been there (I suspect this was a remnant from when
we expected the wider vector always to have come from a vector CONCAT).
When I tried to create a more minimal reproducer, I found a bug in
DAGCombiner where it drops the scalable flag when trying to fold:
extract_subv (bitcast X), Index --> bitcast (extract_subv X, Index')
This patch fixes both issues.
Reviewers: david-arm, efriedma, spatel
Reviewed By: efriedma
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82910