Eric Fiselier [Mon, 26 Nov 2018 20:15:38 +0000 (20:15 +0000)]
Add basic_string::__resize_default_init (from P1072)
This patch adds an implementation of __resize_default_init as
described in P1072R2. Additionally, it uses it in filesystem to
demonstrate its intended utility.
Once P1072 lands, or if it changes it's interface, I will adjust
the internal libc++ implementation to match.
llvm-svn: 347589
Zola Bridges [Mon, 26 Nov 2018 20:11:18 +0000 (20:11 +0000)]
Revert "[clang][slh] add attribute for speculative load hardening"
This reverts commit
801eaf91221ba6dd6996b29ff82659ad6359e885.
llvm-svn: 347588
Fangrui Song [Mon, 26 Nov 2018 20:07:07 +0000 (20:07 +0000)]
[COFF] ICF: use parallelForEach{,N}
Summary: They have an additional `ThreadsEnabled` check, which does not matter much.
Reviewers: pcc, ruiu, rnk
Reviewed By: ruiu
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54812
llvm-svn: 347587
Zola Bridges [Mon, 26 Nov 2018 19:41:14 +0000 (19:41 +0000)]
[clang][slh] add attribute for speculative load hardening
Summary:
LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.
This can be applied to functions and Objective C methods.
Reviewers: chandlerc, echristo
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54555
llvm-svn: 347586
Louis Dionne [Mon, 26 Nov 2018 19:30:08 +0000 (19:30 +0000)]
[libcxx] Fix XFAILs for aligned allocation tests
In r339743, I marked several aligned allocation tests as downright
unsupported on macosx in an attempt to unbreak the build. It turns
out that marking them as unuspported whenever we're on OS X is way
too coarse grained. This commit marks the tests as XFAIL with more
granularity.
llvm-svn: 347585
Than McIntosh [Mon, 26 Nov 2018 18:43:48 +0000 (18:43 +0000)]
[CodeGen] Support custom format of stack maps
Summary:
Add a hook to the GCMetadataPrinter for emitting stack maps in
custom format. The hook will be called at stack map generation
time. The default stack map format is used if there is no hook.
For this to be useful a few data structures and accessors are
exposed from the StackMaps class, so the custom printer can
access the stack map data.
This patch authored by Cherry Zhang <cherryyz@google.com>.
Reviewers: thanm, apilipenko, reames
Reviewed By: reames
Subscribers: reames, apilipenko, nemanjai, javed.absar, kbarton, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D53892
llvm-svn: 347584
Alexey Bataev [Mon, 26 Nov 2018 18:37:09 +0000 (18:37 +0000)]
[OPENMP][NVPTX]Emit default locations with the correct Exec|Runtime
modes.
If the region is inside target|teams|distribute region, we can emit the
locations with the correct info for execution mode and runtime mode.
Patch adds this ability to the NVPTX codegen to help the optimizer to
produce better code.
llvm-svn: 347583
Zola Bridges [Mon, 26 Nov 2018 18:13:31 +0000 (18:13 +0000)]
[clang][slh] Forward mSLH only to Clang CC1
Summary:
-mno-speculative-load-hardening isn't a cc1 option, therefore,
before this change:
clang -mno-speculative-load-hardening hello.cpp
would have the following error:
error: unknown argument: '-mno-speculative-load-hardening'
This change will only ever forward -mspeculative-load-hardening
which is a CC1 option based on which flag was passed to clang.
Also added a test that uses this option that fails if an error like the
above is ever thrown.
Thank you ericwf for help debugging and fixing this error.
Reviewers: chandlerc, EricWF
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D54763
llvm-svn: 347582
Erich Keane [Mon, 26 Nov 2018 17:51:27 +0000 (17:51 +0000)]
Delete dead code introduced in r347354.
ParentTy is never used other than an assignment, and since it is a
pointer, there is no side effect. Some versions of GCC notice and warn
on this.
Change-Id: I37dc1a18c7b58040419afb803621de13d8904a8f
llvm-svn: 347581
Louis Dionne [Mon, 26 Nov 2018 17:47:16 +0000 (17:47 +0000)]
[libcxx] Fix XFAIL for aligned deallocation test with trunk Clang
The test was marked as failing whenever the deployment target was 10.12
or older, but in reality the test passes when the deployment target is
10.12 on recent Clangs. This happens because only older clangs do not
honor the -faligned-allocation flag, which disables any availability
error related to aligned allocation support, regardless of the
deployment target.
llvm-svn: 347580
Davide Italiano [Mon, 26 Nov 2018 17:39:20 +0000 (17:39 +0000)]
[lit] Fully qualify lit_config to avoid runtime crashes.
llvm-svn: 347579
Davide Italiano [Mon, 26 Nov 2018 17:30:28 +0000 (17:30 +0000)]
[Cmake] Add missing dependency to `count`.
llvm-svn: 347578
Sam Parker [Mon, 26 Nov 2018 17:26:49 +0000 (17:26 +0000)]
[NFC] Replace magic numbers with CodeGenOpt enums
Use enum values from llvm/Support/CodeGen.h for the optimisation
levels in CompilerInvocation.
llvm-svn: 347577
Matt Arsenault [Mon, 26 Nov 2018 17:17:07 +0000 (17:17 +0000)]
AMDGPU: Cleanup / relax tests for future changes
llvm-svn: 347576
Gabor Marton [Mon, 26 Nov 2018 17:09:50 +0000 (17:09 +0000)]
[ASTImporter] Set MustBuildLookupTable on PrimaryContext
Summary: SetMustBuildLookupTable() must always be called on a primary context.
Reviewers: labath, shafik, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411
Differential Revision: https://reviews.llvm.org/D54863
llvm-svn: 347575
Ilya Biryukov [Mon, 26 Nov 2018 17:05:13 +0000 (17:05 +0000)]
[clangd] Do not drop diagnostics from macros
if they still end up being in the main file.
llvm-svn: 347574
Matt Arsenault [Mon, 26 Nov 2018 17:02:02 +0000 (17:02 +0000)]
AMDGPU: Don't optimize exec masks at -O0
llvm-svn: 347573
Matt Arsenault [Mon, 26 Nov 2018 17:02:01 +0000 (17:02 +0000)]
AMDGPU: Only add implicit super-reg def for first subreg
llvm-svn: 347572
Sander de Smalen [Mon, 26 Nov 2018 16:38:37 +0000 (16:38 +0000)]
[AArch64] Add aarch64_vector_pcs function attribute to Clang
This is the Clang patch to complement the following LLVM patches:
https://reviews.llvm.org/D51477
https://reviews.llvm.org/D51479
More information describing the vector ABI and procedure call standard
can be found here:
https://developer.arm.com/products/software-development-tools/\
hpc/arm-compiler-for-hpc/vector-function-abi
Patch by Kerry McLaughlin.
Reviewed By: rjmccall
Differential Revision: https://reviews.llvm.org/D54425
llvm-svn: 347571
Guillaume Chatelet [Mon, 26 Nov 2018 16:25:55 +0000 (16:25 +0000)]
[clang-tidy] Improving narrowing conversions
Summary:
Newly flagged narrowing conversions:
- integer to narrower signed integer (this is compiler implementation defined),
- integer - floating point narrowing conversions,
- floating point - integer narrowing conversions,
- constants with narrowing conversions (even in ternary operator).
Reviewers: hokein, alexfh, aaron.ballman, JonasToth
Reviewed By: aaron.ballman, JonasToth
Subscribers: lebedev.ri, courbet, nemanjai, xazax.hun, kbarton, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D53488
llvm-svn: 347570
Than McIntosh [Mon, 26 Nov 2018 16:16:09 +0000 (16:16 +0000)]
[CodeGen] Take SPAdj into account for STATEPOINT liveness args
Summary:
STATEPOINT records its args' locations on stack relative to SP.
If the SP is changed, take that into account.
This patch authored by Cherry Zhang <cherryyz@google.com>.
Reviewers: thanm, reames
Reviewed By: reames
Subscribers: reames, llvm-commits
Differential Revision: https://reviews.llvm.org/D53603
llvm-svn: 347569
Louis Dionne [Mon, 26 Nov 2018 16:14:56 +0000 (16:14 +0000)]
[libcxx] Use a type that is always an aggregate in variant's tests
Summary:
In PR39232, we noticed that some variant tests started failing in C++2a mode
with recent Clangs, because the rules for literal types changed in C++2a. As
a result, a temporary fix was checked in (enabling the test only in C++17).
This commit is what I believe should be the long term fix: I removed the
tests that checked constexpr default-constructibility with a weird type
from the tests for index() and valueless_by_exception(), and instead I
added tests for those using an obviously literal type in the test for the
default constructor.
Reviewers: EricWF, mclow.lists
Subscribers: christof, jkorous, dexonsmith, arphaman, libcxx-commits, rsmith
Differential Revision: https://reviews.llvm.org/D54767
llvm-svn: 347568
Sam McCall [Mon, 26 Nov 2018 16:00:11 +0000 (16:00 +0000)]
[clangd] Enable auto-index behind a flag.
Summary:
Ownership and configuration:
The auto-index (background index) is maintained by ClangdServer, like Dynamic.
(This means ClangdServer will be able to enqueue preamble indexing in future).
For now it's enabled by a simple boolean flag in ClangdServer::Options, but
we probably want to eventually allow injecting the storage strategy.
New 'sync' command:
In order to meaningfully test the integration (not just unit-test components)
we need a way for tests to ensure the asynchronous index reads/writes occur
before a certain point.
Because these tests and assertions are few, I think exposing an explicit "sync"
command for use in tests is simpler than allowing threading to be completely
disabled in the background index (as we do for TUScheduler).
Bugs:
I fixed a couple of trivial bugs I found while testing, but there's one I can't.
JSONCompilationDatabase::getAllFiles() may return relative paths, and currently
we trigger an assertion that assumes they are absolute.
There's no efficient way to resolve them (you have to retrieve the corresponding
command and then resolve against its directory property). In general I think
this behavior is broken and we should fix it in JSONCompilationDatabase and
require CompilationDatabase::getAllFiles() to be absolute.
Reviewers: kadircet
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D54894
llvm-svn: 347567
Ilya Biryukov [Mon, 26 Nov 2018 15:58:29 +0000 (15:58 +0000)]
[clangd] Fix compilation of IndexBenchmark
llvm-svn: 347566
Aaron Ballman [Mon, 26 Nov 2018 15:54:36 +0000 (15:54 +0000)]
Remove an unnecessary file; NFC.
This source file has not been needed since r346522 and was triggering diagnostics in MSVC about an object file which exports no public symbols (LNK4221).
llvm-svn: 347565
Gabor Marton [Mon, 26 Nov 2018 15:54:08 +0000 (15:54 +0000)]
[ASTImporter][Structural Eq] Check for isBeingDefined
Summary:
If one definition is currently being defined, we do not compare for
equality and we assume that the decls are equal.
Reviewers: a_sidorin, a.sidorin, shafik
Reviewed By: a_sidorin
Subscribers: gamesh411, shafik, rnkovacs, dkrupp, Szelethus, cfe-commits
Differential Revision: https://reviews.llvm.org/D53697
llvm-svn: 347564
Ilya Biryukov [Mon, 26 Nov 2018 15:52:16 +0000 (15:52 +0000)]
[clangd] Fix use-after-free with expected types in indexing
llvm-svn: 347563
Ilya Biryukov [Mon, 26 Nov 2018 15:38:01 +0000 (15:38 +0000)]
[clangd] Add type boosting in code completion
Reviewers: sammccall, ioeric
Reviewed By: sammccall
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D52276
llvm-svn: 347562
Nikita Popov [Mon, 26 Nov 2018 15:36:57 +0000 (15:36 +0000)]
[DemandedBits] Add support for funnel shifts
Add support for funnel shifts to the DemandedBits analysis. The
demanded bits of the first two operands can be determined if the
shift amount is constant. The demanded bits of the third operand
(shift amount) can be determined if the bitwidth is a power of two.
This is basically the same functionality as implemented in D54869
and D54478, but for DemandedBits rather than InstCombine.
Differential Revision: https://reviews.llvm.org/D54876
llvm-svn: 347561
Ilya Biryukov [Mon, 26 Nov 2018 15:29:14 +0000 (15:29 +0000)]
[clangd] Collect and store expected types in the index
Summary:
And add a hidden option to control whether the types are collected.
For experiments, will be removed when expected types implementation
is stabilized.
The index size is almost unchanged, e.g. the YAML index for all clangd
sources increased from 53MB to 54MB.
Reviewers: ioeric, sammccall
Reviewed By: sammccall
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D52274
llvm-svn: 347560
Ilya Biryukov [Mon, 26 Nov 2018 15:25:20 +0000 (15:25 +0000)]
[clangd] Initial implementation of expected types
Summary:
Provides facilities to model the C++ conversion rules without the AST.
The introduced representation can be stored in the index and used to
implement type-based ranking improvements for index-based completions.
Reviewers: sammccall, ioeric
Reviewed By: sammccall
Subscribers: malaperle, mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D52273
llvm-svn: 347559
Ilya Biryukov [Mon, 26 Nov 2018 15:24:48 +0000 (15:24 +0000)]
[Index] Expose USR generation for types
Summary: Used in clangd.
Reviewers: sammccall, ioeric
Reviewed By: sammccall
Subscribers: kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D52275
llvm-svn: 347558
Sanjay Patel [Mon, 26 Nov 2018 15:22:30 +0000 (15:22 +0000)]
[x86] promote all multiply i8 by constant to i32
We have these 2 "isDesirable" promotion hooks (I'm not sure why we need both of them, but that's
independent of this patch), and we can adjust them to promote "mul i8 X, C" to i32. Then, all of
our existing LEA and other multiply expansion magic happens as it would for i32 ops.
Some of the test diffs show that we could end up with an actual 32-bit mul instruction here
because we choose not to expand to simpler ops. That instruction could be slower depending on the
subtarget. On the plus side, this means we don't need a separate instruction to load the constant
operand and possibly an extra instruction to move the result. If we need to tune mul i32 further,
we could add a later transform that tries to shrink it back to i8 based on subtarget timing.
I did not bother to duplicate all of the 32-bit test file RUNs and target settings that exist to
test whether LEA expansion is cheap or not. The diffs here assume a default target, so that means
LEA is generally cheap.
Differential Revision: https://reviews.llvm.org/D54803
llvm-svn: 347557
Nemanja Ivanovic [Mon, 26 Nov 2018 14:35:38 +0000 (14:35 +0000)]
[PowerPC] Vector load/store builtins overstate alignment of pointers
A number of builtins in altivec.h load/store vectors from pointers to scalar
types. Currently they just cast the pointer to a vector pointer, but expressions
like that have the alignment of the target type. Of course, the input pointer
did not have that alignment so this triggers UBSan (and rightly so).
This resolves https://bugs.llvm.org/show_bug.cgi?id=39704
Differential revision: https://reviews.llvm.org/D54787
llvm-svn: 347556
Sylvestre Ledru [Mon, 26 Nov 2018 14:29:48 +0000 (14:29 +0000)]
Create a diagnostic group for warn_call_to_pure_virtual_member_function_from_ctor_dtor, so it can be turned into an error using Werror
Summary: Patch by Arnaud Bienner
Reviewers: davide, rsmith, jkorous
Reviewed By: jkorous
Subscribers: jkorous, sylvestre.ledru, cfe-commits
Differential Revision: https://reviews.llvm.org/D53807
llvm-svn: 347555
Sam McCall [Mon, 26 Nov 2018 13:35:02 +0000 (13:35 +0000)]
[clangd] Fix missing include from r347538 - fix windows buildbots
llvm-svn: 347554
George Rimar [Mon, 26 Nov 2018 13:15:57 +0000 (13:15 +0000)]
[LLD][ELF] - Added a test for "-image-base: number expected" message. NFC.
We had no such test.
llvm-svn: 347553
George Rimar [Mon, 26 Nov 2018 12:58:51 +0000 (12:58 +0000)]
[LLD][ELF] - Add a test for "unbalanced --push-state/--pop-state" error.
We had no such test.
llvm-svn: 347552
Haojian Wu [Mon, 26 Nov 2018 12:42:08 +0000 (12:42 +0000)]
[clang-tidy] No warning for auto new expression in smart check
Summary: The fix for `auto` new expression is illegal.
Reviewers: aaron.ballman
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D54832
llvm-svn: 347551
George Rimar [Mon, 26 Nov 2018 12:36:16 +0000 (12:36 +0000)]
[LLD][ELF] - Add a check for --split-stack-adjust-size error message. NFCI.
"--split-stack-adjust-size: size must be >= 0" message
was never tested.
llvm-svn: 347550
George Rimar [Mon, 26 Nov 2018 12:29:56 +0000 (12:29 +0000)]
[LLD][ELF] - Do not crash when parsing the -defsym option from a error state.
When we are in a error state, script parser will not parse the -defsym
expression and hence will not tokenize it. Then ScriptLexer::Pos will be 0
and LLD will assert and crash here:
MemoryBufferRef ScriptLexer::getCurrentMB() {
assert(!MBs.empty() && Pos > 0); // Bang !
Solution - stop parsing the defsym in a error state. That is consistent
with the regular case (when we parse the linker script).
llvm-svn: 347549
Eric Liu [Mon, 26 Nov 2018 12:12:01 +0000 (12:12 +0000)]
[clangd] Tune down scope boost for global scope
Summary:
This improves cross-namespace completions and has ignorable
impact on other completion types.
Metrics
```
==================================================================================================
OVERALL (excl. CROSS_NAMESPACE)
==================================================================================================
Total measurements: 109367 (-6)
All measurements:
MRR: 68.11 (+0.04) Top-1: 58.59% (+0.03%) Top-5: 80.00% (+0.01%) Top-100: 95.92% (-0.02%)
Full identifiers:
MRR: 98.35 (+0.09) Top-1: 97.87% (+0.17%) Top-5: 98.96% (+0.01%) Top-100: 99.03% (+0.00%)
Filter length 0-5:
MRR: 23.20 (+0.05) 58.72 (+0.01) 70.16 (-0.03) 73.44 (+0.03) 76.24 (+0.00) 80.79 (+0.14)
Top-1: 11.90% (+0.03%) 45.07% (+0.03%) 58.49% (-0.05%) 62.44% (-0.02%) 66.31% (-0.05%) 72.10% (+0.07%)
Top-5: 35.51% (+0.08%) 76.94% (-0.01%) 85.10% (-0.13%) 87.40% (-0.02%) 88.65% (+0.01%) 91.84% (+0.17%)
Top-100: 83.25% (-0.02%) 96.61% (-0.15%) 98.15% (-0.02%) 98.43% (-0.01%) 98.53% (+0.01%) 98.66% (+0.02%)
==================================================================================================
CROSS_NAMESPACE
==================================================================================================
Total measurements: 17702 (+27)
All measurements:
MRR: 28.12 (+3.26) Top-1: 21.07% (+2.70%) Top-5: 35.11% (+4.48%) Top-100: 74.31% (+1.02%)
Full identifiers:
MRR: 79.20 (+3.72) Top-1: 71.78% (+4.86%) Top-5: 88.39% (+2.84%) Top-100: 98.99% (+0.00%)
Filter length 0-5:
MRR: 0.92 (-0.10) 5.51 (+0.57) 18.30 (+2.34) 21.62 (+3.76) 32.00 (+6.00) 41.55 (+7.61)
Top-1: 0.56% (-0.08%) 2.44% (+0.15%) 9.82% (+1.47%) 12.59% (+2.16%) 21.17% (+4.47%) 30.05% (+6.72%)
Top-5: 1.20% (-0.15%) 7.14% (+1.04%) 25.17% (+3.91%) 29.74% (+5.90%) 43.29% (+9.59%) 54.75% (+9.79%)
Top-100: 5.49% (-0.01%) 56.22% (+2.59%) 86.69% (+1.08%) 89.03% (+2.04%) 93.74% (+0.78%) 96.99% (+0.59%)
```
Reviewers: sammccall
Reviewed By: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54851
llvm-svn: 347548
Haojian Wu [Mon, 26 Nov 2018 11:18:16 +0000 (11:18 +0000)]
[clangd] Use testPath in the test.
llvm-svn: 347547
Alexander Kornienko [Mon, 26 Nov 2018 11:11:52 +0000 (11:11 +0000)]
[clang-tidy] PrintStackTraceOnErrorSignal
llvm-svn: 347546
Diana Picus [Mon, 26 Nov 2018 11:07:02 +0000 (11:07 +0000)]
[ARM GlobalISel] Support G_CTLZ and G_CTLZ_ZERO_UNDEF
We can now select CLZ via the TableGen'erated code, so support G_CTLZ
and G_CTLZ_ZERO_UNDEF throughout the pipeline for types <= s32.
Legalizer:
If the CLZ instruction is available, use it for both G_CTLZ and
G_CTLZ_ZERO_UNDEF. Otherwise, use a libcall for G_CTLZ_ZERO_UNDEF and
lower G_CTLZ in terms of it.
In order to achieve this we need to add support to the LegalizerHelper
for the legalization of G_CTLZ_ZERO_UNDEF for s32 as a libcall (__clzsi2).
We also need to allow lowering of G_CTLZ in terms of G_CTLZ_ZERO_UNDEF
if that is supported as a libcall, as opposed to just if it is Legal or
Custom. Due to a minor refactoring of the helper function in charge of
this, we will also allow the same behaviour for G_CTTZ and G_CTPOP.
This is not going to be a problem in practice since we don't yet have
support for treating G_CTTZ and G_CTPOP as libcalls (not even in
DAGISel).
Reg bank select:
Map G_CTLZ to GPR. G_CTLZ_ZERO_UNDEF should not make it to this point.
Instruction select:
Nothing to do.
llvm-svn: 347545
Diana Picus [Mon, 26 Nov 2018 11:06:53 +0000 (11:06 +0000)]
Fix typo in comment. NFC
llvm-svn: 347544
George Rimar [Mon, 26 Nov 2018 10:33:29 +0000 (10:33 +0000)]
[LLD][ELF] - Remove the excessive safety return. NFC.
We explicitly call finalizeContents() only once for
DynamicSection. The code testing we do not do it twice is
just excessive.
It could be an assert, but we don't do
that for other sections, so does not seem we
should do it here too.
llvm-svn: 347543
Sam Parker [Mon, 26 Nov 2018 10:22:55 +0000 (10:22 +0000)]
[ARM] Prevent parallel macs for unsigned values
Both zext and sext are currently allowed during the search for narrow
sequences and sexts operands are later added to the mac candidates.
But operands of muls are also added, without checking whether they're
sext or zext, which means we can generate a signed smlad when we
shouldn't.
Differential Revision: https://reviews.llvm.org/D54790
llvm-svn: 347542
Fedor Sergeev [Mon, 26 Nov 2018 10:17:27 +0000 (10:17 +0000)]
Revert "[TTI] Reduction costs only need to include a single extract element cost"
This reverts commit r346970.
It was causing PR39774, a crash in slp-vectorizer on a rather simple loop
with just a bunch of 'and's in the body.
llvm-svn: 347541
George Rimar [Mon, 26 Nov 2018 10:07:10 +0000 (10:07 +0000)]
[LLD][ELF] - Add llvm_unreachable. NFC.
We never should call writeTo() for BSS section.
llvm-svn: 347540
Ilya Biryukov [Mon, 26 Nov 2018 09:57:41 +0000 (09:57 +0000)]
[clangd] Cleanup after landing documentSymbol. NFC
- fix compile error on older gcc in Protocol.cpp,
- remove redundant 'llvm::' qualifiers from Protocol.cpp,
- remove unused variables in AST.cpp
llvm-svn: 347539
Sam McCall [Mon, 26 Nov 2018 09:51:50 +0000 (09:51 +0000)]
[clangd] Auto-index watches global CDB for changes.
Summary:
Instead of receiving compilation commands, auto-index is triggered by just
filenames to reindex, and gets commands from the global comp DB internally.
This has advantages:
- more of the work can be done asynchronously (fetching compilation commands
upfront can be slow for large CDBs)
- we get access to the CDB which can be used to retrieve interpolated commands
for headers (useful in some cases where the original TU goes away)
- fits nicely with the filename-only change observation from r347297
The interface to GlobalCompilationDatabase gets extended: when retrieving a
compile command, the GCDB can optionally report the project the file belongs to.
This naturally fits together with getCompileCommand: it's hard to implement one
without the other. But because most callers don't care, I've ended up with an
awkward optional-out-param-in-virtual method pattern - maybe there's a better
one.
This is the main missing integration point between ClangdServer and
BackgroundIndex, after this we should be able to add an auto-index flag.
Reviewers: ioeric, kadircet
Subscribers: MaskRay, jkorous, arphaman, cfe-commits, ilya-biryukov
Differential Revision: https://reviews.llvm.org/D54865
llvm-svn: 347538
Haojian Wu [Mon, 26 Nov 2018 09:33:08 +0000 (09:33 +0000)]
[clang-tidy] Don't generate incorrect fixes for class with deleted copy constructor in smart_ptr check.
Summary:
The fix for aggregate initialization (`std::make_unique<Foo>(Foo {1, 2})` needs
to see Foo copy constructor, otherwise we will have a compiler error. So we
only emit the check warning.
Reviewers: JonasToth, aaron.ballman
Subscribers: xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D54745
llvm-svn: 347537
George Rimar [Mon, 26 Nov 2018 09:25:08 +0000 (09:25 +0000)]
[ELF] - Added test case for invalid relocation target errors. NFCI.
We had a proper error reporting, but no test cases.
llvm-svn: 347536
George Rimar [Mon, 26 Nov 2018 08:40:20 +0000 (08:40 +0000)]
[LLD][ELF] - Add a test for non-null terminated mergeable strings section. NFCI.
LLD reports an error in this case, but we had no test.
llvm-svn: 347535
Kang Zhang [Mon, 26 Nov 2018 07:15:31 +0000 (07:15 +0000)]
Revert "[PowerPC] Fix inconsistent ImmMustBeMultipleOf for same instruction"
This reverts commits r347532. Forget add the option
-mtriple powerpc64-unknown-linux-gnu. So other platform is error except
for PowerPC.
llvm-svn: 347534
Craig Topper [Mon, 26 Nov 2018 06:50:19 +0000 (06:50 +0000)]
[X86] Add test cases to show bad type legalization of fptosi/fptosui v16f32->v16i8 and v8f64->v8i16 on pre-AVX512 targets.
When splitting the v16f32/v8f64 result type, type legalization will try to promote the integer result type before a concat and an explicit truncate. But for the fptoui test case this is particularly bad since fptoui isn't supported on X86 until AVX512. We could use an fptosi since the result range would fit in a signed 32-bit value, but the generic type legalization doesn't do that transformation when splitting. It does do this when promoting.
llvm-svn: 347533
Kang Zhang [Mon, 26 Nov 2018 06:03:25 +0000 (06:03 +0000)]
[PowerPC] Fix inconsistent ImmMustBeMultipleOf for same instruction
Summary:
There are 4 instructions which have Inconsistent ImmMustBeMultipleOf in the
function PPCInstrInfo::instrHasImmForm, they are LFS, LFD, STFS, STFD.
These four instructions should set the ImmMustBeMultipleOf to 1 instead of 4.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D54738
llvm-svn: 347532
Bill Wendling [Mon, 26 Nov 2018 02:10:53 +0000 (02:10 +0000)]
A "constexpr" is evaluated in a constant context. Make sure this is reflected
if a __builtin_constant_p() is a part of a constexpr.
llvm-svn: 347531
Argyrios Kyrtzidis [Mon, 26 Nov 2018 00:03:39 +0000 (00:03 +0000)]
[Support/FileSystem] Add sub-second precision for atime/mtime of sys::fs::file_status on unix platforms
Summary:
getLastAccessedTime() and getLastModificationTime() provided times in nanoseconds but with only 1 second resolution, even when the underlying file system could provide more precise times than that.
These changes add sub-second precision for unix platforms that support improved precision.
Also add some comments to make sure people are aware that the resolution of times can vary across different file systems.
Reviewers: labath, zturner, aaron.ballman, kristina
Reviewed By: aaron.ballman, kristina
Subscribers: lebedev.ri, mgorny, kristina, llvm-commits
Differential Revision: https://reviews.llvm.org/D54826
llvm-svn: 347530
Fangrui Song [Sun, 25 Nov 2018 20:57:05 +0000 (20:57 +0000)]
[CodeComplete] Simplify CodeCompleteConsumer.cpp, NFC
Use range-based for loops
Use XStr.compare(YStr) < 0
Format misaligned code
llvm-svn: 347529
Florian Hahn [Sun, 25 Nov 2018 19:38:02 +0000 (19:38 +0000)]
[MetadataTest] Fix off-by-one strncpy warning reported by gcc8. (NFC)
llvm-svn: 347528
Sanjay Patel [Sun, 25 Nov 2018 17:53:16 +0000 (17:53 +0000)]
[CodeGen] translate MS rotate builtins to LLVM funnel-shift intrinsics
This was originally part of:
D50924
and should resolve PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387
...but it was reverted because some bots using a gcc host compiler
would crash for unknown reasons with this included in the patch.
Trying again now to see if that's still a problem.
llvm-svn: 347527
Sanjay Patel [Sun, 25 Nov 2018 17:27:02 +0000 (17:27 +0000)]
[x86] limit transform for select-of-fp-constants
This should likely be adjusted to limit this transform
further, but these diffs should be clear wins.
If we have blendv/conditional move, then we should assume
those are cheap ops. The loads become independent of the
compare, so those can be speculated before we need to use
the values in the blend/mov.
llvm-svn: 347526
Sanjay Patel [Sun, 25 Nov 2018 16:54:43 +0000 (16:54 +0000)]
[x86] add tests for select-of-fp-constants; NFC
There are many options here depending on subtarget,
but we are uniformly relying on a transform that was
driven by performance for a 32-bit SSE2 target in 2009.
Note: The same motivation was apparently used to do this
transform for *all* targets, so non-x86 may want to look
at this too.
llvm-svn: 347525
Florian Hahn [Sun, 25 Nov 2018 16:32:02 +0000 (16:32 +0000)]
[IPSCCP] Use input operand instead of OriginalOp for ssa_copy.
OriginalOp of a Predicate refers to the original IR value,
before renaming. While solving in IPSCCP, we have to use
the operand of the ssa_copy instead, to avoid missing
updates for nested conditions on the same IR value.
Fixes PR39772.
llvm-svn: 347524
Sanjay Patel [Sun, 25 Nov 2018 16:09:32 +0000 (16:09 +0000)]
[SelectionDAG] move constant or splat functions to common location
rL347502 moved the null sibling, so we should group all of these
together. I'm not sure why these aren't methods of the SDValue
class itself, but that's another patch if that's possible.
llvm-svn: 347523
Andrea Di Biagio [Sun, 25 Nov 2018 12:46:24 +0000 (12:46 +0000)]
[llvm-mca] Add support for instructions with a variadic number of operands.
By default, llvm-mca conservatively assumes that a register operand from the
variadic sequence is both a register read and a register write. That is because
MCInstrDesc doesn't describe extra variadic operands; we don't have enough
dataflow information to tell which register operands from the variadic sequence
is a definition, and which is a use instead.
However, if a variadic instruction is flagged 'mayStore' (but not 'mayLoad'),
and it has no 'unmodeledSideEffects', then llvm-mca (very) optimistically
assumes that any register operand in the variadic sequence is a register read
only. Conversely, if a variadic instruction is marked as 'mayLoad' (but not
'mayStore'), and it has no 'unmodeledSideEffects', then llvm-mca optimistically
assumes that any extra register operand is a register definition only.
These assumptions work quite well for variadic load/store multiple instructions
defined by the ARM backend.
llvm-svn: 347522
Kang Zhang [Sun, 25 Nov 2018 02:56:49 +0000 (02:56 +0000)]
add Kang Zhang(shkzhang@cn.ibm.com) to the CREDITS.TXT
llvm-svn: 347521
Alexander Kornienko [Sun, 25 Nov 2018 02:41:01 +0000 (02:41 +0000)]
A bit of AST matcher cleanup, NFC.
Removed the uses of the allOf() matcher inside node matchers that are implicit
allOf(). Replaced uses of allOf() with the explicit node matcher where it makes
matchers more readable. Replace anyOf(hasName(), hasName(), ...) with the more
efficient and readable hasAnyName().
llvm-svn: 347520
Benjamin Kramer [Sat, 24 Nov 2018 20:57:03 +0000 (20:57 +0000)]
[X86][compiler-rt] Add missing semicolon
llvm-svn: 347519
Craig Topper [Sat, 24 Nov 2018 20:26:11 +0000 (20:26 +0000)]
[X86] Synchronize a macro in getAvailableFeatures in Host.cpp with the same macro in compiler-rt to fix a negative shift amount warning.
llvm-svn: 347518
Craig Topper [Sat, 24 Nov 2018 20:25:45 +0000 (20:25 +0000)]
[X86] Make conversion of feature bits into a mask explicitly unsigned by using 1U instead of 1.
llvm-svn: 347517
Craig Topper [Sat, 24 Nov 2018 20:14:03 +0000 (20:14 +0000)]
[X86][compiler-rt] Attempt to fix a warning about a shift amount being negative in a macro expansion.
llvm-svn: 347516
Nikita Popov [Sat, 24 Nov 2018 19:00:45 +0000 (19:00 +0000)]
[InstCombine] Determine demanded and known bits for funnel shifts
Support funnel shifts in InstCombine demanded bits simplification.
If the shift amount is constant, we can determine both the demanded
bits of the operands, as well as the known bits of the result.
If one of the operands has no demanded bits, it will be replaced
by undef and the funnel shift will be simplified into a simple shift
due to the simplifications added in D54778.
Differential Revision: https://reviews.llvm.org/D54869
llvm-svn: 347515
Andrea Di Biagio [Sat, 24 Nov 2018 18:40:45 +0000 (18:40 +0000)]
[llvm-mca] InstrBuilder: warnings for call/ret instructions are only reported once.
llvm-svn: 347514
Kristof Umann [Sat, 24 Nov 2018 12:24:27 +0000 (12:24 +0000)]
[analyzer] INT50-CPP. Do not cast to an out-of-range enumeration checker
This checker implements a solution to the "INT50-CPP. Do not cast to an
out-of-range enumeration value" rule [1].
It lands in alpha for now, and a number of followup patches are planned in order
to enable it by default.
[1] https://www.securecoding.cert.org/confluence/display/cplusplus/INT50-CPP.+Do+not+cast+to+an+out-of-range+enumeration+value
Patch by: Endre Fülöp and Alexander Zaitsev!
Differential Revision: https://reviews.llvm.org/D33672
llvm-svn: 347513
Bill Wendling [Sat, 24 Nov 2018 10:45:55 +0000 (10:45 +0000)]
isEvaluatable() implies a constant context.
Assume that we're in a constant context if we're asking if the expression can
be compiled into a constant initializer. This fixes the issue where a
__builtin_constant_p() in a compound literal was diagnosed as not being
constant, even though it's always possible to convert the builtin into a
constant.
llvm-svn: 347512
Joel Jones [Sat, 24 Nov 2018 07:26:55 +0000 (07:26 +0000)]
Revert unapproved commit
llvm-svn: 347511
Joel Jones [Sat, 24 Nov 2018 06:41:39 +0000 (06:41 +0000)]
[AArch64] Enable libm vectorized functions via SLEEF
This changeset is modeled after Intel's submission for SVML. It enables
trigonometry functions vectorization via SLEEF: http://sleef.org/.
* A new vectorization library enum is added to TargetLibraryInfo.h: SLEEF.
* A new option is added to TargetLibraryInfoImpl - ClVectorLibrary: SLEEF.
* A comprehensive test case is included in this changeset.
* In a separate changeset (for clang), a new vectorization library argument is
added to -fveclib: -fveclib=SLEEF.
Trigonometry functions that are vectorized by sleef:
acos
asin
atan
atanh
cos
cosh
exp
exp2
exp10
lgamma
log10
log2
log
sin
sinh
sqrt
tan
tanh
tgamma
Patch by Stefan Teleman
Differential Revision: https://reviews.llvm.org/D53927
llvm-svn: 347510
Marc-Andre Laperle [Sat, 24 Nov 2018 02:53:17 +0000 (02:53 +0000)]
[clangd] Add 'Switch header/source' command in clangd-vscode
Summary:
Alt+o is used on Windows/Linux and Option+Cmd+o on macOS.
Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
Reviewers: hokein, ilya-biryukov, ioeric
Reviewed By: ioeric
Subscribers: sammccall, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D54781
llvm-svn: 347509
Fangrui Song [Sat, 24 Nov 2018 00:41:13 +0000 (00:41 +0000)]
[CodeComplete] Delete unused variable in rC342449
llvm-svn: 347508
Fangrui Song [Sat, 24 Nov 2018 00:14:31 +0000 (00:14 +0000)]
[CodeComplete] Format SemaCodeComplete.cpp and improve code consistency
There are some mis-indented places and missing spaces here and there. Just format the whole file.
Also, newer code (from 2014 onwards) in this file prefers const auto *X = dyn_cast to not repeat the Decl type name. Make other occurrences consistent.
Remove two anonymous namespaces that are not very necessary: 1) a typedef 2) a local function (should use static)
llvm-svn: 347507
Fangrui Song [Fri, 23 Nov 2018 23:43:46 +0000 (23:43 +0000)]
[ARM] Add dependency from ARMAsmParser to ARMAsmPrinter after r347494
This fixes -DBUILD_SHARED_LIBS=on
llvm-svn: 347506
Nikita Popov [Fri, 23 Nov 2018 22:45:08 +0000 (22:45 +0000)]
[InstCombine] Simplify funnel shift with zero/undef operand to shift
The following simplifications are implemented:
* `fshl(X, 0, C) -> shl X, C%BW`
* `fshl(X, undef, C) -> shl X, C%BW` (assuming undef = 0)
* `fshl(0, X, C) -> lshr X, BW-C%BW`
* `fshl(undef, X, C) -> lshr X, BW-C%BW` (assuming undef = 0)
* `fshr(X, 0, C) -> shl X, (BW-C%BW)`
* `fshr(X, undef, C) -> shl X, BW-C%BW` (assuming undef = 0)
* `fshr(0, X, C) -> lshr X, C%BW`
* `fshr(undef, X, C) -> lshr, X, C%BW` (assuming undef = 0)
The simplification is only performed if the shift amount C is constant,
because we can explicitly compute C%BW and BW-C%BW in this case.
Differential Revision: https://reviews.llvm.org/D54778
llvm-svn: 347505
Evandro Menezes [Fri, 23 Nov 2018 21:17:33 +0000 (21:17 +0000)]
[TableGen] Emit more variant transitions
`llvm-mca` relies on the predicates to be based on `MCSchedPredicate` in order
to resolve the scheduling for variant instructions. Otherwise, it aborts
the building of the instruction model early.
However, the scheduling model emitter in `TableGen` gives up too soon, unless
all processors use only such predicates.
In order to allow more processors to be used with `llvm-mca`, this patch
emits scheduling transitions if any processor uses these predicates. The
transition emitted for the processors using legacy predicates is the one
specified with `NoSchedPred`, which is based on `MCSchedPredicate`.
Preferably, `llvm-mca` should instead assume a reasonable default when a
variant transition is not based on `MCSchedPredicate` for a given processor.
This issue should be revisited in the future.
Differential revision: https://reviews.llvm.org/D54648
llvm-svn: 347504
Andrea Di Biagio [Fri, 23 Nov 2018 20:26:57 +0000 (20:26 +0000)]
[llvm-mca] Refactor some of the logic in InstrBuilder, and add a verifyOperands method.
With this change, InstrBuilder emits an error if the MCInst sequence contains an
instruction with a variadic opcode, and a non-zero number of variadic operands.
Currently we don't know how to correctly analyze variadic opcodes. The problem
with variadic operands is that there is no information for them in the opcode
descriptor (i.e. MCInstrDesc). That means, we don't know which variadic operands
are defs, and which are uses.
In future, we could try to conservatively assume that any extra register
operands is both a register use and a register definition.
This patch fixes a subtle bug in the evaluation of read/write operands for ARM
VLD1 with implicit index update. Added test vld1-index-update.s
llvm-svn: 347503
Sanjay Patel [Fri, 23 Nov 2018 20:05:12 +0000 (20:05 +0000)]
[DAG] consolidate shift simplifications
...and use them to avoid creating obviously undef values as
discussed in the post-commit thread for r347478.
The diffs in vector div/rem show that we were missing real
optimizations by creating bogus shift nodes.
llvm-svn: 347502
Sanjay Patel [Fri, 23 Nov 2018 19:45:29 +0000 (19:45 +0000)]
[x86] make test immune to oversized shift simplification
I'm not sure if this actually preserves the original intent
of this test, but if we leave it as-is, the -1 (oversized)
shift should be folded to undef and allow deleting half
of the output.
llvm-svn: 347501
Luke Cheeseman [Fri, 23 Nov 2018 17:13:47 +0000 (17:13 +0000)]
Revert r347491 as it's llvm counterpart breaks buildbots
llvm-svn: 347500
Luke Cheeseman [Fri, 23 Nov 2018 17:13:06 +0000 (17:13 +0000)]
Revert r347490 as it breaks address sanitizer builds
llvm-svn: 347499
Ilya Biryukov [Fri, 23 Nov 2018 15:21:19 +0000 (15:21 +0000)]
[clangd] Add support for hierarchical documentSymbol
Reviewers: ioeric, sammccall, simark
Reviewed By: sammccall
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D52311
llvm-svn: 347498
George Rimar [Fri, 23 Nov 2018 15:13:26 +0000 (15:13 +0000)]
[LLD][ELF] - Simplify. NFCI.
This makes getRISCVPCRelHi20 to be static local helper,
and rotates the 'if' condition.
llvm-svn: 347497
Benjamin Kramer [Fri, 23 Nov 2018 15:02:33 +0000 (15:02 +0000)]
Remove the optional dependency from libclang to clang-tidy/include-fixer
clangd does a better job on both of these, so don't slow down everyone's build
for a poorly working libclang feature.
llvm-svn: 347496
Alexander Kornienko [Fri, 23 Nov 2018 14:30:14 +0000 (14:30 +0000)]
[clang-tidy] Ignore matches in template instantiations (cert-dcl21-cpp)
The test fails with a local modification to
clang-tidy/ClangTidyDiagnosticConsumer.cpp to include fixes into the key when
deduplicating the warnings.
llvm-svn: 347495
Oliver Stannard [Fri, 23 Nov 2018 14:27:21 +0000 (14:27 +0000)]
[ARM][AsmParser] Improve debug printing of parsed asm operands
In ARMOperand::print:
- Print human-readable register names, instead of numbers.
- Print the correct names for IT condition masks (these were in the wrong order
before).
- Print all parts of memory operands, not just the base register.
This makes the output of llvm-mc -show-inst-operands more readable.
Differential revision: https://reviews.llvm.org/D54850
llvm-svn: 347494
Andrea Di Biagio [Fri, 23 Nov 2018 12:12:57 +0000 (12:12 +0000)]
[llvm-mca][View] Improved Retire Control Unit Statistics.
RetireControlUnitStatistics now reports extra information about the ROB and the
avg/maximum number of entries consumed over the entire simulation.
Example:
Retire Control Unit - number of cycles where we saw N instructions retired:
[# retired], [# cycles]
0, 109 (17.9%)
1, 102 (16.7%)
2, 399 (65.4%)
Total ROB Entries: 64
Max Used ROB Entries: 35 ( 54.7% )
Average Used ROB Entries per cy: 32 ( 50.0% )
Documentation in llvm/docs/CommandGuide/llvmn-mca.rst has been updated to
reflect this change.
llvm-svn: 347493
Eugene Leviant [Fri, 23 Nov 2018 11:28:58 +0000 (11:28 +0000)]
Attempt to fix buildbot after r347489
llvm-svn: 347492
Luke Cheeseman [Fri, 23 Nov 2018 11:03:00 +0000 (11:03 +0000)]
Revert r343342 together with LLVM commit 347490.
llvm-svn: 347491
Luke Cheeseman [Fri, 23 Nov 2018 11:01:47 +0000 (11:01 +0000)]
Revert r343341
- Cannot reproduce the build failure locally and the build logs have
been deleted.
llvm-svn: 347490