Raphael Isemann [Mon, 16 Dec 2019 07:36:25 +0000 (08:36 +0100)]
[lldb][NFC] Remove unnecessary includes in source/Commands
Summary: This removes most of unnecessary includes in the `source/Commands` directory. This was generated by IWYU and a script that fixed all the bogus reports from IWYU. Patch is tested on Linux and macOS.
Reviewers: JDevlieghere
Reviewed By: JDevlieghere
Subscribers: krytarowski, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71489
Raphael Isemann [Mon, 16 Dec 2019 07:16:56 +0000 (08:16 +0100)]
[lldb][NFC] Replace ClangASTImporter's use of map/set with SmallPtrSet and DenseMap
We have several pointer->pointer mappings in the ClangASTImporter implemented using
STL data structures. This moves these variables to the appropriate LLVM data structures
that are intended for mapping pointers.
Richard Smith [Mon, 16 Dec 2019 06:20:06 +0000 (22:20 -0800)]
Mark the major papers for C++20 consistent comparisons as "done", and
start publishing the corresponding feature-test macro.
Richard Smith [Fri, 13 Dec 2019 22:11:04 +0000 (14:11 -0800)]
[c++20] Compute exception specifications for defaulted comparisons.
This requires us to essentially fully form the body of the defaulted
comparison, but from an unevaluated context. Naively this would require
generating the function definition twice; instead, we ensure that the
function body is implicitly defined before performing the check, and
walk the actual body where possible.
Richard Smith [Fri, 13 Dec 2019 22:10:13 +0000 (14:10 -0800)]
Properly compute whether statement expressions can throw, rather than
conservatively assuming they always can.
Also fix cases where we would not consider the computation of a VLA type
when determining whether an expression can throw. We don't yet properly
determine whether a VLA can throw, but no longer incorrectly claim it
can never throw.
Richard Smith [Fri, 13 Dec 2019 22:06:24 +0000 (14:06 -0800)]
Resolve exception specifications after marking the corresponding
function as referenced, not before.
No functionality change intended. This is groundwork for computing the
exception specification of a defaulted comparison, for which we'd like
to use the implicit body where possible.
Fangrui Song [Mon, 16 Dec 2019 05:40:11 +0000 (21:40 -0800)]
[ELF] Delete redundant isLive() check. NFC
Lang Hames [Mon, 16 Dec 2019 04:30:01 +0000 (20:30 -0800)]
[examples] Rename LLJITWithJITLink to LLJITWithCustomObjectLinkingLayer.
LLJIT now uses JITLink/ObjectLinkingLayer by default where available, so
these steps aren't required to use it. The tutorial is still useful though:
Clients can use it to test altervative linking layer implementations (e.g.
handing off to the system linker) or to test implementations of JITLink that
are still under development.
Lang Hames [Mon, 16 Dec 2019 03:51:35 +0000 (19:51 -0800)]
[Orc][LLJIT] Automatically use JITLink for LLJIT on supported platforms.
JITLink (which underlies ObjectLinkingLayer) is a replacement for RuntimeDyld.
It supports the native code model, and linker plugins that enable a wider range
of features than RuntimeDyld.
Currently only enabled for MachO/x86-64 and MachO/arm64. New architectures will
be added as JITLink support for them is developed.
Lang Hames [Mon, 16 Dec 2019 04:24:17 +0000 (20:24 -0800)]
[examples] Update LLJITWithJITLink example for change in
c0143f37dab.
Fangrui Song [Wed, 4 Dec 2019 21:48:19 +0000 (13:48 -0800)]
[llvm-objcopy][ELF] -O binary: use LMA instead of sh_offset to decide where to write section contents
.text sh_address=0x1000 sh_offset=0x1000
.data sh_address=0x3000 sh_offset=0x2000
In an objcopy -O binary output, the distance between two sections equal
their LMA differences (0x3000-0x1000), instead of their sh_offset
differences (0x2000-0x1000). This patch changes our behavior to match
GNU.
This rule gets more complex when the containing PT_LOAD has
p_vaddr!=p_paddr. GNU objcopy essentially computes
sh_offset-p_offset+p_paddr for each candidate section, and removes the
gap before the first address.
Added tests to binary-paddr.test to catch the compatibility problem.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D71035
Seiya Nuta [Mon, 16 Dec 2019 05:05:06 +0000 (14:05 +0900)]
[llvm-objcopy][MachO] Implement --add-section
Reviewers: alexshap, rupprecht, jhenderson
Reviewed By: alexshap, jhenderson
Subscribers: mgorny, jakehehrlich, abrachet, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66283
Fangrui Song [Mon, 16 Dec 2019 04:32:08 +0000 (20:32 -0800)]
[MC] Delete STT_SECTION special cases from MCSymbolELF::setType and setBinding
The special cases added by rL293936 were no longer needed after rL296180
disallowed redefinition of section symbols.
Jim Lin [Mon, 16 Dec 2019 02:18:50 +0000 (10:18 +0800)]
[PowerPC] Fix %llvm.ppc.altivec.vc* lowering
Summary:
r372285 changed LLVM to use a `TargetConstant` for parameters of intrinsics that are required to be immediates.
Since that commit, use of `%llvm.ppc.altivec.vc{fsx,fux,tsxs,tuxs}` intrinsics has not worked, and resulted in a `LLVM ERROR: Cannot select: intrinsic %llvm.ppc.altivec.vc*` error. The intrinsics' TableGen definitions matched on `imm` instead of `timm`.
This commit updates those definitions to use `timm`.
Fixes: https://llvm.org/PR44239
Reviewers: hfinkel, nemanjai, #powerpc, Jim
Reviewed By: Jim
Subscribers: qiucf, wuzish, Jim, hiraditya, kbarton, jsji, shchenz, llvm-commits
Tags: #llvm
Patched by vddvss (Colin Samples).
Differential Revision: https://reviews.llvm.org/D71138
Lang Hames [Mon, 16 Dec 2019 01:23:36 +0000 (17:23 -0800)]
[ORC] Make ObjectLinkingLayer own its jitlink::MemoryManager.
This relieves ObjectLinkingLayer clients of the responsibility of holding the
memory manager. This makes it easier to select between RTDyldObjectLinkingLayer
(which already owned its memory manager factory) and ObjectLinkingLayer at
runtime as clients aren't required to hold a jitlink::MemoryManager field just
in case ObjectLinkingLayer is selected.
Fangrui Song [Mon, 16 Dec 2019 00:18:23 +0000 (16:18 -0800)]
[MC] Assume CommentStream is non-null in MCDisassembler::tryAdding*
AArch64/ARM/X86 call the two functions. CommentStream is always
initialized.
Fangrui Song [Mon, 16 Dec 2019 00:03:56 +0000 (16:03 -0800)]
[MC] Ignore VK_WEAKREF in MCValue::getAccessVariant
MCSymbolRefExpr::getVariantKindForName does not return VK_WEAKREF, so this code path is not exercised. Moreoever, .weakref is probably a feature that nobody uses.
Fangrui Song [Sun, 15 Dec 2019 23:39:30 +0000 (15:39 -0800)]
[MC] Delete unused MCAsmInfoELF::UsesNonexecutableStackSection after EM_WEBASSEMBLY was removed in D48744
This removes remnant of D15969 which hasn't been removed by D48744.
Lang Hames [Sun, 15 Dec 2019 23:35:49 +0000 (15:35 -0800)]
[Kaleidoscope][BuildingAJIT] Add a missing std::move.
This should fix the build failure described in
https://github.com/llvm/llvm-project/issues/63.
Raphael Isemann [Sun, 15 Dec 2019 21:39:36 +0000 (22:39 +0100)]
[lldb] Remove RTTI in ClangExternalASTSourceCommon based on a global map of known instances
Summary:
Currently we do our RTTI check for ClangExternalASTSourceCommon by using this global map of
ClangExternalASTSourceCommon where every instance is registering and deregistering itself
on creation/destruction. Then we can do the RTTI check by looking up in this map from ClangASTContext.
This patch removes this whole thing and just adds LLVM-style RTTI support to ClangExternalASTSourceCommon
which is possible with D71397.
Reviewers: labath, aprantl
Reviewed By: labath
Subscribers: JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71398
Mark de Wever [Sun, 15 Dec 2019 20:17:07 +0000 (21:17 +0100)]
[AST] Use a reference in a range-based for
This avoids unneeded copies when using a range-based for loops.
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.
Differential Revision: https://reviews.llvm.org/D71526
Raphael Isemann [Sun, 15 Dec 2019 15:09:20 +0000 (16:09 +0100)]
[clang] Improve LLVM-style RTTI support in ExternalASTSource/ExternalSemaSource
Summary:
We currently have some very basic LLVM-style RTTI support in the ExternalASTSource class hierarchy
based on the `SemaSource` bool( to discriminate it form the ExternalSemaSource). As ExternalASTSource
is supposed to be subclassed we should have extendable LLVM-style RTTI in this class hierarchy to make life easier
for projects building on top of Clang.
Most notably the current RTTI implementation forces LLDB to implement RTTI for its
own ExternalASTSource class (ClangExternalASTSourceCommon) by keeping a global set of
ExternalASTSources that are known to be ClangExternalASTSourceCommon. Projects
using Clang currently have to dosimilar workarounds to get RTTI support for their subclasses.
This patch turns this into full-fledged LLVM-style RTTI based on a static `ID` variable similar to
other LLVM class hierarchies. Also removes the friend declaration from ExternalASTSource to
its child class that was only used to grant access to the `SemaSource` member.
Reviewers: aprantl, dblaikie, rjmccall
Reviewed By: aprantl
Subscribers: riccibruno, labath, lhames, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D71397
LLVM GN Syncbot [Sun, 15 Dec 2019 15:30:33 +0000 (15:30 +0000)]
gn build: Merge
bbc9f6c2ef0
Gabor Bencze [Sun, 15 Dec 2019 15:25:54 +0000 (16:25 +0100)]
[clang-tidy] Add cert-oop58-cpp check
The check warns when (a member of) the copied object is assigned to in a
copy constructor or copy assignment operator. Based on
https://wiki.sei.cmu.edu/confluence/display/cplusplus/OOP58-CPP.+Copy+operations+must+not+mutate+the+source+object
Differential Revision: https://reviews.llvm.org/D70052
Sanjay Patel [Sun, 15 Dec 2019 14:32:03 +0000 (09:32 -0500)]
[InstSimplify] fold splat of inserted constant to vector constant
shuf (inselt ?, C, IndexC), undef, <IndexC, IndexC...> --> <C, C...>
This is another missing shuffle fold pattern uncovered by the
shuffle correctness fix from D70246.
The problem was visible in the post-commit thread example, but
we managed to overcome the limitation for that particular case
with D71220.
This is something like the inverse of the previous fix - there
we didn't demand the inserted scalar, and here we are only
demanding an inserted scalar.
Differential Revision: https://reviews.llvm.org/D71488
Sanjay Patel [Sun, 15 Dec 2019 13:52:34 +0000 (08:52 -0500)]
[DAG] Add SimplifyDemandedBits support for BSWAP
This exposes a shortcoming for AArch64, and that is tracked by PR40881:
https://bugs.llvm.org/show_bug.cgi?id=40881
Patch by: @RKSimon (Simon Pilgrim)
Differential Revision: https://reviews.llvm.org/D58017
Borsik Gabor [Sat, 23 Nov 2019 21:28:46 +0000 (22:28 +0100)]
[analyzer] Add support for namespaces to GenericTaintChecker
This patch introduces the namespaces for the configured functions and
also enables the use of the member functions.
I added an optional Scope field for every configured function. Functions
without Scope match for every function regardless of the namespace.
Functions with Scope will match if the full name of the function starts
with the Scope.
Multiple functions can exist with the same name.
Differential Revision: https://reviews.llvm.org/D70878
Heejin Ahn [Sun, 15 Dec 2019 03:19:35 +0000 (19:19 -0800)]
[IR] Include more target specific intrinsic headers
After D71320, target-specific intrinsic headers should be included.
Craig Topper [Sat, 14 Dec 2019 22:49:17 +0000 (14:49 -0800)]
[LegalizeTypes] Teach BitcastToInt_ATOMIC_SWAP to only create FP16_TO_FP when called from PromoteFloatResult.
There's also a call from SoftenFloatResult that should not be promoted.
The change test case would fail with the new RUN line prior to
this change.
Craig Topper [Sat, 14 Dec 2019 22:40:43 +0000 (14:40 -0800)]
[LegalizeTypes] In PromoteFloatOp_SETCC, don't both querying for transforming the result type.
The result type is already legal, is doesnt' need to be
transformed.
Richard Smith [Sat, 14 Dec 2019 22:52:24 +0000 (14:52 -0800)]
[cxx_status] Fix paper number for "Concept auto" paper.
Logan Chien [Sat, 14 Dec 2019 21:58:40 +0000 (13:58 -0800)]
Revert "AArch64: Fix frame record chain"
Breaks aosp-O3-polly-before-vectorizer-unprofitable with the following
error message:
void llvm::emitFrameOffset(llvm::MachineBasicBlock &,
MachineBasicBlock::iterator, const llvm::DebugLoc &, unsigned int,
unsigned int, llvm::StackOffset, const llvm::TargetInstrInfo *,
MachineInstr::MIFlag, bool, bool, bool *): Assertion `(DestReg !=
AArch64::SP || Bytes % 16 == 0) && "SP increment/decrement not 16-byte
aligned"' failed.
This reverts commit
d4e10e6adb1b629b3fc1b78f7e281fbcec392edb.
Nico Weber [Sat, 14 Dec 2019 19:12:25 +0000 (14:12 -0500)]
gn build: (manually and belatedly) merge
ed153ef044fd
Logan Chien [Thu, 28 Nov 2019 06:56:34 +0000 (22:56 -0800)]
AArch64: Fix frame record chain
The commit r369122 may keep LR and FP register (aka. frame record) in
the middle of a frame, thus we must add the offsets to ensure the FP
register always points to innermost frame record on the stack.
According to AAPCS64[1], a conforming code shall construct a linked list
of stack frames that can be traversed with frame records. This commit
is also essential to frame-pointer-based stack unwinder (e.g. the stack
unwinder in linx-perf-tools.)
[1] https://github.com/ARM-software/software-standards/blob/master/abi/aapcs64/aapcs64.rst#the-frame-pointer
Test: llvm-lit ${LLVM_SRC}/test/CodeGen/AArch64/framelayout-frame-record.ll
Test: llvm-lit ${LLVM_SRC}/test/CodeGen/AArch64
Differential Revision: https://reviews.llvm.org/D70800
Shoaib Meenai [Sat, 14 Dec 2019 03:35:49 +0000 (19:35 -0800)]
[perf-training] Make training data location configurable
We may wish to keep the PGO training data outside the repository. Add a
CMake variable to allow referencing an external lit testsuite.
Differential Revision: https://reviews.llvm.org/D71507
Fangrui Song [Sat, 14 Dec 2019 17:44:34 +0000 (09:44 -0800)]
[AArch64][test] Fix machine-outliner-size-info.mir after D71168
Raphael Isemann [Sat, 14 Dec 2019 17:18:59 +0000 (18:18 +0100)]
[clang] Fix modules build after addition of TypeBitCodes.def
In revision
139006ceb641f038a2b19cac1174316e57004ed6 the Serialization
folder got its first def file 'TypeBitCodes.def'. This broke the
modules build as this .def file was not textually included but implicitly
converted into a module due to our umbrella directive.
This patch fixes this by explicitly marking the .def file as textual.
Sanjay Patel [Sat, 14 Dec 2019 16:08:36 +0000 (11:08 -0500)]
[AArch64] add tests for fcvtl2; NFC
Nico Weber [Sat, 14 Dec 2019 15:13:15 +0000 (10:13 -0500)]
Fix build with older (still supported) gcc versions.
Older gccs can't handle multiline raw string literals in
macro parameters.
Nico Weber [Sat, 14 Dec 2019 14:44:46 +0000 (09:44 -0500)]
gn build: Merge
91dd67ef724
Nico Weber [Sat, 14 Dec 2019 13:13:29 +0000 (08:13 -0500)]
Revert "[clangd] Fall back to selecting token-before-cursor if token-after-cursor fails."
This reverts commit
b60896fad926754f715acc5d771555aaaa577e0f.
Breaks building with gcc:
/usr/include/c++/7/bits/stl_construct.h:75:7: error: use of deleted function ‘clang::clangd::Tweak::Selection::Selection(const clang::clangd::Tweak::Selection&)’
{ ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/ClangdServer.h:28:0,
from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/ClangdServer.cpp:9:
/home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/refactor/Tweak.h:49:10: note: ‘clang::clangd::Tweak::Selection::Selection(const clang::clangd::Tweak::Selection&)’ is implicitly deleted because the default definition would be ill-formed:
struct Selection {
^~~~~~~~~
/home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/refactor/Tweak.h:49:10: error: use of deleted function ‘clang::clangd::SelectionTree::SelectionTree(const clang::clangd::SelectionTree&)’
In file included from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/refactor/Tweak.h:25:0,
from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/ClangdServer.h:28,
from /home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/ClangdServer.cpp:9:
/home/buildslave/buildslave/clang-cmake-armv7-selfhost-neon/llvm/clang-tools-extra/clangd/Selection.h:96:3: note: declared here
SelectionTree(const SelectionTree &) = delete;
^~~~~~~~~~~~~
e.g. here:
http://lab.llvm.org:8011/builders/clang-cmake-armv7-selfhost-neon/builds/2714
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/41866
Nico Weber [Sat, 14 Dec 2019 12:44:36 +0000 (07:44 -0500)]
gn build: (manually) merge
6404bd236 and
d505e57cc2
John McCall [Sat, 14 Dec 2019 08:17:03 +0000 (03:17 -0500)]
Move ASTRecordWriter into its own header; NFC.
Similar motivations to the movement of ASTRecordReader:
AbstractBasicWriter.h already has quite a few dependencies,
and it's going to get pretty large as we generate more and more
into it. Meanwhile, most clients don't depend on this detail of
the implementation and shouldn't need to be recompiled.
I've also made OMPClauseWriter private, like it belongs.
John McCall [Sat, 14 Dec 2019 08:01:28 +0000 (03:01 -0500)]
Move ASTRecordReader into its own header; NFC.
AbstractBasicReader.h has quite a few dependencies already,
and that's only likely to increase. Meanwhile, ASTRecordReader
is really an implementation detail of the ASTReader that is only
used in a small number of places.
I've kept it in a public header for the use of projects like Swift
that might want to plug in to Clang's serialization framework.
I've also moved OMPClauseReader into an implementation file,
although it can't be made private because of friendship.
Puyan Lotfi [Sat, 14 Dec 2019 05:58:44 +0000 (00:58 -0500)]
[NFC][llvm][MIRVRegNamerUtils] Refactoring GetHashableMO into switch-statement.
This refactors the if-statements handling the hashing of various
MachineOperand types into a switch-statement. The purpose is to cover
all the basis for all MachineOperand types while being very deliberate
about which MachineOperand types we are not handling and why (better
added comments). This patch is a NFC redo of https://reviews.llvm.org/D71396.
Much of the changes present in D71396 will come in smaller follow-up patches
that will add support for hashing the MachineOperand types that aren't
covered piece-meal with tests for each new case.
Johannes Doerfert [Sat, 14 Dec 2019 06:47:29 +0000 (00:47 -0600)]
[Attributor][Tests] Copy & use the ArgumentPromotion tests
Johannes Doerfert [Thu, 10 Oct 2019 07:10:51 +0000 (02:10 -0500)]
[ArgPromo][Tests] Run update_test_checks on all ArgumentPromotion tests
Summary:
In preparation of D65531 as well as the reuse of these tests for the
Attributor, we modernize them and use the update_test_checks to simplify
updates.
This was done with the update_test_checks after D68819 and D68850.
Reviewers: hfinkel, vsk, dblaikie, davidxl, tejohnson, tstellar, echristo, chandlerc, efriedma, lebedev.ri
Subscribers: bollu, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68766
John McCall [Sat, 14 Dec 2019 05:55:26 +0000 (00:55 -0500)]
MSVC build fix: forget some unneeded and incorrect friends.
On MSVC, friend declarations are (incorrectly) visible even if
not otherwise declared, which causes them to interfere with
lookup. ASTTypeWriter is actually in an anonymous namespace
and cannot be ASTWriter's friend. The others simply don't need
to be anymore.
Johannes Doerfert [Sat, 14 Dec 2019 05:41:02 +0000 (23:41 -0600)]
[Attributor] Annotate call sites of declarations with a callback
Even if a declaration is called, if there is a callback we might need
the information during CG-SCC traversal (D70767).
Johannes Doerfert [Sat, 14 Dec 2019 05:39:48 +0000 (23:39 -0600)]
[Attributor][NFC] Add more simple test situations for callbacks
Johannes Doerfert [Sat, 14 Dec 2019 05:38:05 +0000 (23:38 -0600)]
[Attributor][NFC] Reorder test functions
Since one of the functions has a personality the attribute set is
printed. If the function is the first it should (hopefully) always be #0
Johannes Doerfert [Sat, 14 Dec 2019 05:35:45 +0000 (23:35 -0600)]
[Attributor][NFC] Simplify debug printing for abstract attributes
This also fixes a type in the debug printing of AANoAlias.
John McCall [Sat, 14 Dec 2019 02:54:44 +0000 (21:54 -0500)]
Abstract serialization: TableGen the (de)serialization code for Types.
The basic technical design here is that we have three levels
of readers and writers:
- At the lowest level, there's a `Basic{Reader,Writer}` that knows
how to emit the basic structures of the AST. CRTP allows this to
be metaprogrammed so that the client only needs to support a handful
of primitive types (e.g. `uint64_t` and `IdentifierInfo*`) and more
complicated "inline" structures such as `DeclarationName` can just
be emitted in terms of those primitives.
In Clang's binary-serialization code, these are
`ASTRecord{Reader,Writer}`. For now, a large number of basic
structures are still emitted explicitly by code on those classes
rather than by either TableGen or CRTP metaprogramming, but I
expect to move more of these over.
- In the middle, there's a `Property{Reader,Writer}` which is
responsible for processing the properties of a larger object. The
object-level reader/writer asks the property-level reader/writer to
project out a particular property, yielding a basic reader/writer
which will be used to read/write the property's value, like so:
```
propertyWriter.find("count").writeUInt32(node->getCount());
```
Clang's binary-serialization code ignores this level (it uses
the basic reader/writer as the property reader/writer and has the
projection methods just return `*this`) and simply relies on the
roperties being read/written in a stable order.
- At the highest level, there's an object reader/writer (e.g.
`Type{Reader,Writer}` which emits a logical object with properties.
Think of this as writing something like a JSON dictionary literal.
I haven't introduced support for bitcode abbreviations yet --- it
turns out that there aren't any operative abbreviations for types
besides the QualType one --- but I do have some ideas of how they
should work. At any rate, they'll be necessary in order to handle
statements.
I'm sorry for not disentangling the patches that added basic and type
reader/writers; I made some effort to, but I ran out of energy after
disentangling a number of other patches from the work.
Negligible impact on module size, time to build a set of about 20
fairly large modules, or time to read a few declarations out of them.
John McCall [Sat, 14 Dec 2019 02:52:16 +0000 (21:52 -0500)]
Abstract serialization: TableGen "basic" reader/writer CRTP
classes that serialize basic values
John McCall [Fri, 13 Dec 2019 08:37:23 +0000 (03:37 -0500)]
Standardize the reader methods in ASTReader; NFC.
There are three significant changes here:
- Most of the methods to read various embedded structures (`APInt`,
`NestedNameSpecifier`, `DeclarationName`, etc.) have been moved
from `ASTReader` to `ASTRecordReader`. This cleans up quite a
bit of code which was passing around `(F, Record, Idx)` arguments
everywhere or doing explicit indexing, and it nicely parallels
how it works on the writer side. It also sets us up to then move
most of these methods into the `BasicReader`s that I'm introducing
as part of abstract serialization.
As part of this, several of the top-level reader methods (e.g.
`readTypeRecord`) have been converted to use `ASTRecordReader`
internally, which is a nice readability improvement.
- I've standardized most of these method names on `readFoo` rather
than `ReadFoo` (used in some of the helper structures) or `GetFoo`
(used for some specific types for no apparent reason).
- I've changed a few of these methods to return their result instead
of reading into an argument passed by reference. This is partly
for general consistency and partly because it will make the
metaprogramming easier with abstract serialization.
John McCall [Wed, 11 Dec 2019 08:30:22 +0000 (03:30 -0500)]
Extract the TypeClass <-> TypeCode map into a .def file; NFC.
John McCall [Tue, 10 Dec 2019 21:23:43 +0000 (16:23 -0500)]
Enable better node-hierarchy metaprogramming; NFC.
John McCall [Tue, 10 Dec 2019 21:20:36 +0000 (16:20 -0500)]
Extract out WrappedRecord as a convenience base class; NFC.
John McCall [Tue, 10 Dec 2019 21:14:41 +0000 (16:14 -0500)]
Add a function to get the ExceptionSpecInfo of a function type; NFC.
John McCall [Mon, 28 Oct 2019 16:45:53 +0000 (09:45 -0700)]
Introduce some types and functions to make it easier to work with
the tblgen AST node hierarchies.
Not totally NFC because both of the emitters now emit in a different
order. The type-nodes emitter now visits nodes in hierarchy order,
which means we could use range checks in classof if we had any types
that would benefit from that; currently we do not. The AST-nodes
emitter now uses a multimap keyed by the name of the record; previously
it was using `Record*`, which of couse isn't stable across processes
and may have led to non-reproducible builds in some circumstances.
John McCall [Mon, 28 Oct 2019 16:25:31 +0000 (09:25 -0700)]
[NFC] Correct accidental use of tabs.
John McCall [Sat, 26 Oct 2019 01:38:07 +0000 (18:38 -0700)]
[NFC] Rename ClangASTEmitters.h -> ASTTableGen.h
Johannes Doerfert [Sat, 14 Dec 2019 04:11:42 +0000 (22:11 -0600)]
[Attributor] Only replace instruction operands
This was part of D70767. When we replace the value of (call/invoke)
instructions we do not want to disturb the old call graph so we will
only replace instruction uses until we get rid of the old PM.
Accepted as part of D70767.
Johannes Doerfert [Sat, 2 Nov 2019 04:37:04 +0000 (23:37 -0500)]
[Attributor] Reuse the IPConstantProp tests for the Attributor
The Attributor can, to some degree, do what IPConstantProp does. We can
consequently use the corner cases already collected and tested for in
the IPConstantProp tests to improve Attributor test coverage.
This exposed various bugs fixed in previous Attributor patches.
Not all functionality of IPConstantProp is available in AAValueSimplify
and AAIsDead so some tests show that we cannot perform the expected
constant propagation.
Reviewers: fhahn, efriedma, mssimpso, davide
Subscribers: bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69748
Nico Weber [Sat, 14 Dec 2019 03:19:11 +0000 (22:19 -0500)]
gn build: add deps I failed to add in
b2508ce85c1
Xin-Xin Wang [Sat, 14 Dec 2019 03:04:36 +0000 (19:04 -0800)]
[clang] Move CLANG_BOOTSTRAP_CMAKE_ARGS above PASSTHROUGH_VARIABLES
I want to pass some CMake cache files in CLANG_BOOTSTRAP_CMAKE_ARGS as
`-C <cache file>.cmake` arguments. I want to be able to use the values
of the bootstrap passthrough variables in the cache files, so the cache
file arguments need to be after passthrough variables. This should be
safe because the values of passthrough variables are all constants and
can't refer to values in CLANG_BOOTSTRAP_CMAKE_ARGS.
Differential Revision: https://reviews.llvm.org/D71428
Fangrui Song [Sat, 7 Dec 2019 18:23:30 +0000 (10:23 -0800)]
[AArch64] Save FP for leaf functions when disabling frame pointer elimination
The change allows clang -mno-omit-leaf-frame-pointer to disable frame
pointer elimination. This behavior matches X86 and Mips, and also GCC
AArch64.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D71168
Fangrui Song [Sat, 7 Dec 2019 18:40:39 +0000 (10:40 -0800)]
[Driver] Default to -momit-leaf-frame-pointer for AArch64
This matches https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html
> -momit-leaf-frame-pointer
> -mno-omit-leaf-frame-pointer
>
> Omit or keep the frame pointer in leaf functions. The former behavior is the default.
-mno-omit-leaf-frame-pointer is currently a no-op because
TargetOptions::DisableFramePointerElim is only considered for non-leaf
functions.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D71167
Richard Smith [Sat, 14 Dec 2019 02:38:33 +0000 (18:38 -0800)]
PR44268: Fix crash if __builtin_object_size is applied to a heap
allocation.
Richard Smith [Thu, 12 Dec 2019 01:28:46 +0000 (17:28 -0800)]
[c++20] Improve phrasing of diagnostic for missing #include <compare>.
Stephan T. Lavavej [Sat, 14 Dec 2019 02:14:09 +0000 (18:14 -0800)]
[libcxx] [test] Include missing headers. (NFC)
libcxx/test/std/containers/sequences/array/at.pass.cpp
Need to include <stdexcept> for std::out_of_range.
libcxx/test/std/localization/locale.categories/category.time/*
Need to include <ios> for std::ios.
Artem Dergachev [Sat, 14 Dec 2019 01:59:36 +0000 (17:59 -0800)]
[analyzer] CStringChecker: Fix a crash on unknown value passed to strlcat.
Checkers should always account for unknown values.
Also use a slightly more high-level API that naturally avoids the problem.
Sean Fertile [Fri, 13 Dec 2019 19:34:11 +0000 (14:34 -0500)]
[PowerPC] Add Support for indirect calls on AIX.
Extends the desciptor-based indirect call support for 32-bit codegen,
and enables indirect calls for AIX.
In-depth Description:
In a function descriptor based ABI, a function pointer points at a
descriptor structure as opposed to the function's entry point. The
descriptor takes the form of 3 pointers: 1 for the function's entry
point, 1 for the TOC anchor of the module containing the function
definition, and 1 for the environment pointer:
struct FunctionDescriptor {
void *EntryPoint;
void *TOCAnchor;
void *EnvironmentPointer;
};
An indirect call has several steps of loading the the information from
the descriptor into the proper registers for setting up the call. Namely
it has to:
1) Save the caller's TOC pointer into the TOC save slot in the linkage
area, and then load the callee's TOC pointer into the TOC register
(GPR 2 on AIX).
2) Load the function descriptor's entry point into the count register.
3) Load the environment pointer into the environment pointer register
(GPR 11 on AIX).
4) Perform the call by branching on count register.
5) Restore the caller's TOC pointer after returning from the indirect call.
A couple important caveats to the above:
- There is no way to directly load a value from memory into the count register.
Instead we populate the count register by loading the entry point address into
a gpr and then moving the gpr to the count register.
- The TOC restore has to come immediately after the branch on count register
instruction (i.e., the 1st instruction executed after we return from the
call). This is an implementation limitation. We could, in theory, schedule
the restore elsewhere as long as no uses of the TOC pointer fall in between
the call and the restore; however, to keep it simple, we insert a pseudo
instruction that represents both the indirect branch instruction and the
load instruction that restores the caller's TOC from the linkage area. As
they flow through the compiler as a single pseudo instruction, nothing can be
inserted between them and the caller's TOC is then valid at any use.
Differtential Revision: https://reviews.llvm.org/D70724
Julian Lettner [Tue, 26 Feb 2019 06:51:50 +0000 (22:51 -0800)]
[lit] Small cleanups. NFCI
Remove unnecessary (argument same as default), cleanup imports, use
"pythonic" names for variables, and general formatting.
Michael Kruse [Sat, 14 Dec 2019 00:40:54 +0000 (18:40 -0600)]
[OpenMP][Docs] Claim loop tiling.
Fangrui Song [Sat, 14 Dec 2019 00:40:34 +0000 (16:40 -0800)]
[Mips] Fix gcc -Wunused-but-set-variable in -DLLVM_ENABLE_ASSERTIONS=Off builds after D71028
Roman Tereshin [Thu, 12 Dec 2019 21:20:41 +0000 (13:20 -0800)]
[Legalizer] Making artifact combining order-independent
Legalization algorithm is complicated by two facts:
1) While regular instructions should be possible to legalize in
an isolated, per-instruction, context-free manner, legalization
artifacts can only be eliminated in pairs, which could be deeply, and
ultimately arbitrary nested: { [ () ] }, where which paranthesis kind
depicts an artifact kind, like extend, unmerge, etc. Such structure
can only be fully eliminated by simple local combines if they are
attempted in a particular order (inside out), or alternatively by
repeated scans each eliminating only one innermost pair, resulting in
O(n^2) complexity.
2) Some artifacts might in fact be regular instructions that could (and
sometimes should) be legalized by the target-specific rules. Which
means failure to eliminate all artifacts on the first iteration is
not a failure, they need to be tried as instructions, which may
produce more artifacts, including the ones that are in fact regular
instructions, resulting in a non-constant number of iterations
required to finish the process.
I trust the recently introduced termination condition (no new artifacts
were created during as-a-regular-instruction-retrial of artifacts not
eliminated on the previous iteration) to be efficient in providing
termination, but only performing the legalization in full if and only if
at each step such chains of artifacts are successfully eliminated in
full as well.
Which is currently not guaranteed, as the artifact combines are applied
only once and in an arbitrary order that has to do with the order of
creation or insertion of artifacts into their worklist, which is a no
particular order.
In this patch I make a small change to the artifact combiner, making it
to re-insert into the worklist immediate (modulo a look-through copies)
artifact users of each vreg that changes its definition due to an
artifact combine.
Here the first scan through the artifacts worklist, while not
being done in any guaranteed order, only needs to find the innermost
pair(s) of artifacts that could be immediately combined out. After that
the process follows def-use chains, making them shorter at each step, thus
combining everything that can be combined in O(n) time.
Reviewers: volkan, aditya_nandakumar, qcolombet, paquette, aemerson, dsanders
Reviewed By: aditya_nandakumar, paquette
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71448
Roman Tereshin [Thu, 12 Dec 2019 16:35:16 +0000 (08:35 -0800)]
[Legalizer] Refactoring out legalizeMachineFunction
and introducing new unittests/CodeGen/GlobalISel/LegalizerTest.cpp
relying on it to unit test the entire legalizer algorithm (including the
top-level main loop).
See also https://reviews.llvm.org/D71448
Roman Tereshin [Thu, 12 Dec 2019 21:08:40 +0000 (13:08 -0800)]
[Legalizer] More detailed debugging printing in main loop
Vedant Kumar [Fri, 13 Dec 2019 20:57:37 +0000 (12:57 -0800)]
[ubsan] Enable testing of .m files
This allows `.m` test files, like the existing Misc/bool.m, to be
tested.
Jonas Devlieghere [Fri, 13 Dec 2019 22:48:30 +0000 (14:48 -0800)]
[lldb/SWIG] Modulerize lldb.swig so parts of it can be reused.
This groups the headers and interfaces in separate files that can be
included by other swig files for different languages.
Fangrui Song [Thu, 12 Dec 2019 18:49:46 +0000 (10:49 -0800)]
[Driver] Use .init_array for all gcc installations and simplify Generic_ELF -fno-use-init-array rules
D39317 made clang use .init_array when no gcc installations is found.
This change changes all gcc installations to use .init_array .
GCC 4.7 by default stopped providing .ctors/.dtors compatible crt files,
and stopped emitting .ctors for __attribute__((constructor)).
.init_array should always work.
FreeBSD rules are moved to FreeBSD.cpp to make Generic_ELF rules clean.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D71434
Alexey Bataev [Fri, 13 Dec 2019 21:05:30 +0000 (16:05 -0500)]
[OPENMP]Fix skipping of functions body.
When parsing the code with OpenMP and the function's body must be
skipped, need to skip also OpenMP annotation tokens. Otherwise the
counters for braces/parens are unbalanced and parsing fails.
Jonas Devlieghere [Fri, 13 Dec 2019 21:46:30 +0000 (13:46 -0800)]
[lldb/CMake] Initialize LLDB_ENABLE_POSIX based on the UNIX variable.
Jonas Devlieghere [Fri, 13 Dec 2019 18:37:33 +0000 (10:37 -0800)]
[lldb/CMake] Rename LLDB_DISABLE_PYTHON to LLDB_ENABLE_PYTHON
This matches the naming scheme used by LLVM and all the other optional
dependencies in LLDB.
Differential revision: https://reviews.llvm.org/D71482
Alex Richardson [Fri, 13 Dec 2019 19:44:13 +0000 (19:44 +0000)]
[LSAN] Increase stack space for guard-page.c test
Summary:
When running the tests on a Ubuntu 18.04 machine this test is crashing for
me inside the runtime linker. My guess is that it is trying to save more
registers (possibly large vector ones) and the current stack space is not
sufficient.
Reviewers: samsonov, kcc, eugenis
Reviewed By: eugenis
Subscribers: eugenis, merge_guards_bot, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D71461
Alex Richardson [Fri, 13 Dec 2019 19:43:15 +0000 (19:43 +0000)]
[NFC] Use SelectionDAG::getMemBasePlusOffset() instead of getNode(ISD::ADD)
Summary:
To find potential opportunities to use getMemBasePlusOffset() I looked at
all ISD::ADD uses found with the regex getNode\(ISD::ADD,.+,.+Ptr
in lib/CodeGen/SelectionDAG. If this patch is accepted I will convert
the files in the individual backends too.
The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.
We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.
Reviewers: spatel
Reviewed By: spatel
Subscribers: merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71207
Alex Richardson [Fri, 13 Dec 2019 19:43:06 +0000 (19:43 +0000)]
[NFC] Implement SelectionDAG::getObjectPtrOffset() using getMemBasePlusOffset()
Summary:
This change is preparatory work to use this helper functions in more places.
In order to make this change, getMemBasePlusOffset() has been extended to
also take a SDNodeFlags parameter.
The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.
We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.
Reviewers: spatel
Reviewed By: spatel
Subscribers: merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71206
Alex Richardson [Fri, 13 Dec 2019 19:43:02 +0000 (19:43 +0000)]
[NFC] Add a SDValue overload for SelectionDAG::getMemBasePlusOffset()
Summary:
This change is preparatory work to use this helper functions in more places.
Currently the function only allows integer constants offsets, but there
are cases where we can use an existing SDValue parameter.
The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.
We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.
Reviewers: spatel, craig.topper
Reviewed By: spatel, craig.topper
Subscribers: craig.topper, merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71205
Alex Richardson [Fri, 13 Dec 2019 19:42:58 +0000 (19:42 +0000)]
[NFC] Change SelectionDAG::getMemBasePlusOffset() to use int64_t
Summary:
This change is preparatory work to use this helper functions in more places.
Currently the function only allows positive offsets, but there are cases
where we want to subtract an offset from an existing pointer.
The motivation for this change is our out-of-tree CHERI backend
(https://github.com/CTSRD-CHERI/llvm-project). We use a separate register
type to store pointers (128-bit capabilities, which are effectively
unforgeable and monotonic fat pointers). These capabilities permit a
reduced set of operations and therefore use a separate ValueType (iFATPTR).
to represent pointers implemented as capabilities.
Therefore, we need to avoid using ISD::ADD for our patterns that operate
on pointers and need to use a function that chooses ISD::ADD or a new
ISD::PTRADD opcode depending on the value type.
We originally added a new DAG.getPointerAdd() function, but after this
patch series we can modify the implementation of getMemBasePlusOffset()
instead. Avoiding direct uses of ISD::ADD for pointer types will
significantly reduce the amount of assertion/instruction selection
failures for us in future upstream merges.
Reviewers: spatel
Reviewed By: spatel
Subscribers: merge_guards_bot, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71204
Alexey Bataev [Fri, 13 Dec 2019 21:24:10 +0000 (16:24 -0500)]
Revert "[libomptarget] Move resource id functions into target specific code, implement for amdgcn"
This reverts commit
dbb3fec8adfc4ac3fbf31f51f294427dbabbebb2 since it
breaks the NVPTX tests.
Akira Hatanaka [Thu, 12 Dec 2019 06:51:18 +0000 (22:51 -0800)]
Call objc_retainBlock before passing a block as a variadic argument
Copy the block to the heap before passing it to the callee in case the
block escapes in the callee.
rdar://problem/
55683462
Differential Revision: https://reviews.llvm.org/D71431
Eric Christopher [Fri, 13 Dec 2019 20:54:13 +0000 (12:54 -0800)]
Fix -Wswitch-coverage warning in clang-tidy after ak_addrspace introduction.
Differential Revision: https://reviews.llvm.org/D71486
Reviewed By: rsmith
Eric Fiselier [Fri, 13 Dec 2019 20:42:07 +0000 (15:42 -0500)]
[libc++] Ensure __config always defines certain configuration macros.
Med Ismail Bennani [Tue, 10 Dec 2019 23:09:25 +0000 (15:09 -0800)]
LanguageRuntime: Simplify NSException::GetSummary() output
Summary:
Right now, NSException::GetSummary() has the following output:
"name: $exception_name - reason: $exception_reason"
It would be better to simplify the output by removing the name and only
showing the exception's reason. This way, annotations would look nicer in
the editor, and would be a shorter summary in the Variables Inspector.
Accessing the exception's name can still be done by expanding the
NSException object in the Variables Inspector.
rdar://
54770115
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71311
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Erich Keane [Fri, 13 Dec 2019 20:15:41 +0000 (12:15 -0800)]
Correct gcc vector splat conversion from float to int-vector
In looking into some other code, I came across this issue where a
float converted to a gcc integer vector via a splat causes it to miss
the float-to-integral cast, which causes some REALLY strange codegen
bugs.
The AST looked like:
`-ImplicitCastExpr <col:13>
'gcc_int_2':'__attribute__((__vector_size__(2 * sizeof(int)))) int' <VectorSplat>
`-ImplicitCastExpr <col:13> 'float' <LValueToRValue>
`-DeclRefExpr <col:13> 'float' lvalue ParmVar
0x556f16a5dc90 'f' 'float'
Despite the type of the VectorSplat cast as printed, it ended up
becoming a vector of float, which caused non-matching instructions. For
example, IntVector + a float constant resulted in:
add <2 x i32> %8, <2 x float> <float 3.000000e+00, float 3.000000e+00>
This patch corrects the conversion so that the float is first converted
to an integral, THEN splatted.
Sam Elliott [Fri, 13 Dec 2019 20:00:14 +0000 (20:00 +0000)]
[RISCV] Move DebugLoc Copy into CompressInstEmitter
Summary:
This copy ensures that debug location information is kept for
compressed instructions. There are places where both compressInstruction and
uncompressInstruction are called that were not doing this copy, discarding some
debug info.
This change merely moves the copy into the generated file, so you cannot forget
to copy the location over when compressing or uncompressing.
Reviewers: asb, luismarques
Reviewed By: luismarques
Subscribers: sameer.abuasal, aprantl, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D67493
Francesco Petrogalli [Fri, 13 Dec 2019 19:15:29 +0000 (19:15 +0000)]
Revert "[VectorUtils] Introduce the Vector Function Database (VFDatabase)."
This reverts commit
0be81968a283fd4161cb9ac9748d5ed200926292.
The VFDatabase needs some rework to be able to handle vectorization
and subsequent scalarization of intrinsics in out-of-tree versions of
the compiler. For more details, see the discussion in
https://reviews.llvm.org/D67572.
Fangrui Song [Fri, 13 Dec 2019 19:15:40 +0000 (11:15 -0800)]
[profile] Fix a crash when -fprofile-remapping-file= triggers an error
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D71485
Sanjay Patel [Fri, 13 Dec 2019 19:03:18 +0000 (14:03 -0500)]
[InstSimplify] improve test coverage for insert+splat; NFC