Guillaume Chatelet [Mon, 16 Dec 2019 14:19:09 +0000 (15:19 +0100)]
Revert "[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove"
This reverts commit
181ab91efc9fb08dedda10a2fbc5fccb83ce8799.
Nico Weber [Mon, 16 Dec 2019 14:02:41 +0000 (09:02 -0500)]
gn build: (manually, belatedly) merge r358832
Nico Weber [Mon, 16 Dec 2019 14:01:55 +0000 (09:01 -0500)]
gn build: (manually, belatedly) merge r371898
David Tellenbach [Mon, 16 Dec 2019 12:19:54 +0000 (13:19 +0100)]
Reland [AArch64][MachineOutliner] Return address signing for outlined functions
Summary:
Reland after fixing a bug that allowed outlining of SP modifying instructions
that invalidated return address signing.
During AArch64 frame lowering instructions to enable return address
signing are inserted into functions if needed. Functions generated during
machine outlining don't run through target frame lowering and hence are
missing such instructions.
This patch introduces the following changes:
1. If not all functions that potentially participate in function outlining agree
on their return address signing scope and their return address signing key,
outlining is disabled for these functions.
2. If not all functions that potentially participate in function outlining agree
on their support for v8.3A features, outlining is disabled for these
functions.
3. If an outlining candidate would outline instructions that modify sp in a way
that invalidates return address signing, outlining is disabled for that
particular candidate.
4. If all candidate functions agree on the signing scope, signing key and their
support for v8.3 features, the outlined function behaves as if it had the
same scope and key attributes and as if it would provide the same v8.3A
support as the original functions.
Reviewers: ostannard, paquette
Reviewed By: ostannard
Subscribers: kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70635
Kristof Beyls [Mon, 16 Dec 2019 13:31:12 +0000 (13:31 +0000)]
find_interesting_reviews.py: adapt to github monorepo
Pavel Labath [Mon, 16 Dec 2019 13:09:09 +0000 (14:09 +0100)]
[lldb] Use file-based synchronization in TestVSCode_attach
The is the best method we have at the moment for attach-style tests.
Guillaume Chatelet [Fri, 13 Dec 2019 15:14:39 +0000 (16:14 +0100)]
[llvm-exegesis] Set up AsmTargetStreamer in readSnippets
Summary: This is a follow up on D71137 properly setting up the AsmTargetStreamer prior to AsmParser::Run call.
Reviewers: courbet, mstojanovic
Subscribers: tschuett, mikhail.ramalho, llvm-commits, petarj, atanasyan
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71468
Guillaume Chatelet [Fri, 13 Dec 2019 16:54:50 +0000 (17:54 +0100)]
[Alignment][NFC] Deprecate CreateMemCpy/CreateMemMove
Summary:
This patch introduces a set of functions to enable deprecation of IRBuilder functions without breaking out of tree clients.
Functions will be deprecated one by one and as in tree code is cleaned up.
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: arsenm, jvesely, nhaehnle, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71473
Andrzej Warzynski [Mon, 16 Dec 2019 12:22:42 +0000 (12:22 +0000)]
[AArch64][SVE2] Add intrinsics for binary narrowing operations
Summary:
The following intrinsics for binary narrowing add and sub operations are
added:
* @llvm.aarch64.sve.addhnb
* @llvm.aarch64.sve.addhnt
* @llvm.aarch64.sve.raddhnb
* @llvm.aarch64.sve.raddhnt
* @llvm.aarch64.sve.subhnb
* @llvm.aarch64.sve.subhnt
* @llvm.aarch64.sve.rsubhnb
* @llvm.aarch64.sve.rsubhnt
Reviewers: sdesmalen, rengolin, efriedma
Reviewed By: sdesmalen, efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71424
Kristof Beyls [Mon, 16 Dec 2019 11:57:05 +0000 (11:57 +0000)]
[AArch64] Enable emission of stack maps for non-Mach-O binaries on AArch64.
The emission of stack maps in AArch64 binaries has been disabled for all
binary formats except Mach-O since rL206610, probably mistakenly, as far
as I can tell. This patch reverts this to its intended state.
Differential Revision: https://reviews.llvm.org/D70069
Patch by Loic Ottet.
Andrzej Warzynski [Mon, 16 Dec 2019 11:51:10 +0000 (11:51 +0000)]
[Aarch64][SVE] Add intrinsics for scatter stores
Summary:
This patch adds the following SVE intrinsics for scatter stores:
* 64-bit offsets:
* @llvm.aarch64.sve.st1.scatter (unscaled)
* @llvm.aarch64.sve.st1.scatter.index (scaled)
* 32-bit unscaled offsets:
* @llvm.aarch64.sve.st1.scatter.uxtw (zero-extended offset)
* @llvm.aarch64.sve.st1.scatter.sxtw (sign-extended-offset)
* 32-bit scaled offsets:
* @llvm.aarch64.sve.st1.scatter.uxtw.index (zero-extended offset)
* @llvm.aarch64.sve.st1.scatter.sxtw.index (sign-extended offset)
* vector base + immediate:
* @llvm.aarch64.sve.st1.scatter.imm
Reviewers: rengolin, efriedma, sdesmalen
Reviewed By: efriedma, sdesmalen
Subscribers: kmclaughlin, eli.friedman, tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71074
Raphael Isemann [Mon, 16 Dec 2019 09:06:38 +0000 (10:06 +0100)]
[lldb] Add unit test for ClangASTImporter
Alex Richardson [Fri, 13 Dec 2019 10:25:15 +0000 (10:25 +0000)]
Add initial tests for update_{llc_,cc_,}test_checks.py
Summary:
This commit adds basic tests for these update script to validate that
they still work as expected. In the future we could extend these tests
whenever new features are added to avoid introducing regressions.
Reviewers: xbolva00, MaskRay, jdoerfert
Reviewed By: jdoerfert
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70660
Raphael Isemann [Mon, 16 Dec 2019 10:52:36 +0000 (11:52 +0100)]
[lldb][NFC] Remove all overloads of Copy/DeportType in ClangASTImporter
The overloads that don't take a CompilerType serve no purpose as we
always have a CompilerType in the scope where we call them. Instead
just call the overload that takes a CompilerType and delete the
now unused other overloaded methods.
Pavel Labath [Tue, 10 Dec 2019 13:54:41 +0000 (14:54 +0100)]
[lldb] Centralize desugaring of decltype-like types in ClangASTContext
Summary:
These types were handled in some places, but not others. This resulted
in (for example) not being able to display members of structs whose
types were defined using these constructs.
Using getLocallyUnqualifiedSingleStepDesugaredType for these types is
not fully equivalent, as it will only desugar them if the types are not
instantiation-dependent, whereas previously we did that unconditionally.
It's not clear to me which behavior is correct here, but the test suite
does not seem to care either way.
Reviewers: teemperor, shafik
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D71405
Jay Foad [Mon, 16 Dec 2019 10:41:38 +0000 (10:41 +0000)]
Fix whitespace.
Bjorn Pettersson [Fri, 13 Dec 2019 14:53:40 +0000 (15:53 +0100)]
[BasicBlockUtils] Fix dbg.value elimination problem in MergeBlockIntoPredecessor
Summary:
In commit
d60f34c20a2f31335c8d5626e (llvm-svn 317128,
PR35113) MergeBlockIntoPredecessor was changed into
discarding some dbg.value intrinsics referring to
PHI values, post-splice due to loop rotation.
That elimination of dbg.value intrinsics did not
consider which dbg.value to keep depending on the
context (e.g. if the variable is changing its value
several times inside the basic block).
In the past that hasn't been such a big problem since
CodeGenPrepare::placeDbgValues has moved the dbg.value
to be next to the PHI node anyway. But after commit
00e238896cd8ad3a7d7 CodeGenPrepare isn't doing that
any longer, so we need to be more careful when avoiding
duplicate dbg.value intrinsics in MergeBlockIntoPredecessor.
This patch replaces the code that tried to avoid duplicate
dbg.values by using the RemoveRedundantDbgInstrs helper.
Reviewers: aprantl, jmorse, vsk
Reviewed By: aprantl, vsk
Subscribers: jholewinski, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71480
Bjorn Pettersson [Fri, 13 Dec 2019 14:44:29 +0000 (15:44 +0100)]
[LoopRotate] Add test case to show dbg value problem
Summary:
In commit
d60f34c20a2f31335c8d5626e (llvm-svn 317128,
PR35113) MergeBlockIntoPredecessor was changed into
discarding some dbg.value intrinsics referring to
PHI values, post-splice due to loop rotation.
That elimination of dbg.value intrinsics does not
consider which dbg.value to keep based on the context.
Such as always keeping the one that comes first textually,
or the need to keep several of them in case the variable
is changing it's value several times inside the basic block.
In the past that hasn't been such a big problem since
CodeGenPrepare::placeDbgValues has moved the dbg.value
to be next to the PHI node anyway. But after commit
00e238896cd8ad3a7d7 CodeGenPrepare isn't doing that
any longer, so we need to be more careful when avoiding
duplicate dbg.value intrinsics in MergeBlockIntoPredecessor.
This patch is just a pre commit of the test case.
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71479
Bjorn Pettersson [Thu, 12 Dec 2019 19:51:13 +0000 (20:51 +0100)]
[BasicBlockUtils] Add utility to remove redundant dbg.value instrs
Summary:
Add a RemoveRedundantDbgInstrs to BasicBlockUtils with the
goal to remove redundant dbg intrinsics from a basic block.
This can be useful after various transforms, as it might
be simpler to do a filtering of dbg intrinsics after the
transform than during the transform.
One primary use case would be to replace a too aggressive
removal done by MergeBlockIntoPredecessor, seen at loop
rotate (not done in this patch).
The elimination algorithm currently focuses on dbg.value
intrinsics and is doing two iterations over the BB.
First we iterate backward starting at the last instruction
in the BB. Whenever a consecutive sequence of dbg.value
instructions are found we keep the last dbg.value for
each variable found (variable fragments are identified
using the {DILocalVariable, FragmentInfo, inlinedAt}
triple as given by the DebugVariable helper class).
Next we iterate forward starting at the first instruction
in the BB. Whenever we find a dbg.value describing a
DebugVariable (identified by {DILocalVariable, inlinedAt})
we save the {DIValue, DIExpression} that describes that
variables value. But if the variable already was mapped
to the same {DIValue, DIExpression} pair we instead drop
the second dbg.value.
To ease the process of making lit tests for this utility a
new pass is introduced called RedundantDbgInstElimination.
It can be executed by opt using -redundant-dbg-inst-elim.
Reviewers: aprantl, jmorse, vsk
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71478
Jay Foad [Mon, 16 Dec 2019 10:21:54 +0000 (10:21 +0000)]
Fix for AMDGPU MUL_I24 known bits calculation
Summary:
At present, the code calculating known bits of AMDGPU MUL_I24 confuses the concepts of "non-negative number" and "positive number".
In some situations, it results in incorrect code. I have a case where the optimizer replaces the result of calculating MUL_I24(-5, 0) with -8.
Reviewers: foad, arsenm
Reviewed By: arsenm
Subscribers: foad, arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Patch by Eugene Kuznetsov.
Differential Revision: https://reviews.llvm.org/D70367
Kirill Bobyrev [Mon, 16 Dec 2019 09:33:56 +0000 (10:33 +0100)]
[NFC] Fix typos in Clangd and Clang
Reviewed by: Jim
Differential Revision: https://reviews.llvm.org/D71455
Raphael Isemann [Mon, 16 Dec 2019 09:37:06 +0000 (10:37 +0100)]
[lldb][NFC] Move definition of ClangASTMetadata out of ClangExternalASTSourceCommon.h
Changing metadata of a ClangASTContext currently requires to include
the unrelated ClangExternalASTSourceCommon.h header because it actually defines
the ClangASTMetadata class.
This also removes the dependency from ClangASTImporter to ClangExternalASTSourceCommon.
Valentin Churavy [Sat, 14 Dec 2019 15:33:30 +0000 (10:33 -0500)]
[CodegenPrepare] Guard against degenerate branches
Summary:
Guard against a potential crash observed in https://github.com/JuliaLang/julia/issues/32994#issuecomment-
524249628
If two branches are collapsed we can encounter a degenerate conditional branch `TBB==FBB`.
The subsequent code assumes that they differ, so we exit out early.
Reviewers: ributzka, spatel
Subscribers: loladiro, dexonsmith, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66657
Sjoerd Meijer [Mon, 16 Dec 2019 09:11:47 +0000 (09:11 +0000)]
[ARM] Move MVE opcode helper functions to ARMBaseInstrInfo. NFC.
In ARMLowOverheadLoops.cpp, MVETailPredication.cpp, and MVEVPTBlock.cpp we have
quite a few helper functions all looking at the opcodes of MVE instructions.
This moves all these utility functions to ARMBaseInstrInfo.
Diferential Revision: https://reviews.llvm.org/D71426
Raphael Isemann [Mon, 16 Dec 2019 08:34:16 +0000 (09:34 +0100)]
[lldb][NFC] Fix file header of TestClangASTContext.cpp
Kadir Cetinkaya [Mon, 16 Dec 2019 08:17:24 +0000 (09:17 +0100)]
[clangd] Get rid of raw string literals in macro calls
Raphael Isemann [Mon, 16 Dec 2019 08:00:58 +0000 (09:00 +0100)]
[lldb][NFC] Remove ClangASTImporter::ResolveDeclOrigin
ResolveDeclOrigin was just an inconvenience method around GetDeclOrigin.
Dmitri Gribenko [Fri, 13 Dec 2019 21:33:53 +0000 (22:33 +0100)]
Fix title underline in LangRef
The docs didn't compile:
http://lab.llvm.org:8011/builders/llvm-sphinx-docs/builds/38906
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.