Georgii Rymar [Mon, 6 Jul 2020 10:45:49 +0000 (13:45 +0300)]
[llvm-readobj] - Refactor ELFDumper<ELFT>::getStaticSymbolName.
This is a followup for D83129.
It is possible to make `getStaticSymbolName` report warnings inside
and return the "<?>" on a error. This allows to encapsulate errors handling
and slightly simplifies the logic in callers code.
Differential revision: https://reviews.llvm.org/D83208
Georgii Rymar [Fri, 3 Jul 2020 13:23:46 +0000 (16:23 +0300)]
[llvm-readobj] - Allow dumping partially corrupted SHT_LLVM_CALL_GRAPH_PROFILE sections.
The code we have currently reports an error if something is not right with the
profile section. Instead we can report a warning and continue dumping when it is possible.
This patch does it.
Differential revision: https://reviews.llvm.org/D83129
Kerry McLaughlin [Tue, 7 Jul 2020 09:35:41 +0000 (10:35 +0100)]
[SVE][CodeGen] Legalisation of unpredicated load instructions
Summary:
When splitting a load of a scalable type, the new address is
calculated in SplitVecRes_LOAD using a vscale and an add instruction.
This patch also adds a DAG combiner fold to visitADD for vscale:
- Fold (add (vscale(C0)), (vscale(C1))) to (add (vscale(C0 + C1)))
Reviewers: sdesmalen, efriedma, david-arm
Reviewed By: david-arm
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82792
Manuel Klimek [Mon, 6 Jul 2020 12:02:54 +0000 (14:02 +0200)]
Hand Allocator and IdentifierTable into FormatTokenLexer.
This allows us to share the allocator in the future so we can create tokens while parsing.
Differential Revision: https://reviews.llvm.org/D83218
Guillaume Chatelet [Tue, 7 Jul 2020 09:54:13 +0000 (09:54 +0000)]
[NFC] Adding the align attribute on Atomic{CmpXchg|RMW}Inst
This is the first step to add support for the align attribute to AtomicRMWInst and AtomicCmpXchgInst.
Next step is to add support in IRBuilder and BitcodeReader.
Bug: https://bugs.llvm.org/show_bug.cgi?id=27168
Differential Revision: https://reviews.llvm.org/D83136
Pavel Labath [Mon, 6 Jul 2020 09:04:58 +0000 (11:04 +0200)]
[lldb/DWARF] Add a utility function for (forceful) completion of types
Summary:
Unify the code for requiring a complete type and move it into a single
place. The only functional change is that the "cannot start a definition
of an incomplete type" is upgrated from a runtime error/warning to an
lldbassert. An plain assert might also be fine, since (AFAICT) this can
only happen in case of a programmer error.
Reviewers: teemperor, aprantl, shafik
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D83199
Georgii Rymar [Thu, 2 Jul 2020 10:38:42 +0000 (13:38 +0300)]
[llvm-readobj] - Fix a crash scenario in GNUStyle<ELFT>::printHashSymbols().
We might crash when the dynamic symbols table is empty (or not found)
and --hash-symbols is requested. Both .hash and .gnu.hash logic is affected.
The patch fixes this issue.
Differential revision: https://reviews.llvm.org/D83037
Kiran Kumar T P [Tue, 7 Jul 2020 08:56:22 +0000 (14:26 +0530)]
[flang][OpenMP] Enhance parser support for flush construct to OpenMP 5.0
Summary:
This patch enhances parser support for flush construct to OpenMP 5.0 by including memory-order-clause.
2.18.8 flush Construct
!$omp flush [memory-order-clause] [(list)]
where memory-order-clause is
acq_rel
release
acquire
The patch includes code changes and testcase modifications.
Reviewed By: klausler, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D82177
River Riddle [Tue, 7 Jul 2020 08:35:23 +0000 (01:35 -0700)]
[mlir][NFC] Remove usernames and google bug numbers from TODO comments.
These were largely leftover from when MLIR was a google project, and don't really follow LLVM guidelines.
David Sherwood [Fri, 19 Jun 2020 08:06:21 +0000 (09:06 +0100)]
[SVE] Add more warnings checks to clang and LLVM SVE tests
There are now more SVE tests in LLVM and Clang that do not
emit warnings related to invalid use of EVT::getVectorNumElements()
and VectorType::getNumElements(). For these tests I have added
additional checks that there are no warnings in order to prevent
any future regressions.
Differential Revision: https://reviews.llvm.org/D82943
David Sherwood [Thu, 25 Jun 2020 07:19:49 +0000 (08:19 +0100)]
[SVE][CodeGen] Fix bug when falling back to DAG ISel
In an earlier commit
584d0d5c1749c13625a5d322178ccb4121eea610 I
added functionality to allow AArch64 CodeGen support for falling
back to DAG ISel when Global ISel encounters scalable vector
types. However, it seems that we were not falling back early
enough as llvm::getLLTForType was still being invoked for scalable
vector types.
I've added a new fallback function to the call lowering class in
order to catch this problem early enough, rather than wait for
lowerFormalArguments to reject scalable vector types.
Differential Revision: https://reviews.llvm.org/D82524
David Sherwood [Mon, 29 Jun 2020 08:39:22 +0000 (09:39 +0100)]
[CodeGen] Fix warnings in sve-vector-splat.ll and sve-trunc.ll
This patch fixes all remaining warnings in:
llvm/test/CodeGen/AArch64/sve-trunc.ll
llvm/test/CodeGen/AArch64/sve-vector-splat.ll
I hit some warnings related to getCopyPartsToVector. I fixed two
issues:
1. In widenVectorToPartType() we assumed that we'd always be
using BUILD_VECTOR nodes to expand from one vector type to another,
which is incorrect for scalable vector types. I've fixed this for now
by simply bailing out immediately for scalable vectors.
2. In getCopyToPartsVector() I've changed the code to compare
the element counts of different types.
Differential Revision: https://reviews.llvm.org/D83028
Craig Topper [Tue, 7 Jul 2020 07:27:50 +0000 (00:27 -0700)]
[X86] Add 64bit and retpoline-external-thunk to list of featuers in X86TargetParser.def.
'64bit' shows up from -march=native on 64-bit capable CPUs.
'retpoline-eternal-thunk' isn't a real feature but shows up
when -mretpoline-external-thunk is passed to clang.
Craig Topper [Tue, 7 Jul 2020 07:17:59 +0000 (00:17 -0700)]
[X86] Remove assert for missing features from X86::getImpliedFeatures
This is failing on the bots. Remove while I try to figure out
what feature I missed in the table.
Craig Topper [Tue, 7 Jul 2020 06:50:41 +0000 (23:50 -0700)]
[X86] Merge X86TargetInfo::setFeatureEnabled and X86TargetInfo::setFeatureEnabledImpl. NFC
setFeatureEnabled is a virtual function. setFeatureEnabledImpl
was its implementation. This split was to avoid virtual calls
when we need to call setFeatureEnabled in initFeatureMap.
With C++11 we can use 'final' on setFeatureEnabled to enable
the compiler to perform de-virtualization for the initFeatureMap
calls.
Carl Ritson [Tue, 7 Jul 2020 06:40:35 +0000 (15:40 +0900)]
[AMDGPU] Update isFMAFasterThanFMulAndFAdd assumptions
MAD/MAC is no longer always available.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D83207
Saiyedul Islam [Tue, 7 Jul 2020 06:15:26 +0000 (06:15 +0000)]
[libomptarget] Implement atomic inc and fence functions for AMDGCN using clang builtins
This function uses __builtin_amdgcn_atomic_inc32():
uint32_t atomicInc(uint32_t *address, uint32_t max);
These functions use __builtin_amdgcn_fence():
__kmpc_impl_threadfence()
__kmpc_impl_threadfence_block()
__kmpc_impl_threadfence_system()
They will take place of current mechanism of directly calling IR functions.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D83132
Saiyedul Islam [Tue, 7 Jul 2020 06:13:43 +0000 (06:13 +0000)]
[AMDGPU] Change Clang AMDGCN atomic inc/dec builtins to take unsigned values
builtin_amdgcn_atomic_inc32(uint *Ptr, uint Val, unsigned MemoryOrdering, const char *SyncScope)
builtin_amdgcn_atomic_inc64(uint64_t *Ptr, uint64_t Val, unsigned MemoryOrdering, const char *SyncScope)
builtin_amdgcn_atomic_dec32(uint *Ptr, uint Val, unsigned MemoryOrdering, const char *SyncScope)
builtin_amdgcn_atomic_dec64(uint64_t *Ptr, uint64_t Val, unsigned MemoryOrdering, const char *SyncScope)
As AMDGCN IR instrinsic for atomic inc/dec does unsigned comparison,
these clang builtins should also take unsigned types instead of signed
int types.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D83121
Craig Topper [Tue, 7 Jul 2020 05:47:54 +0000 (22:47 -0700)]
[X86] Move the feature dependency handling in X86TargetInfo::setFeatureEnabledImpl to a table based lookup in X86TargetParser.cpp
Previously we had to specify the forward and backwards feature dependencies separately which was error prone. And as dependencies have gotten more complex it was hard to be sure the transitive dependencies were handled correctly. The way it was written was also not super readable.
This patch replaces everything with a table that lists what features a feature is dependent on directly. Then we can recursively walk through the table to find the transitive dependencies. This is largely based on how we handle subtarget features in the MC layer from the tablegen descriptions.
Differential Revision: https://reviews.llvm.org/D83273
Max Kazantsev [Tue, 7 Jul 2020 06:03:30 +0000 (13:03 +0700)]
[Test] Add one more missing optimization opportunity test
Craig Topper [Tue, 7 Jul 2020 05:11:17 +0000 (22:11 -0700)]
[X86] Remove duplicate SSE4A feature bit from X86TargetParser.def. NFC
We had both SSE4A and SSE4_A. So remove one of them.
Martin Waitz [Tue, 7 Jul 2020 04:40:01 +0000 (04:40 +0000)]
[mlir] resolve types from attributes in assemblyFormat
An operation can specify that an operation or result type matches the
type of another operation, result, or attribute via the `AllTypesMatch`
or `TypesMatchWith` constraints.
Use these constraints to also automatically resolve types in the
automatically generated assembly parser.
This way, only the attribute needs to be listed in `assemblyFormat`,
e.g. for constant operations.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D78434
Sameer Arora [Mon, 6 Jul 2020 21:53:24 +0000 (14:53 -0700)]
[llvm-install-name-tool] Merge install-name options
This diff merges all options for llvm-install-name-tool under a single
function processLoadCommands. Also adds another test case for -add_rpath
option.
Test plan: make check-all
Reviewed by: jhenderson, alexshap, smeenai, Ktwu
Differential Revision: https://reviews.llvm.org/D82812
Nemanja Ivanovic [Tue, 7 Jul 2020 03:06:53 +0000 (22:06 -0500)]
[PowerPC] Do not RAUW combined nodes in VECTOR_SHUFFLE legalization
When legalizing shuffles, we make an attempt to combine it into
a PPC specific canonical form that avoids a need for a swap. If the
combine is successful, we RAUW the node and the custom legalization
replaces the now dead node instead of the one it should replace.
Remove that erroneous call to RAUW.
LLVM GN Syncbot [Tue, 7 Jul 2020 02:20:39 +0000 (02:20 +0000)]
[gn build] Port
939d8309dbd
Valentin Clement [Tue, 7 Jul 2020 02:19:43 +0000 (22:19 -0400)]
[openmp] Move isAllowedClauseForDirective to tablegen + add clause version to OMP.td
Summary:
Generate the isAllowedClauseForDirective function from tablegen. This patch introduce
the VersionedClause in the tablegen file so that clause can be encapsulated in this class to
specify a range of validity on a directive.
VersionedClause has default minVersion, maxVersion so it can be used without them or
minVersion.
Reviewers: jdoerfert, jdenny
Reviewed By: jdenny
Subscribers: yaxunl, hiraditya, guansong, jfb, sstefan1, aaron.ballman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82982
Xiang1 Zhang [Tue, 7 Jul 2020 01:50:17 +0000 (09:50 +0800)]
[X86-64] Support Intel AMX Intrinsic
INTEL ADVANCED MATRIX EXTENSIONS (AMX).
AMX is a new programming paradigm, it has a set of 2-dimensional registers
(TILES) representing sub-arrays from a larger 2-dimensional memory image and
operate on TILES.
These intrinsics use direct TMM register number as its params.
Spec can be found in Chapter 3 here https://software.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D83111
Mauricio Sifontes [Tue, 7 Jul 2020 01:59:11 +0000 (01:59 +0000)]
Create the framework and testing environment for MLIR Reduce - a tool
with the objective to reduce large test cases into smaller ones while
preserving their interesting behavior.
Implement the framework to parse the command line arguments, parse the
input MLIR test case into a module and call reduction passes on the MLIR module.
Implement the Tester class which allows the different reduction passes to test the
interesting behavior of the generated reduced variants of the test case and keep track
of the most reduced generated variant.
Biplob Mishra [Mon, 6 Jul 2020 23:49:19 +0000 (18:49 -0500)]
[PowerPC] Implement Vector Splat Immediate Builtins in Clang
Implements builtins for the following prototypes:
vector signed int vec_splati (const signed int);
vector float vec_splati (const float);
vector double vec_splatid (const float);
vector signed int vec_splati_ins (vector signed int, const unsigned int,
const signed int);
vector unsigned int vec_splati_ins (vector unsigned int, const unsigned int,
const unsigned int);
vector float vec_splati_ins (vector float, const unsigned int, const float);
Differential Revision: https://reviews.llvm.org/D82520
Amy Kwan [Tue, 7 Jul 2020 00:58:04 +0000 (19:58 -0500)]
[PowerPC][Power10] Exploit the xxsplti32dx instruction when lowering VECTOR_SHUFFLE.
This patch aims to exploit the xxsplti32dx XT, IX, IMM32 instruction when lowering VECTOR_SHUFFLEs.
We implement lowerToXXSPLTI32DX when lowering vector shuffles to check if:
- Element size is 4 bytes
- The RHS is a constant vector (and constant splat of 4-bytes)
- The shuffle mask is a suitable mask for the XXSPLTI32DX instruction where it is one of the 32 masks:
<0, 4-7, 2, 4-7>
<4-7, 1, 4-7, 3>
Differential Revision: https://reviews.llvm.org/D83245
Paula Toth [Tue, 7 Jul 2020 01:15:27 +0000 (18:15 -0700)]
[libc] Add documentation for clang-tidy checks.
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: tschuett, ecnelises, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D82846
David Blaikie [Tue, 7 Jul 2020 01:01:57 +0000 (18:01 -0700)]
[ModuloSchedule] Devirtualize PeelingModuloScheduleExpander::expand as it's not needed
The use case is out of tree code deriving from this class - but without
a need to use the base class polymorphically, so skip the virtualization
and virtual dtor.
Post-commit review from
50ac7ce94f34c5f43b02185ae0c33e150e78b044
Jordan Rupprecht [Tue, 7 Jul 2020 00:44:33 +0000 (17:44 -0700)]
Revert "[LV] Enable the LoopVectorizer to create pointer inductions"
This reverts commit
a8fe12065ec8137e55a6a8b35dd5355477c2ac16.
It causes a crash when building gzip. Will post the detailed reduced test case to D81267.
LLVM GN Syncbot [Tue, 7 Jul 2020 00:37:49 +0000 (00:37 +0000)]
[gn build] Port
05f2b5ccfc5
LLVM GN Syncbot [Tue, 7 Jul 2020 00:37:49 +0000 (00:37 +0000)]
[gn build] Port
Nico Weber [Tue, 7 Jul 2020 00:37:02 +0000 (20:37 -0400)]
fix typos to cycle bots
Wolfgang Pieb [Wed, 1 Jul 2020 21:28:52 +0000 (14:28 -0700)]
Correct 3 spelling errors in headers and doc strings.
Amara Emerson [Mon, 6 Jul 2020 22:12:12 +0000 (15:12 -0700)]
Fix sdk version test to use 99.99.99 as a max dummy version instead of 10.99.99.
Was failing on macOS 11 hosts which is > 10.99.99
Sanjay Patel [Mon, 6 Jul 2020 22:03:55 +0000 (18:03 -0400)]
[DAGCombiner] reassociate reciprocal sqrt expression to eliminate FP division
X / (fabs(A) * sqrt(Z)) --> X / sqrt(A*A*Z) --> X * rsqrt(A*A*Z)
In the motivating case from PR46406:
https://bugs.llvm.org/show_bug.cgi?id=46406
...this is restoring the sequence that was originally in the source code.
We extracted a term from within the sqrt because we do not know in
instcombine whether a target will expand a sqrt call.
Note: we could say that the transform in IR should be restricted, but
that would not solve the problem if the source was originally in the
pattern shown here.
This is a gray area for fast-math-flag requirements. I think we should at
least check fast-math-flags on the fdiv and fmul because I view this
transform as 2 pieces: reassociate the fmul operands and form reciprocal
from the fdiv (as with the existing transform). We could argue that the
sqrt also needs FMF, but that was not required before, so we should change
that in a follow-up patch if that seems better.
We don't currently have a way to check that the target will produce a sqrt
or recip estimate without actually creating nodes (the APIs are SDValue
getSqrtEstimate() and SDValue getRecipEstimate()), so we clean up
speculatively created nodes if we are not able to create an estimate.
The x86 test with doubles verifies that we are not changing a test with
no estimate sequence.
Differential Revision: https://reviews.llvm.org/D82716
Eric Christopher [Mon, 6 Jul 2020 22:39:42 +0000 (15:39 -0700)]
Temporarily Revert "[llvm-install-name-tool] Merge install-name options" as it breaks the objcopy build.
This reverts commit
c143900a0851b2c7b7d52e4825c7f073b3474cf6.
Yuanfang Chen [Mon, 6 Jul 2020 22:10:54 +0000 (15:10 -0700)]
[NFC] change getLimitedCodeGenPipelineReason to static function
Roman Lebedev [Mon, 6 Jul 2020 22:31:36 +0000 (01:31 +0300)]
[NFCI][llvm-reduce] ReduceOperandBundles: actually put Module forward-declaration back into llvm namespace
MinJae Hwang [Mon, 6 Jul 2020 22:29:38 +0000 (18:29 -0400)]
Modifications to the algorithm sort benchmark
Summary:
Modifies the algorithm sort bench:
- shows sorting time per element, instead of sorting time per array.
This would make comparison between different sizes of arrays easier.
- adds std::pair benchmark cases.
- uses a large number of arrays to benchmark, instead of repeatedly sorting the same array.
* sorting the same array again and again would not show actual sorting performance over randomized data sets.
Reviewers: EricWF, #libc, mvels
Reviewed By: EricWF, #libc, mvels
Subscribers: mgrang, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D81770
Peyton, Jonathan L [Mon, 3 Feb 2020 20:29:08 +0000 (14:29 -0600)]
[OpenMP] Add GOMP 5.0 loop entry points
This patch adds missing GOMP_5.0 loop entry points which incorporate
new non-monotonic default into entry point name. Since monotonic
schedules are a subset of nonmonotonic, it is acceptable to use
monotonic as the implementation. This patch simply has the nonmonotonic
(and possibly non-monontonic) versions of the loop entry points as
wrappers around the monotonic ones.
Differential Revision: https://reviews.llvm.org/D73922
Roman Lebedev [Mon, 6 Jul 2020 22:16:37 +0000 (01:16 +0300)]
[llvm-reduce] Reducing call operand bundles
Summary:
This would have been marginally useful to me during/for rG7ea46aee3670981827c04df89b2c3a1cbdc7561b.
With ongoing migration to representing assumes via operand bundles on the assume, this will be gradually more useful.
Reviewers: nickdesaulniers, diegotf, dblaikie, george.burgess.iv, jdoerfert, Tyker
Reviewed By: nickdesaulniers
Subscribers: hiraditya, mgorny, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83177
Roman Lebedev [Mon, 6 Jul 2020 22:16:36 +0000 (01:16 +0300)]
[NFCI][IR] Introduce CallBase::Create() wrapper
Summary:
It is reasonably common to want to clone some call with different bundles.
Let's actually provide an interface to do that.
Reviewers: chandlerc, jdoerfert, dblaikie, nickdesaulniers
Reviewed By: nickdesaulniers
Subscribers: llvm-commits, hiraditya
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83248
Sameer Arora [Mon, 6 Jul 2020 21:53:24 +0000 (14:53 -0700)]
[llvm-install-name-tool] Merge install-name options
This diff merges all options for llvm-install-name-tool under a single
function processLoadCommands. Also adds another test case for -add_rpath
option.
Test plan: make check-all
Reviewed by: jhenderson, alexshap, smeenai, Ktwu
Differential Revision: https://reviews.llvm.org/D82812
Roman Lebedev [Mon, 6 Jul 2020 21:25:19 +0000 (00:25 +0300)]
[Scalarizer] Centralize instruction DCE
As reported in https://reviews.llvm.org/D83101#2133062
the new visitInsertElementInst()/visitExtractElementInst() functionality
is causing miscompiles (previously-crashing test added)
It is due to the fact how the infra of Scalarizer is dealing with DCE,
it was not updated or was it ready for such scalar value forwarding.
It always assumed that the moment we "scalarized" something,
it can go away, and did so with prejudice.
But that is no longer safe/okay to do.
Instead, let's prevent it from ever shooting itself into foot,
and let's just accumulate the instructions-to-be-deleted
in a vector, and collectively cleanup (those that are *actually* dead)
them all at the end.
All existing tests are not reporting any new garbage leftovers,
but maybe it's test coverage issue.
Craig Topper [Mon, 6 Jul 2020 21:58:31 +0000 (14:58 -0700)]
[X86] Centalize the 'sse4' hack to a single place in X86TargetInfo::setFeatureEnabledImpl. NFCI
Instead of detecting the string in 2 places. Just swap the string
to 'sse4.1' or 'sse4.2' at the top of the function.
Prep work for a patch to switch the rest of this function to a
table based system. And I don't want to include 'sse4a' in the
table.
Joachim Protze [Sun, 21 Jun 2020 15:25:20 +0000 (17:25 +0200)]
[OpenMP][Tests] Fix/Mark compatibilty for GCC
Reviewed by: Hahnfeld, saiislam
Differential Revision: https://reviews.llvm.org/D82267
Zixu Wang [Mon, 6 Jul 2020 21:52:12 +0000 (14:52 -0700)]
[clang] Enable errors for undefined TARGET_OS_ macros in Darwin driver
Add clang option `-Wundef-prefix=TARGET_OS_` and `-Werror=undef-prefix`
to Darwin driver.
Differential Revision: https://reviews.llvm.org/D83250
Eric Christopher [Mon, 6 Jul 2020 21:49:21 +0000 (14:49 -0700)]
Fix [-Werror,-Wsign-compare] in dominator unit test.
Bruno Ricci [Mon, 6 Jul 2020 21:37:30 +0000 (22:37 +0100)]
[Support][NFC] Fix Wdocumentation warning in ADT/Bitfields.h
\tparam is used for template parameters instead of \param.
Stanislav Mekhanoshin [Thu, 2 Jul 2020 19:02:39 +0000 (12:02 -0700)]
[AMDGPU] Tweak getTypeLegalizationCost()
Even though wide vectors are legal they still cost more as we
will have to eventually split them. Not all operations can
be uniformly done on vector types.
Conservatively add the cost of splitting at least to 8 dwords,
which is our widest possible load.
We are more or less lying to cost mode with this change but
this can prevent vectorizer from creation of wide vectors which
results in RA problems for us.
Differential Revision: https://reviews.llvm.org/D83078
Bruno Ricci [Mon, 6 Jul 2020 20:50:23 +0000 (21:50 +0100)]
[clang] Rework how and when APValues are dumped
Currently APValues are dumped as a single string. This becomes quickly
completely unreadable since APValue is a tree-like structure. Even a simple
example is not pretty:
struct S { int arr[4]; float f; };
constexpr S s = { .arr = {1,2}, .f = 3.1415f };
// Struct fields: Array: Int: 1, Int: 2, 2 x Int: 0, Float: 3.141500e+00
With this patch this becomes:
-Struct
|-field: Array size=4
| |-elements: Int 1, Int 2
| `-filler: 2 x Int 0
`-field: Float 3.141500e+00
Additionally APValues are currently only dumped as part of visiting a
ConstantExpr. This patch also dump the value of the initializer of constexpr
variable declarations:
constexpr int foo(int a, int b) { return a + b - 42; }
constexpr int a = 1, b = 2;
constexpr int c = foo(a, b) > 0 ? foo(a, b) : foo(b, a);
// VarDecl 0x62100008aec8 <col:3, col:57> col:17 c 'const int' constexpr cinit
// |-value: Int -39
// `-ConditionalOperator 0x62100008b4d0 <col:21, col:57> 'int'
// <snip>
Do the above by moving the dump functions to TextNodeDumper which already has
the machinery to display trees. The cases APValue::LValue, APValue::MemberPointer
and APValue::AddrLabelDiff are left as they were before (unimplemented).
We try to display multiple elements on the same line if they are considered to
be "simple". This is to avoid wasting large amounts of vertical space in an
example like:
constexpr int arr[8] = {0,1,2,3,4,5,6,7};
// VarDecl 0x62100008bb78 <col:3, col:42> col:17 arr 'int const[8]' constexpr cinit
// |-value: Array size=8
// | |-elements: Int 0, Int 1, Int 2, Int 3
// | `-elements: Int 4, Int 5, Int 6, Int 7
Differential Revision: https://reviews.llvm.org/D83183
Reviewed By: aaron.ballman
Matt Arsenault [Sun, 5 Jul 2020 17:17:02 +0000 (13:17 -0400)]
AMDGPU/GlobalISel: Add types to special inputs
When passing special ABI inputs, we have no existing context for the
type to use.
Arlo Siemsen [Mon, 6 Jul 2020 20:17:22 +0000 (13:17 -0700)]
Add option LLVM_NM to allow specifying the location of the llvm-nm tool
The new option works like the existing LLVM_TABLEGEN, and
LLVM_CONFIG_PATH options. Instead of building llvm-nm, the build uses
the executable defined by LLVM_NM.
This is useful for cross-compilation scenarios where the host cannot run
the cross-compiled tool, and recursing into another cmake build is not
an option (due to required DEFINE's, for example).
Reviewed By: smeenai
Differential Revision: https://reviews.llvm.org/D83022
Adrian Prantl [Mon, 6 Jul 2020 20:15:28 +0000 (13:15 -0700)]
Use CMAKE_OSX_SYSROOT instead of the environment variable SYSROOT
to detect energy support in debugserver. The way that Swift
build-script is invoked the former may be overridden manually.
<rdar://problem/
63840635>
Tim Keith [Mon, 6 Jul 2020 20:03:00 +0000 (13:03 -0700)]
[flang] Add missing include for std::min
This was causing the build to fail on macos.
Differential Revision: https://reviews.llvm.org/D83237
Nicolai Hähnle [Wed, 24 Jun 2020 08:32:55 +0000 (10:32 +0200)]
DomTree: add private create{Child,Node} helpers
Summary:
Aside from unifying the code a bit, this change smooths the
transition to use of future "opaque generic block references"
in the type-erased dominator tree base class.
Change-Id: If924b092cc8561c4b6a7450fe79bc96df0e12472
Reviewers: arsenm, RKSimon, mehdi_amini, courbet
Subscribers: wdng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83086
Nicolai Hähnle [Mon, 18 May 2020 14:28:28 +0000 (16:28 +0200)]
DomTree: Remove getRoots() accessor
Summary:
Avoid exposing details about how roots are stored. This enables subsequent
type-erasure changes.
v5:
- cleanup a unit test by using EXPECT_EQ instead of EXPECT_TRUE
Change-Id: I532b774cc71f2224e543bc7d79131d97f63f093d
Reviewers: arsenm, RKSimon, mehdi_amini, courbet
Subscribers: jvesely, wdng, hiraditya, kuhar, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83085
Nicolai Hähnle [Mon, 18 May 2020 14:28:26 +0000 (16:28 +0200)]
DomTree: Remove the releaseMemory() method
Summary:
It is fully redundant with reset().
Change-Id: I25850b9f08eace757cf03cbb8780e970aca7f51a
Reviewers: arsenm, RKSimon, mehdi_amini, courbet
Subscribers: wdng, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D83084
Nicolai Hähnle [Mon, 18 May 2020 14:28:24 +0000 (16:28 +0200)]
DomTree: Remove getChildren() accessor
Summary:
Avoid exposing details about how children are stored. This will enable
subsequent type-erasure changes.
New methods are introduced to cover common access patterns.
Change-Id: Idb5f4b1b9c84e4cc71ddb39bb52a388682f5674f
Reviewers: arsenm, RKSimon, mehdi_amini, courbet
Subscribers: qcolombet, sdardis, wdng, hiraditya, jrtc27, zzheng, atanasyan, asbirlea, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83083
Wouter van Oortmerssen [Fri, 26 Jun 2020 23:59:02 +0000 (16:59 -0700)]
[WebAssembly] Added 64-bit memory.grow/size/copy/fill
This covers both the existing memory functions as well as the new bulk memory proposal.
Added new test files since changes where also required in the inputs.
Also removes unused init/drop intrinsics rather than trying to make them work for 64-bit.
Differential Revision: https://reviews.llvm.org/D82821
Paula Toth [Mon, 6 Jul 2020 19:43:29 +0000 (12:43 -0700)]
[libc] Add documentation for integration tests.
Reviewers: sivachandra
Reviewed By: sivachandra
Subscribers: MaskRay, tschuett, ecnelises, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D82907
Wouter van Oortmerssen [Tue, 30 Jun 2020 00:53:09 +0000 (17:53 -0700)]
[WebAssembly] 64-bit memory limits
Kazushi (Jam) Marukawa [Mon, 6 Jul 2020 18:49:59 +0000 (03:49 +0900)]
[VE] Support symbol with offset in assembly
Summary:
Change MCExpr to support Aurora VE's modifiers. Change asmparser to use
existing MCExpr parser (parseExpression) to parse an expression contining
symbols with modifiers and offsets. Also add several regression tests
of MC layer.
Reviewers: simoll, k-ishizaka
Reviewed By: simoll
Subscribers: hiraditya, llvm-commits
Tags: #llvm, #ve
Differential Revision: https://reviews.llvm.org/D83170
Julian Lettner [Fri, 12 Jun 2020 00:34:39 +0000 (17:34 -0700)]
[Sanitizer] Fix demangling for Swift symbol names
The Swift symbol name prefix has changed from `_T0` to `_$s` as
documented here [1]. This prevents Swift names from properly being
symbolicated when using the in-process LLVM symbolizer. The best way to
fix this seems to be to avoid the duplication of "Is this a Swift symbol
name?" here. We can simply remove this check as `swift_demangle`
already returns null for non-Swift names [2,3].
The check was included in the initial support for Swift name demangling
to avoid superfluous calls to `dlsym()` [4]. A subsequent commit
changed this logic to retrieve the `swift_demangle` function pointer
eagerly during sanitizer initialization, but did not remove the check
[5].
[1] https://github.com/apple/swift/blob/master/docs/ABI/Mangling.rst
[2] https://github.com/apple/swift/blob/
b5a8b518eae54cea997f3b0954760fc7858829f6/include/swift/Demangling/Demangle.h#L643
[3] https://github.com/apple/swift/blob/
b5a8b518eae54cea997f3b0954760fc7858829f6/stdlib/public/runtime/Demangle.cpp#L656
[4] https://reviews.llvm.org/D19135
[5] https://reviews.llvm.org/D20015
rdar://
62753845
Reviewers: kubamracek, delcypher, dcoughlin, samsonov, thakis
Reviewed By: kubamracek
Differential Revision: https://reviews.llvm.org/D81705
William S. Moses [Mon, 6 Jul 2020 19:00:29 +0000 (12:00 -0700)]
[ELF] Drop an unneeded reference to `symtab` from SymbolTable::addSymbol
The Symbol Table in LLD references the global object to add a symbol rather than adding it to itself.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D83184
Kevin P. Neal [Mon, 6 Jul 2020 18:54:56 +0000 (14:54 -0400)]
Revert "[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking support."
My mistake, I had a blocking reviewer.
This reverts commit
39d2ae0afb2312a15e4d15a0855b35b4e1c49fc4.
This reverts commit
bfdafa32a0fa4b2745627fe57dd253db10ac3fcf.
This reverts commit
2b35511350454dd22997f129ee529e3fdb129ac2.
Differential Revision: https://reviews.llvm.org/D80952
Kazushi (Jam) Marukawa [Mon, 6 Jul 2020 18:35:31 +0000 (03:35 +0900)]
[VE] Change to use isa
Summary: Change to use isa instead of dyn_cast to avoid a warning.
Reviewers: simoll, k-ishizaka
Reviewed By: simoll
Subscribers: hiraditya, llvm-commits
Tags: #llvm, #ve
Differential Revision: https://reviews.llvm.org/D83200
Kevin P. Neal [Mon, 6 Jul 2020 18:41:15 +0000 (14:41 -0400)]
[FPEnv][Clang][Driver] Failing tests are now expected failures only on PowerPC
Mark these tests as only failing on PowerPC. Avoids unexpected passes on
other bots.
Fingers crossed.
Differential Revision: https://reviews.llvm.org/D80952
Matt Arsenault [Fri, 19 Jun 2020 19:45:16 +0000 (15:45 -0400)]
AMDGPU: Don't ignore carry out user when expanding add_co_pseudo
This was resulting in a missing vreg def in the use select
instruction.
The output of the pseudo doesn't make sense, since it really shouldn't
have the vreg output in the first place, and instead an implicit scc
def to match the real scalar behavior.
We could have easier to understand tests if we selected scalar
versions of the [us]{add|sub}.with.overflow intrinsics.
This does still end up producing vector code in the end, since it gets
moved later.
Pete Steinfeld [Tue, 30 Jun 2020 19:03:28 +0000 (12:03 -0700)]
[flang] Bug fix for ambiguous references to data and functions
Summary:
A program may erroneously reference the same name as both a data object
and as a function. Some of these references were causing an internal
error in expression analysis.
It was already the case that a symbol referenced in a parse tree for a
call was changed from an `Entity` to a `ProcEntity`. I added code to
detect when a symbol was referenced in a parse tree as an array element
gets changed from an `Entity` to an `ObjectEntity`. Then, if an
`ObjectEntity` gets called as a function or a `ProcEntity` gets
referenced as a data object, errors get emitted.
This analysis was previously confined to the name resolution of the
specification part of a `ProgramTree`. I added a pass to the execution
part of a `ProgramTree` to catch names declared in blocks.
Reviewers: tskeith, klausler, DavidTruby
Subscribers: llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D82903
Kevin P. Neal [Mon, 6 Jul 2020 18:20:49 +0000 (14:20 -0400)]
[FPEnv][Clang][Driver] Failing tests are now expected failures.
These are now expected failures on PowerPC. They can be reenabled when
PowerPC is ready.
Differential Revision: https://reviews.llvm.org/D80952
Zequan Wu [Wed, 24 Jun 2020 01:05:49 +0000 (18:05 -0700)]
[SemaCXX] Fix false positive of -Wuninitialized-const-reference in empty function body.
Summary:
Some libraries use empty function to ignore unused variable warnings, which gets a new warning from `-Wuninitialized-const-reference`, discussed here https://reviews.llvm.org/D79895#2107604.
This patch should fix that.
Reviewers: hans, nick, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: aaron.ballman, riccibruno, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82425
peter klausler [Sat, 4 Jul 2020 21:24:32 +0000 (14:24 -0700)]
[flang] Basic tests of external I/O runtime (part 9/9)
Add new unit tests for external Fortran I/O that drive the
Fortran I/O runtime API from C++ and exercise basic writing
and read-back in the various combinations of access modes,
record length variability, and formatting. Sequential modes
are tested with positioning. More thorough tests written in
Fortran will follow when they can be compiled and run.
The Fortran runtime's error termination callback registration
was extended with source file and line number positions for
better failure messages in unit testing.
Reviewed By: sscalpone
Differential Revision: https://reviews.llvm.org/D83164
Kevin P. Neal [Mon, 6 Jul 2020 15:52:42 +0000 (11:52 -0400)]
[FPEnv][Clang][Driver] Disable constrained floating point on targets lacking support.
We currently have strict floating point/constrained floating point enabled
for all targets. Constrained SDAG nodes get converted to the regular ones
before reaching the target layer. In theory this should be fine.
However, the changes are exposed to users through multiple clang options
already in use in the field, and the changes are _completely_ _untested_
on almost all of our targets. Bugs have already been found, like
"https://bugs.llvm.org/show_bug.cgi?id=45274".
This patch disables constrained floating point options in clang everywhere
except X86 and SystemZ. A warning will be printed when this happens.
Differential Revision: https://reviews.llvm.org/D80952
Jacques Pienaar [Mon, 6 Jul 2020 16:55:10 +0000 (09:55 -0700)]
[mlir] Change ODS to have include and exclude regex
This makes it easier to have a "remainder" include rule. And also makes it easier to read the command line flag.
Shuhong Liu [Fri, 3 Jul 2020 21:14:11 +0000 (17:14 -0400)]
[AIX] Add system-aix to lit config file
Summary: This is a complementary patch to D82100 since the aix builbot is still running the unsupported test shtest-format-argv0. Add system-aix to the sub llvm-lit config.
Reviewers: daltenty, hubert.reinterpretcast
Reviewed By: hubert.reinterpretcast
Subscribers: delcypher, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82905
Fangrui Song [Mon, 6 Jul 2020 16:47:53 +0000 (09:47 -0700)]
[ELF][ARM] Represent R_ARM_LDO32 as R_DTPREL instead of R_ABS
Follow-up to D82899. Note, we need to disable R_DTPREL relaxation
because ARM psABI does not define TLS relaxation.
Reviewed By: grimar, psmith
Differential Revision: https://reviews.llvm.org/D83138
Luís Marques [Wed, 24 Jun 2020 12:53:27 +0000 (13:53 +0100)]
[RISCV] Fold ADDIs into load/stores with nonzero offsets
We can often fold an ADDI into the offset of load/store instructions:
(load (addi base, off1), off2) -> (load base, off1+off2)
(store val, (addi base, off1), off2) -> (store val, base, off1+off2)
This is possible when the off1+off2 continues to fit the 12-bit immediate.
We remove the previous restriction where we would never fold the ADDIs if
the load/stores had nonzero offsets. We now do the fold the the resulting
constant still fits a 12-bit immediate, or if off1 is a variable's address
and we know based on that variable's alignment that off1+offs2 won't overflow.
Differential Revision: https://reviews.llvm.org/D79690
Rahul Joshi [Thu, 2 Jul 2020 00:54:12 +0000 (17:54 -0700)]
[MLIR] Add a NoRegionArguments trait
- This trait will verify that all regions attached to an Op have no arguments
- Fixes https://bugs.llvm.org/show_bug.cgi?id=46521 : Add trait NoRegionArguments
Differential Revision: https://reviews.llvm.org/D83016
Bruno Ricci [Mon, 6 Jul 2020 15:48:50 +0000 (16:48 +0100)]
[clang][utils] make-ast-dump-check.sh: strip line and column numbers when generating serialization tests
Raphael Isemann [Mon, 6 Jul 2020 15:36:49 +0000 (17:36 +0200)]
[clang] Fix modules build after D82585
Just getting the bots running again.
See the D82585 for more info.
jasonliu [Mon, 6 Jul 2020 14:18:06 +0000 (14:18 +0000)]
[XCOFF][AIX] Give symbol an internal name when desired symbol name contains invalid character(s)
Summary:
When a desired symbol name contains invalid character that the
system assembler could not process, we need to emit .rename
directive in assembly path in order for that desired symbol name
to appear in the symbol table.
Reviewed By: hubert.reinterpretcast, DiggerLin, daltenty, Xiangling_L
Differential Revision: https://reviews.llvm.org/D82481
Oliver Stannard [Tue, 17 Mar 2020 14:13:32 +0000 (14:13 +0000)]
[Support] Fix formatted_raw_ostream for UTF-8
* The getLine and getColumn functions need to update the position, or
they will return stale data for buffered streams. This fixes a bug in
the clang -analyzer-checker-option-help option, which was not wrapping
the help text correctly when stdout is not a TTY.
* If the stream contains multi-byte UTF-8 sequences, then the whole
sequence needs to be considered to be a single character. This has the
edge case that the buffer might fill up and be flushed part way
through a character.
* If the stream contains East Asian wide characters, these will be
rendered twice as wide as other characters, so we need to increase the
column count to match.
This doesn't attempt to handle everything unicode can do (combining
characters, right-to-left markers, ...), but hopefully covers most
things likely to be common in messages and source code we might want to
print.
Differential revision: https://reviews.llvm.org/D76291
Haojian Wu [Mon, 6 Jul 2020 15:12:39 +0000 (17:12 +0200)]
[clangd] More complete fix for hover crashes on invalid record.
We should not call getFieldOffset on invalid record decls.
Differential Revision: https://reviews.llvm.org/D83189
Roman Lebedev [Mon, 6 Jul 2020 14:50:31 +0000 (17:50 +0300)]
Reland "[ScalarEvolution] createSCEV(): recognize `udiv`/`urem` disguised as an `sdiv`/`srem`"
This reverts commit
d3e3f36ff1151f565730977ac4f663a2ccee48ae,
which reverter the original commit
2c16100e6f72075564ea1f67fa5a82c269dafcd3,
but with polly tests now actually passing.
Raphael Isemann [Mon, 6 Jul 2020 14:31:56 +0000 (16:31 +0200)]
[lldb] Always round down in NSDate's formatter to match NSDate's builtin format
Summary:
When printing an NSDate (for example with `NSLog` or `po`) the seconds value is
always rounded down. LLDB's own formatter however isn't following that behaviour
which leads to situations where the formatted result is sometimes one second
off. For example:
```
(lldb) p [NSDate dateWithTimeIntervalSince1970:0.1]
(__NSTaggedDate *) $1 = [...] 1970-01-01 00:00:01 UTC
(lldb) po [NSDate dateWithTimeIntervalSince1970:0.1]
1970-01-01 00:00:00 +0000
(lldb) p [NSDate dateWithTimeIntervalSince1970:0.6]
(__NSTaggedDate *) $4 =[...] 1970-01-01 00:00:01 UTC
(lldb) po [NSDate dateWithTimeIntervalSince1970:0.6]
1970-01-01 00:00:00 +0000
```
This patch just always rounds down the seconds value we get from the NSDate
object.
Fixes rdar://
65084800
Reviewers: mib, davide
Reviewed By: mib
Subscribers: JDevlieghere
Differential Revision: https://reviews.llvm.org/D83221
David Green [Mon, 6 Jul 2020 13:25:16 +0000 (14:25 +0100)]
[ARM] MVE FP16 cost adjustments
This adjusts the MVE fp16 cost model, similar to how we already do for
integer casts. It uses the base cost of 1 per cvt for most fp extend /
truncates, but adjusts it for loads and stores where we know that a
extending load has been used to get the load into the correct lane, and
only an MVE VCVTB is then needed.
Differential Revision: https://reviews.llvm.org/D81813
Haojian Wu [Mon, 6 Jul 2020 14:29:16 +0000 (16:29 +0200)]
[clang] Fix the incorrect dependence bits for DependentExtIntType.
The error-bit was missing, and the unexpandedpack bit seemed to be
set incorrectly.
Reviewed By: sammccall, erichkeane
Differential Revision: https://reviews.llvm.org/D83114
Mikhail Goncharov [Mon, 6 Jul 2020 14:41:59 +0000 (16:41 +0200)]
Revert "[ScalarEvolution] createSCEV(): recognize `udiv`/`urem` disguised as an `sdiv`/`srem`"
Summary:
This reverts commit
2c16100e6f72075564ea1f67fa5a82c269dafcd3.
ninja check-polly fails:
Polly :: Isl/CodeGen/MemAccess/generate-all.ll
Polly :: ScopInfo/multidim_srem.ll
Reviewers: kadircet, bollu
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D83230
Florian Hahn [Mon, 6 Jul 2020 12:52:48 +0000 (13:52 +0100)]
[LV] Pass dbgs() to verifyFunction call.
This is done in other places of the pass already and improves the output
on verification failure.
Saiyedul Islam [Mon, 6 Jul 2020 14:01:21 +0000 (14:01 +0000)]
[OpenMP] Temporarily disable failing runtime tests for OpenMP 5.0
Following tests are failing after upgrading to version 5.0 but are passing
for version 4.5:
1. openmp/runtime/test/env/kmp_set_dispatch_buf.c
2. openmp/runtime/test/worksharing/for/kmp_set_dispatch_buf.c
To be enabled as soon as these tests are fixed.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D82963
Sanjay Patel [Mon, 6 Jul 2020 13:49:50 +0000 (09:49 -0400)]
[x86] add tests for vector select with non-splat bit-test condition; NFC
Goes with D83181.
Nathan James [Mon, 6 Jul 2020 13:44:03 +0000 (14:44 +0100)]
[clang-tidy] Fix incorrect default option in
fc3c693b61
Nathan James [Mon, 6 Jul 2020 13:39:02 +0000 (14:39 +0100)]
[clang-tidy] Added alias llvm-else-after-return.
Added an alias llvm-else-after-return from readability-else-after-return to help enforce one of the llvm coding guidelines.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D82825
Kirstóf Umann [Wed, 27 May 2020 10:27:32 +0000 (12:27 +0200)]
[analyzer] Don't allow hidden checkers to emit diagnostics
Hidden checkers (those marked with Hidden in Checkers.td) are meant for
development purposes only, and are only displayed under
-analyzer-checker-help-developer, so users shouldn't see reports from them.
I moved StdLibraryFunctionsArg checker to the unix package from apiModeling as
it violated this rule. I believe this change doesn't deserve a different
revision because it is in alpha, and the name is so bad anyways I don't
immediately care where it is, because we'll have to revisit it soon enough.
Differential Revision: https://reviews.llvm.org/D81750
David Green [Mon, 6 Jul 2020 10:35:01 +0000 (11:35 +0100)]
[ARM] Adjust default fp extend and trunc costs
This adds some default costs for fp extends and truncates, generally
costing them as 1 per lane. If the type is not legal then the cost will
include a call to an __aeabi_ function.
Some NEON code is also adjusted to make sure it applies to the expected
types, now that fp16 is a more common thing.
Differential Revision: https://reviews.llvm.org/D82458