Dan Albert [Fri, 13 Mar 2020 01:09:44 +0000 (18:09 -0700)]
Revert "Update system_error tests for more platforms."
Can't use std::string::starts_with in tests.
This reverts commit
a9740ff1585a10b9df4296a735512df3e0ff9df5.
Adrian Prantl [Fri, 13 Mar 2020 00:47:27 +0000 (17:47 -0700)]
Convert settings list into a tuple so it can be matched by the decorator.
Dan Albert [Fri, 13 Mar 2020 00:34:55 +0000 (17:34 -0700)]
Update system_error tests for more platforms.
Reviewers: EricWF, mclow.lists, #libc, ldionne
Reviewed By: #libc, ldionne
Subscribers: dexonsmith, libcxx-commits, cfe-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D35732
Evgenii Stepanov [Fri, 13 Mar 2020 00:26:56 +0000 (17:26 -0700)]
[msan] Fix srcaddr handling in recvfrom interceptor.
Recvfrom may receive a 0 byte packet with a non-empty source address.
Dan Albert [Thu, 12 Mar 2020 23:55:13 +0000 (16:55 -0700)]
Move more tests to globalMemCounter and reset.
Summary:
Android's libc uses new/delete internally and these are counted, so
the counter needs to be reset to zero at the start of the test.
Reviewers: EricWF, mclow.lists, #libc, ldionne
Reviewed By: #libc, ldionne
Subscribers: dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D76091
Fangrui Song [Thu, 12 Mar 2020 23:44:47 +0000 (16:44 -0700)]
[ELF] --gdb-index: fix memory usage regression after D74773
On an internal target,
* Before D74773: time -f '%M' =>
18275680
* After D74773: time -f '%M' =>
22088964
This patch restores to the status before D74773.
Raphael Isemann [Thu, 12 Mar 2020 23:39:32 +0000 (00:39 +0100)]
[lldb] Remove unused and too strict error_msg parameter from expect_expr
Directly matching the error message is nearly never useful. We can re-add
error-checking once we have a plan to properly implement this.
Richard Smith [Thu, 12 Mar 2020 23:43:01 +0000 (16:43 -0700)]
Add a test triple to avoid failure under MS ABI.
MS ABI has slightly different rules for when destructors are implicitly
defined and when the 'delete this' is checked that are out of scope for
the intent of this test.
Lei Zhang [Wed, 11 Mar 2020 20:06:07 +0000 (16:06 -0400)]
[mlir][spirv] Support querying type extension/capability requirements
Previously we only consider the version/capability/extension requirements
on ops themselves. Some types in SPIR-V also require special extensions
or capabilities to be used. For example, non-32-bit integers/floats
will require different capabilities and/or extensions depending on
where they are used because it may mean special hardware abilities.
This commit adds query methods to SPIR-V type class hierarchy to support
querying extensions and capabilities. We don't go through ODS for
auto-generating such information given that we don't have them in
SPIR-V machine readable grammar and there are just a few types.
Differential Revision: https://reviews.llvm.org/D75875
Lei Zhang [Wed, 11 Mar 2020 20:05:21 +0000 (16:05 -0400)]
[mlir][spirv] Use SmallVector<ArrayRef> for availability queries
Previously extensions and capabilities requirements are returned as
SmallVector<SmallVector>. It's an anti-pattern; this commit improves
a bit by returning as SmallVector<ArrayRef>. This is possible because
the internal sequence is always known statically (from the spec)
so that we can use a static constant array for it and get an ArrayRef.
Differential Revision: https://reviews.llvm.org/D75874
Lei Zhang [Wed, 11 Mar 2020 20:04:25 +0000 (16:04 -0400)]
[mlir][spirv] Use spv.vce in spv.module and wire up (de)serialization
This commits changes the definition of spv.module to use the #spv.vce
attribute for specifying (version, capabilities, extensions) triple
so that we can have better API and custom assembly form. Since now
we have proper modelling of the triple, (de)serialization is wired up
to use them.
With the new UpdateVCEPass, we don't need to manually specify the
required extensions and capabilities anymore when creating a spv.module.
One just need to call UpdateVCEPass before serialization to get the
needed version/extensions/capabilities.
Differential Revision: https://reviews.llvm.org/D75872
Lei Zhang [Wed, 11 Mar 2020 20:03:43 +0000 (16:03 -0400)]
[mlir][spirv] NFC: put SPIR-V attributes in separate files
Differential Revision: https://reviews.llvm.org/D75871
Lei Zhang [Wed, 11 Mar 2020 20:03:20 +0000 (16:03 -0400)]
[mlir][spirv] Add a pass to deduce version/extension/capability
Creates an operation pass that deduces and attaches the minimal version/
capabilities/extensions requirements for spv.module ops.
For each spv.module op, this pass requires a `spv.target_env` attribute on
it or an enclosing module-like op to drive the deduction. The reason is
that an op can be enabled by multiple extensions/capabilities. So we need
to know which one to pick. `spv.target_env` gives the hard limit as for
what the target environment can support; this pass deduces what are
actually needed for a specific spv.module op.
Differential Revision: https://reviews.llvm.org/D75870
Lei Zhang [Wed, 11 Mar 2020 20:02:56 +0000 (16:02 -0400)]
[mlir][spirv] Use larger range for target environment lookup function
Previously we only look at the directly passed-in op for a potential
spv.target_env attribute. This commit switches to use a larger range
and recursively check enclosing symbol tables.
Differential Revision: https://reviews.llvm.org/D75869
Lei Zhang [Wed, 11 Mar 2020 20:02:46 +0000 (16:02 -0400)]
[mlir][spirv] Use separate attribute for (version, capabilities, extensions)
We also need the (version, capabilities, extensions) triple on the
spv.module op. Thus far we have been using separate 'extensions'
and 'capabilities' attributes there and 'version' is missing. Creating
a separate attribute for the trip allows us to reuse the assembly
form and verification.
Differential Revision: https://reviews.llvm.org/D75868
Jacques Pienaar [Thu, 12 Mar 2020 23:32:21 +0000 (16:32 -0700)]
[mlir] Remove unused generator
This was a previous experiment that didn't pan out and needs to be
replaced, given no current use or tests, deleting instead and can start
new version fresh.
Arlo Siemsen [Thu, 12 Mar 2020 23:25:01 +0000 (16:25 -0700)]
Add support for SHA256 source file checksums in debug info
LLVM currently supports CSK_MD5 and CSK_SHA1 source file checksums in
debug info. This change adds support for CSK_SHA256 checksums.
The SHA256 checksums are supported by the CodeView debug format.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D75785
Nico Weber [Thu, 12 Mar 2020 23:29:09 +0000 (19:29 -0400)]
[gn build] (manually) port
eb41cc619866e
David Blaikie [Thu, 12 Mar 2020 23:17:43 +0000 (16:17 -0700)]
CFGDiff: Fix one place where I'd left BasicBlock* hardcoded
Huihui Zhang [Thu, 12 Mar 2020 22:59:14 +0000 (15:59 -0700)]
[ConstantFold][SVE] Fix constant folding for scalable vector compare instruction.
Summary:
Do not iterate on scalable vector. Also do not return constant scalable vector
from ConstantInt::get().
Fix result type by using getElementCount() instead of getNumElements().
Reviewers: sdesmalen, efriedma, apazos, huntergr, willlovett
Reviewed By: efriedma
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73753
Matt Arsenault [Wed, 11 Mar 2020 21:12:20 +0000 (17:12 -0400)]
AMDGPU: Directly annotate functions if they have calls
Currently we infer whether the flat-scratch-init kernel input should
be enabled based on calls. Move this handling, so we can decide if the
full set of ABI inputs is needed in kernels. Ideally we would have an
analysis of some sort, rather than the function attributes.
Matt Arsenault [Wed, 11 Mar 2020 22:20:00 +0000 (18:20 -0400)]
CodeGen: Add constexpr to Register constructors
Lang Hames [Thu, 12 Mar 2020 21:44:53 +0000 (14:44 -0700)]
[ORC] Enable exception handling in JIT'd code when using LLJIT on Darwin.
This patch enables exception handling in code added to LLJIT on Darwin by
adding an orc::EHFrameRegistrationPlugin instance to the ObjectLinkingLayer
(which is currently used on Darwin only).
Lang Hames [Thu, 12 Mar 2020 22:08:30 +0000 (15:08 -0700)]
[ORC] Add a mutex to guard EHFrameRegistrationPlugin data structures.
These may be accessed from multiple threads if concurrent materialization is
enabled in ORC.
Testcase coming in a follow-up patch that enables eh-frame registration for
LLJIT.
Jonas Devlieghere [Thu, 12 Mar 2020 22:30:34 +0000 (15:30 -0700)]
[lldb/Host] Fix the Windows build
Update use of ProcessInstanceInfoList which is now a std::vector.
Louis Dionne [Tue, 10 Mar 2020 17:44:33 +0000 (13:44 -0400)]
[libc++abi] NFC: Move AtomicInt to cxa_guard_impl.h
Since the atomic_support.h header of libc++abi is considered technical
debt (since we should use libc++'s), it's better not to add new
definitions to it, which makes it diverge from the original libc++
header even more.
Differential Revision: https://reviews.llvm.org/D75950
Nick Desaulniers [Thu, 12 Mar 2020 22:13:55 +0000 (15:13 -0700)]
[clang][Parse] properly parse asm-qualifiers, asm inline
Summary:
The parsing of GNU C extended asm statements was a little brittle and
had a few issues:
- It was using Parse::ParseTypeQualifierListOpt to parse the `volatile`
qualifier. That parser is really meant for TypeQualifiers; an asm
statement doesn't really have a type qualifier. This is still maybe
nice to have, but not necessary. We now can check for the `volatile`
token by properly expanding the grammer, rather than abusing
Parse::ParseTypeQualifierListOpt.
- The parsing of `goto` was position dependent, so `asm goto volatile`
wouldn't parse. The qualifiers should be position independent to one
another. Now they are.
- We would warn on duplicate `volatile`, but the parse error for
duplicate `goto` was a generic parse error and wasn't clear.
- We need to add support for the recent GNU C extension `asm inline`.
Adding support to the parser with the above issues highlighted the
need for this refactoring.
Link: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
Reviewers: aaron.ballman
Reviewed By: aaron.ballman
Subscribers: aheejin, jfb, nathanchance, cfe-commits, echristo, efriedma, rsmith, chandlerc, craig.topper, erichkeane, jyu2, void, srhines
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75563
Stanislav Mekhanoshin [Thu, 12 Mar 2020 18:09:45 +0000 (11:09 -0700)]
[AMDGPU] Simplify exec copies
The patch removes late endcf handling and only leaves the
related portion with redundant exec mask copy elimination.
Differential Revision: https://reviews.llvm.org/D76095
Jonas Devlieghere [Thu, 12 Mar 2020 21:34:44 +0000 (14:34 -0700)]
[lldb] Add YAML traits for ArchSpec and ProcessInstanceInfo
Add YAML traits for ArchSpec and ProcessInstanceInfo so they can be
serialized for the reproducers.
Differential revision: https://reviews.llvm.org/D76004
River Riddle [Thu, 12 Mar 2020 21:22:00 +0000 (14:22 -0700)]
[mlir] Use llvm::ElementCount when constructing an llvm splat vector.
This fixes a breakage after the LLVM API changed.
River Riddle [Thu, 12 Mar 2020 21:06:41 +0000 (14:06 -0700)]
[mlir][SideEffects] Replace HasNoSideEffect with the memory effect interfaces.
HasNoSideEffect can now be implemented using the MemoryEffectInterface, removing the need to check multiple things for the same information. This also removes an easy foot-gun for users as 'Operation::hasNoSideEffect' would ignore operations that dynamically, or recursively, have no side effects. This also leads to an immediate improvement in some of the existing users, such as DCE, now that they have access to more information.
Differential Revision: https://reviews.llvm.org/D76036
River Riddle [Thu, 12 Mar 2020 21:06:14 +0000 (14:06 -0700)]
[mlir] Add a new `ConstantLike` trait to better identify operations that represent a "constant".
The current mechanism for identifying is a bit hacky and extremely adhoc, i.e. we explicit check 1-result, 0-operand, no side-effect, and always foldable and then assume that this is a constant. Adding a trait adds structure to this, and makes checking for a constant much more efficient as we can guarantee that all of these things have already been verified.
Differential Revision: https://reviews.llvm.org/D76020
River Riddle [Thu, 12 Mar 2020 21:06:01 +0000 (14:06 -0700)]
[mlir][NFC] Move the definition of AffineApplyOp to ODS
This has been a long standing cleanup TODO.
Differential Revision: https://reviews.llvm.org/D76019
River Riddle [Thu, 12 Mar 2020 21:05:41 +0000 (14:05 -0700)]
[mlir][SideEffects][NFC] Move the .td definitions for NoSideEffect/RecursiveSideEffect to SideEffects.td
This matches the location of these traits within the source files.
Differential Revision: https://reviews.llvm.org/D75968
River Riddle [Thu, 12 Mar 2020 21:05:27 +0000 (14:05 -0700)]
[mlir][SideEffects] Mark the CFG only terminator operations as NoSideEffect
These terminator operations don't really have any side effects, and this allows for more accurate side-effect analysis for region operations. For example, currently we can't detect like a loop.for or affine.for are dead because the affine.terminator is "side effecting".
Note: Marking as NoSideEffect doesn't mean that these operations can be opaquely erased.
Differential Revision: https://reviews.llvm.org/D75888
Mark de Wever [Thu, 12 Mar 2020 21:23:46 +0000 (22:23 +0100)]
Revert "[libcxx] Enable C++17 for the benchmarks."
It seems several build bots have issues with setting the CXX_STANDARD
property to 17.
This reverts commit
d184d0226301d8bb8b3fdaee52bb636faddd81bc.
Jonas Devlieghere [Thu, 12 Mar 2020 21:10:25 +0000 (14:10 -0700)]
[lldb/Utility] Replace ProcessInstanceInfoList with std::vector. (NFCI)
Replace ProcessInstanceInfoList with std::vector<ProcessInstanceInfo>
and update the call sites.
aartbik [Thu, 12 Mar 2020 20:10:47 +0000 (13:10 -0700)]
[mlir] [VectorOps] Progressively lower vector.outerproduct to LLVM
Summary:
This replaces the direct lowering of vector.outerproduct to LLVM with progressive lowering into elementary vectors ops to avoid having the similar lowering logic at several places.
NOTE1: with the new progressive rule, the lowered llvm is slightly more elaborate than with the direct lowering, but the generated assembly is just as optimized; still if we want to stay closer to the original, we should add a "broadcast on extract" to shuffle rewrite (rather than special cases all the lowering steps)
NOTE2: the original outerproduct lowering code should now be removed but some linalg test work directly on vector and contain some dead code, so this requires another CL
Reviewers: nicolasvasilache, andydavis1
Reviewed By: nicolasvasilache, andydavis1
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75956
Alexander Belyaev [Thu, 12 Mar 2020 20:42:33 +0000 (21:42 +0100)]
[MLIR] Reformat LoopOps.td documentation.
Alexander Belyaev [Thu, 12 Mar 2020 20:34:40 +0000 (21:34 +0100)]
[MLIR] Update documentation for loop.reduce.
Mark de Wever [Thu, 12 Mar 2020 20:34:31 +0000 (21:34 +0100)]
[libcxx] Enable C++17 for the benchmarks.
The benchmarks are intended to be build with C++17 but the
CMAKE_CXX_STANDARD in the LLVM forces the build to use C++14 by default.
This fixes the issue by setting the CXX_STANDARD property of the benchmark
targets.
The CMake documentation is not clear whether this will use the C++1z
fallback for older compilers. So this may break the benchmarks if somebody
uses the benchmarks with pre C++17 compilers with the C++1z fallback.
Differential Revision: https://reviews.llvm.org/D75955
Sam McCall [Thu, 5 Mar 2020 21:47:32 +0000 (16:47 -0500)]
[clangd] Add a textual fallback for go-to-definition
Summary:
This facilitates performing go-to-definition in contexts where AST-based
resolution does not work, such as comments, string literals, preprocessor
disabled regions, and macro definitions, based on textual lookup in the index.
Partially fixes https://github.com/clangd/clangd/issues/241
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72874
Huihui Zhang [Thu, 12 Mar 2020 20:15:34 +0000 (13:15 -0700)]
[SVE] Update API ConstantVector::getSplat() to use ElementCount.
Summary:
Support ConstantInt::get() and Constant::getAllOnesValue() for scalable
vector type, this requires ConstantVector::getSplat() to take in 'ElementCount',
instead of 'unsigned' number of element count.
This change is needed for D73753.
Reviewers: sdesmalen, efriedma, apazos, spatel, huntergr, willlovett
Reviewed By: efriedma
Subscribers: tschuett, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74386
Simon Pilgrim [Thu, 12 Mar 2020 20:16:40 +0000 (20:16 +0000)]
[AMDGPU] Add ISD::FSHR -> ALIGNBIT support
This patch allows ISD::FSHR(i32) patterns to lower to ALIGNBIT instructions.
This improves test coverage of ISD::FSHR matching - x86 has both FSHL/FSHR instructions and we prefer FSHL by default.
Differential Revision: https://reviews.llvm.org/D76070
Richard Smith [Wed, 11 Mar 2020 20:49:28 +0000 (13:49 -0700)]
Defer checking for mismatches between the deletedness of and overriding
function and an overridden function until we know whether the overriding
function is deleted.
We previously did these checks when we first built the declaration,
which was too soon in some cases. We now defer all these checks to the
end of the class.
Also add missing check that a consteval function cannot override a
non-consteval function and vice versa.
Simon Pilgrim [Thu, 12 Mar 2020 19:47:08 +0000 (19:47 +0000)]
[DAGCombine] foldVSelectOfConstants - ensure constants are same type
Fix bug identified by https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21167, foldVSelectOfConstants must ensure that the 2 build vectors have scalars of the same type before trying to compare APInt values.
Sid Manning [Thu, 12 Mar 2020 17:18:35 +0000 (12:18 -0500)]
[Hexagon] Enable init_arrays when target is linux-musl
Differential Revision: https://reviews.llvm.org/D76079
Thomas Lively [Thu, 12 Mar 2020 01:08:46 +0000 (18:08 -0700)]
[WebAssembly] Fix SIMD shift unrolling to avoid assertion failure
Summary:
Using the default DAG.UnrollVectorOp on v16i8 and v8i16 vectors
results in i8 or i16 nodes being inserted into the SelectionDAG. Since
those are illegal types, this causes a legalization assertion failure
for some code patterns, as uncovered by PR45178. This change unrolls
shifts manually to avoid this issue by adding and using a new optional
EVT argument to DAG.ExtractVectorElements to control the type of the
extract_element nodes.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, zzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D76043
Tatyana Krasnukha [Thu, 12 Mar 2020 18:48:23 +0000 (21:48 +0300)]
[lldb] Specify default value for platform.module-cache-directory
In addition to the commit rG352f16db87f583ec7f55f8028647b5fd8616111f,
this one fixes settings behavior on clearing - the setting should be
reverted to their default value, not an empty one.
David Green [Thu, 12 Mar 2020 14:57:40 +0000 (14:57 +0000)]
[ARM] Long shift tests. NFC
Sterling Augustine [Thu, 12 Mar 2020 18:52:13 +0000 (11:52 -0700)]
Add a catch-all else case so any unanticipated configs pass this test.
Reid Kleckner [Thu, 12 Mar 2020 03:22:14 +0000 (20:22 -0700)]
Sink more Attr.h inline methods, NFC
This has very little impact on build time, but is a mechanical pre-req
to removing the OpenMPClause.h include, which matters. Most of these
pretty print methods require Expr to be complete.
Simon Pilgrim [Thu, 12 Mar 2020 18:45:11 +0000 (18:45 +0000)]
Fix unused variable warning. NFCI.
Simon Pilgrim [Thu, 12 Mar 2020 18:42:28 +0000 (18:42 +0000)]
Replace getAs with castAs to fix null dereference static analyzer warning.
Use castAs as we know the cast should succeed (and castAs will assert if it doesn't) and we're dereferencing it directly in the BuildRCBlockVarRecordLayout call.
Simon Pilgrim [Thu, 12 Mar 2020 18:12:47 +0000 (18:12 +0000)]
CGOpenMPRuntime::emitDeclareTargetVarDefinition - fix static analyzer null dereference warning. NFCI.
All paths test for or dereference the VD pointer, so just assert that its not null.
Simon Pilgrim [Thu, 12 Mar 2020 17:55:04 +0000 (17:55 +0000)]
ExecutionDomainFix - fix static analyzer out of range shift warnings.
Repeat the assertion that we already have in hasDomain for addDomain and setSingleDomain.
Florian Hahn [Thu, 12 Mar 2020 18:46:16 +0000 (18:46 +0000)]
Revert "[SCCP] Use ValueLatticeElement instead of LatticeVal (NFCI)"
This commit is likely causing clang-with-lto-ubuntu to fail
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/16052
Also causes PR45185.
This reverts commit
f1ac5d2263f8419b865cc78ba1f5c8694970fb6b.
Paula Toth [Thu, 12 Mar 2020 18:38:05 +0000 (11:38 -0700)]
[clang-tidy] Add module for llvm-libc and restrict-system-libc-header-check.
Summary: This adds a new module to enforce standards specific to the llvm-libc project. This change also adds the first check which restricts user from including system libc headers accidentally which can lead to subtle bugs that would be a challenge to detect.
Reviewers: alexfh, hokein, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: juliehockett, arphaman, jfb, abrachet, sivachandra, Eugene.Zelenko, njames93, mgorny, xazax.hun, MaskRay, cfe-commits
Tags: #clang-tools-extra, #libc-project, #clang
Differential Revision: https://reviews.llvm.org/D75332
Stanislav Mekhanoshin [Wed, 11 Mar 2020 20:17:32 +0000 (13:17 -0700)]
[AMDGPU] Simplify nested SI_END_CF
This is to replace the optimization from the SIOptimizeExecMaskingPreRA.
We have less opportunities in the control flow lowering because many
VGPR copies are still in place and will be removed later, but we know
for sure an instruction is SI_END_CF and not just an arbitrary S_OR_B64
with EXEC.
The subsequent change needs to convert s_and_saveexec into s_and and
address new TODO lines in tests, then code block guarded by the
-amdgpu-remove-redundant-endcf option in the pre-RA exec mask optimizer
will be removed.
Differential Revision: https://reviews.llvm.org/D76033
Sterling Augustine [Tue, 10 Mar 2020 19:03:24 +0000 (12:03 -0700)]
Cache uwnind frame headers as they are found.
Summary:
This improves unwind performance quite substantially, and follows
a somewhat similar approach used in libgcc_s as described in the
thread here:
https://gcc.gnu.org/ml/gcc/2005-02/msg00625.html
On certain extremely exception heavy internal tests, the time
drops from about 80 minutes to about five minutes.
Subscribers: libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75954
David Blaikie [Wed, 11 Mar 2020 22:56:24 +0000 (15:56 -0700)]
CFGDiff: Simplify and generalize over all graph types
Use GraphTraits in the implementation of the GraphDiff's own GraphTraits
so GraphDiff can be used across all graph types that provide
GraphTraits.
Also use partial template specializations to make the traits a bit more
compact.
Reviewers: asbirlea
Differential Revision: https://reviews.llvm.org/D76034
Richard Sandiford [Fri, 21 Feb 2020 15:49:26 +0000 (15:49 +0000)]
[Sema][SVE] Don't allow static or thread-local variables to have sizeless type
clang accepts a TU containing just:
__SVInt8_t x;
However, sizeless types are not allowed to have static or thread-local
storage duration and trying to code-generate the TU triggers an LLVM
fatal error:
Globals cannot contain scalable vectors
<vscale x 16 x i8>* @x
fatal error: error in backend: Broken module found, compilation aborted!
This patch adds an associated clang diagnostic.
Differential Revision: https://reviews.llvm.org/D75736
Jacques Pienaar [Wed, 11 Mar 2020 23:14:54 +0000 (16:14 -0700)]
[mlir] Add derived attribute op interface
Interface provides uniform access to the the derived attribute query method.
Jonas Devlieghere [Thu, 12 Mar 2020 16:51:59 +0000 (09:51 -0700)]
[lldb/Utility] Add YAML traits for ConstString and FileSpec.
Add YAML traits for the ConstString and FileSpec classes so they can be
serialized as part of ProcessInfo. The latter needs to be serializable
for the reproducers.
Differential revision: https://reviews.llvm.org/D76002
Richard Sandiford [Mon, 2 Mar 2020 19:03:08 +0000 (19:03 +0000)]
[Sema][SVE] Reject atomic sizeless types
It would be difficult to guarantee atomicity for sizeless types,
so the SVE ACLE makes atomic sizeless types invalid. As it happens,
we already rejected them before the patch, but for the wrong reason:
error: _Atomic cannot be applied to type 'svint8_t' (aka '__SVInt8_t')
which is not trivially copyable
The SVE types should be treated as trivially copyable; a later
patch fixes that.
Differential Revision: https://reviews.llvm.org/D75734
Richard Sandiford [Mon, 2 Mar 2020 17:37:58 +0000 (17:37 +0000)]
[Sema][SVE] Reject aligned/_Alignas for sizeless types
A previous patch rejected alignof for sizeless types. This patch
extends that to cover the "aligned" attribute and _Alignas. Since
sizeless types are not meant to be used for long-term data, cannot
be used in aggregates, and cannot have static storage duration,
there shouldn't be any need to fiddle with their alignment.
Like with alignof, this is a conservative position that can be
relaxed in future if it turns out to be too restrictive.
Differential Revision: https://reviews.llvm.org/D75573
Richard Sandiford [Fri, 21 Feb 2020 15:30:52 +0000 (15:30 +0000)]
[Sema][SVE] Reject sizeof and alignof for sizeless types
clang current accepts:
void foo1(__SVInt8_t *x, __SVInt8_t *y) { *x = *y; }
void foo2(__SVInt8_t *x, __SVInt8_t *y) {
memcpy(y, x, sizeof(__SVInt8_t));
}
The first function is valid ACLE code and generates correct LLVM IR.
However, the second function is invalid ACLE code and generates a
zero-length memcpy. The point of this patch is to reject the use
of sizeof in the second case instead.
There's no similar wrong-code bug for alignof. However, the SVE ACLE
conservatively treats alignof in the same way as sizeof, just as the
C++ standard does for incomplete types. The idea is that layout of
sizeless types is an implementation property and isn't defined at
the language level.
Implementation-wise, the patch adds a new CompleteTypeKind enum
that controls whether RequireCompleteType & friends accept sizeless
built-in types. For now the default is to maintain the status quo
and accept sizeless types. However, the end of the series will flip
the default and remove the Default enum value.
The patch also adds new ...CompleteSized... wrappers that callers can
use if they explicitly want to reject sizeless types. The callers then
use diagnostics that have an extra 0/1 parameter to indicats whether
the type is sizeless or not.
The idea is to have three cases:
1. calls that explicitly reject sizeless types, with a tweaked diagnostic
for the sizeless case
2. calls that explicitly allow sizeless types
3. normal/old-style calls that don't make an explicit choice either way
Once the default is flipped, the 3. calls will conservatively reject
sizeless types, using the same diagnostic as for other incomplete types.
Differential Revision: https://reviews.llvm.org/D75572
Artem Belevich [Wed, 11 Mar 2020 21:53:03 +0000 (14:53 -0700)]
[CUDA] Warn about unsupported CUDA SDK version only if it's used.
This fixes an issue with clang issuing a warning about unknown CUDA SDK if it's
detected during non-CUDA compilation.
Differential Revision: https://reviews.llvm.org/D76030
Richard Sandiford [Fri, 21 Feb 2020 14:55:28 +0000 (14:55 +0000)]
[Sema][SVE] Add tests for valid and invalid type usage
This patch adds C and C++ tests for various uses of SVE types.
The tests cover valid uses that are already (correctly) accepted and
invalid uses that are already (correctly) rejected. Later patches
will expand the tests as they fix other cases.[*]
Some of the tests for invalid uses aren't obviously related to
scalable vectors. Part of the reason for having them is to make
sure that the quality of the error message doesn't regress once/if
the types are treated as incomplete types.
[*] These later patches all fix invalid uses that are being incorrectly
accepted. I don't know of any cases in which valid uses are being
incorrectly rejected. In other words, this series is all about
diagnosing invalid code rather than enabling something new.
Differential Revision: https://reviews.llvm.org/D75571
Simon Pilgrim [Thu, 12 Mar 2020 16:49:35 +0000 (16:49 +0000)]
Replace getAs/dyn_cast with castAs/cast to fix null dereference static analyzer warnings.
Both these casts are immediately deferenced and the cast will assert for us that they are of the correct type.
LLVM GN Syncbot [Thu, 12 Mar 2020 16:33:39 +0000 (16:33 +0000)]
[gn build] Port
fa8080376e7
Richard Sandiford [Thu, 20 Feb 2020 21:17:03 +0000 (21:17 +0000)]
[AST][SVE] Add new Type queries for sizeless types
One of the defining features of the SVE ACLE types is that they
are "sizeless"; see the SVE ACLE spec:
https://developer.arm.com/docs/100987/0000/arm-c-language-extensions-for-sve
or the email message:
http://lists.llvm.org/pipermail/cfe-dev/2019-June/062523.html
for a fuller definition of what that means.
This patch adds two associated type queries:
- isSizelessBuiltinType asks specifically about types that are built
into clang. It is effectively an enum range check.
- isSizelessType instead tests for any type that has the "sizeless" type
property. At the moment it only returns true for the built-in types,
but it seems better not to hard-code that assumption throughout
the codebase. (E.g. we could in principle support some form of
user-defined sizeless types in future. Even if that seems unlikely
and never actually happens, the possibility at least exists.)
Differential Revision: https://reviews.llvm.org/D75570
Reid Kleckner [Thu, 12 Mar 2020 02:43:37 +0000 (19:43 -0700)]
[TableGen] Move generated *Attr class methods out of line
After this change, clang spends ~200ms parsing Attrs.inc instead of
~560ms. A large part of the cost was from the StringSwitch
instantiations, but this is a good way to avoid similar problems in the
future.
Reviewed By: aaron.ballman, rjmccall
Differential Revision: https://reviews.llvm.org/D76040
LLVM GN Syncbot [Thu, 12 Mar 2020 16:01:56 +0000 (16:01 +0000)]
[gn build] Port
2c9cf9f4ddd
Jonathan Roelofs [Tue, 10 Mar 2020 14:34:34 +0000 (08:34 -0600)]
[clang-tidy] New check: bugprone-suspicious-include
Detects and fixes suspicious code like: `#include "foo.cpp"`.
Inspired by: https://twitter.com/lefticus/status/
1228458240364687360?s=20
https://reviews.llvm.org/D74669
Zarko Todorovski [Thu, 12 Mar 2020 15:01:40 +0000 (11:01 -0400)]
[PowerPC][AIX] Implement formal arguments passed in stack memory.
This patch is the callee side counterpart for https://reviews.llvm.org/D73209.
It removes the fatal error when we pass more formal arguments than available
registers.
Differential Revision: https://reviews.llvm.org/D74225
Simon Pilgrim [Thu, 12 Mar 2020 15:36:33 +0000 (15:36 +0000)]
ObjCMethodDecl::findPropertyDecl - fix static analyzer null dereference warnings. NFCI.
All paths dereference the ClassDecl pointer, so use a cast<> instead of dyn_cast<>, assert that its not null and remove the remaining null tests.
Hideto Ueno [Thu, 12 Mar 2020 15:25:24 +0000 (15:25 +0000)]
[Attributor][FIX] Add a missing dependence track in noalias deduction
Marcello Maggioni [Thu, 12 Mar 2020 15:15:04 +0000 (08:15 -0700)]
[RAGreedy] Fix minor typo in comment. NFC
Raphael Isemann [Thu, 12 Mar 2020 15:06:51 +0000 (16:06 +0100)]
[lldb] Let OptionValueRegex::Clear set to value to the default and not an empty regex
Since D75537 the test suite clears all settings before a test. This caused
two tests to fail:
lldb-api :: functionalities/inline-stepping/TestInlineStepping.py
lldb-api :: lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
The reason for that is that OptionValueRegex::Clear was setting the regex
to empty instead of the default value that was passed initially. This caused
that the target.process.thread.step-avoid-regexp setting which is used in the
tests was set to "" instead of "^std::".
This patch is just a quick fix that sets the regex back to the original value
to make the tests pass.
In total these 3 setting values have changed with D75537 and also need to be
fixed (even though they don't seem to break any tests).
target.process.thread.step-avoid-regexp (regex) -> from '^std::' to empty string
platform.module-cache-directory (file) -> from "~/.lldb/module_cache" to empty string
script-lang (enum) -> from 'default' to 'python'
Fangrui Song [Tue, 10 Mar 2020 22:41:57 +0000 (15:41 -0700)]
[ELF] Move --print-map(-M)/--cref before checkSections() and openFile()
-M output can be useful when diagnosing an "error: output file too large" problem (emitted in openFile()).
I just ran into such a situation where I had to debug an erronerous
Linux kernel linker script. It tried to create a file larger than
INT64_MAX bytes.
This patch could have helped https://bugs.llvm.org/show_bug.cgi?id=44715 as well.
Reviewed By: grimar
Differential Revision: https://reviews.llvm.org/D75966
Simon Pilgrim [Thu, 12 Mar 2020 14:56:32 +0000 (14:56 +0000)]
Replace getAs with castAs to fix null dereference static analyzer warnings.
Use castAs as we know the cast should succeed (and castAs will assert if it doesn't) and we're dereferencing it directly in the getThisType/getThisObjectType calls.
Simon Pilgrim [Thu, 12 Mar 2020 14:32:33 +0000 (14:32 +0000)]
Fix static analyzer null dereference warning. NFCI.
Simon Pilgrim [Thu, 12 Mar 2020 14:28:16 +0000 (14:28 +0000)]
Replace getAs with castAs to fix null dereference static analyzer warnings.
Use castAs as we know the cast should succeed (and castAs will assert if it doesn't) and we're dereferencing it directly in the canAssignObjCInterfaces call.
Xiangling Liao [Wed, 11 Mar 2020 20:16:27 +0000 (16:16 -0400)]
[PowerPC32] Fix the `setcc` inconsistent result type problem
Summary:
On 32-bit PPC target[AIX and BE], when we convert an `i64` to `f32`, a `setcc` operand expansion is needed. The expansion will set the result type of expanded `setcc` operation based on if the subtarget use CRBits or not. If the subtarget does use the CRBits, like AIX and BE, then it will set the result type to `i1`, leading to an inconsistency with original `setcc` result type[i32].
And the reason why it crashed underneath is because we don't set result type of setcc consistent in those two places.
This patch fixes this problem by setting original setcc opnode result type also with `getSetCCResultType` interface.
Reviewers: sfertile, cebowleratibm, hubert.reinterpretcast, Xiangling_L
Reviewed By: sfertile
Subscribers: wuzish, nemanjai, hiraditya, kbarton, jsji, shchenz, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75702
Simon Moll [Thu, 12 Mar 2020 14:37:39 +0000 (15:37 +0100)]
[VE][nfc] Use RRIm for RRINDm, remove the latter
Summary:
De-duplicate isel instruction classes by using RRIm for RRINDm. The latter
becomes obsolete.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D76063
Sean Fertile [Thu, 12 Mar 2020 14:21:42 +0000 (10:21 -0400)]
[PowerPC][AIX] Fix printing of program counter for AIX assembly.
Program counter on AIX is the dollar-sign.
Differential Revision:https://reviews.llvm.org/D75627
Raphael Isemann [Thu, 12 Mar 2020 14:30:10 +0000 (15:30 +0100)]
[lldb][NFC] Fix unsigned/signed comparison warning in SymbolFileDWARFTest.cpp
offset_t is unsigned, so if the RHS is signed we get a warning from clang:
warning: comparison of integers of different signs: 'const unsigned long long' and 'const int'
Nicolas Vasilache [Thu, 12 Mar 2020 14:07:16 +0000 (10:07 -0400)]
[mlir][CRunnerUtils] Enable compilation with C++11 toolchain on microcontroller platforms.
Summary:
The C runner utils API was still not vanilla enough for certain use
cases on embedded ARM SDKs, this enables such cases.
Adding people more widely for historical Windows related build issues.
Differential Revision: https://reviews.llvm.org/D76031
Andrzej Warzynski [Wed, 4 Mar 2020 11:21:20 +0000 (11:21 +0000)]
[AArch64][SVE] Add intrinsics for non-temporal scatters/gathers
Summary:
This patch adds the following intrinsics for non-temporal gather loads
and scatter stores:
* aarch64_sve_ldnt1_gather_index
* aarch64_sve_stnt1_scatter_index
These intrinsics implement the "scalar + vector of indices" addressing
mode.
As opposed to regular and first-faulting gathers/scatters, there's no
instruction that would take indices and then scale them. Instead, the
indices for non-temporal gathers/scatters are scaled before the
intrinsics are lowered to `ldnt1` instructions.
The new ISD nodes, GLDNT1_INDEX and SSTNT1_INDEX, are only used as
placeholders so that we can easily identify the cases implemented in
this patch in performGatherLoadCombine and performScatterStoreCombined.
Once encountered, they are replaced with:
* GLDNT1_INDEX -> SPLAT_VECTOR + SHL + GLDNT1
* SSTNT1_INDEX -> SPLAT_VECTOR + SHL + SSTNT1
The patterns for lowering ISD::SHL for scalable vectors (required by
this patch) were missing, so these are added too.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D75601
Sanjay Patel [Thu, 12 Mar 2020 13:52:06 +0000 (09:52 -0400)]
[InstSimplify] simplify FP ops harder with FMF (part 2)
This is part of the IR sibling for:
D75576
Related transform committed with:
rG8ec71585719d
Sergej Jaskiewicz [Thu, 30 Jan 2020 10:05:14 +0000 (13:05 +0300)]
[libcxxabi] Set LIBCXXABI_LINK_TESTS_WITH_SHARED_LIBCXX to ON if LIBCXX_ENABLE_SHARED is not defined
Differential Revision: https://reviews.llvm.org/D71894
Sven van Haastregt [Thu, 12 Mar 2020 13:43:51 +0000 (13:43 +0000)]
[OpenCL] Add missing get_image_array_size builtins
Tatyana Krasnukha [Wed, 11 Mar 2020 16:51:40 +0000 (19:51 +0300)]
[lldb] Clear all settings during a test's setUp
Global properties are shared between debugger instances and
if a test doesn't clear changes in settings it made,
this leads to side effects in other tests.
Differential Revision: https://reviews.llvm.org/D75537
Sanjay Patel [Thu, 12 Mar 2020 13:10:26 +0000 (09:10 -0400)]
[InstSimplify] simplify FP ops harder with FMF
This is part of the IR sibling for:
D75576
(I'm splitting part of the transform as a separate commit
to reduce risk. I don't know of any bugs that might be
exposed by this improved folding, but it's hard to see
those in advance...)
Simon Pilgrim [Thu, 12 Mar 2020 13:06:12 +0000 (13:06 +0000)]
[X86] Add FeatureFast7ByteNOP flag
Lets us remove another SLM proc family flag usage.
This is NFC, but we should probably check whether atom/glm/knl? should be using this flag as well...
Sam McCall [Thu, 12 Mar 2020 12:59:40 +0000 (13:59 +0100)]
[clangd] Add README pointing to docs, bugtracker etc. NFC
Simon Pilgrim [Thu, 12 Mar 2020 12:53:31 +0000 (12:53 +0000)]
[AMDGPU] Add some funnel shift intrinsic test coverage
Sanjay Patel [Thu, 12 Mar 2020 12:45:38 +0000 (08:45 -0400)]
[InstSimplify] reduce code for FP undef/nan folding; NFC
Nico Weber [Thu, 12 Mar 2020 12:33:54 +0000 (08:33 -0400)]
Use `grep -F` instead of deprecated fgrep.
(In addition to the deprecation bit, this is useful on Windows
where people might have grep but not fgrep.)