Commit Graph

265027 Commits

Author SHA1 Message Date
Francois Ferrand d3f0e3dee0 clang-format: introduce InlineOnly short function style
Summary:
This is the same as Inline, except it does not imply all empty
functions are merged: with this style, empty functions are merged only
if they also match the 'inline' criteria (i.e. defined in a class).

This is helpful to avoid inlining functions in implementations files.

Reviewers: djasper, krasimir

Reviewed By: djasper

Subscribers: klimek, rengolin, cfe-commits

Differential Revision: https://reviews.llvm.org/D34399

llvm-svn: 305912
2017-06-21 13:56:02 +00:00
Alex Lorenz d283dd4e06 [index] Nested class declarations should be annotated with the
"specializationOf" relation if they pseudo-override a type in the base template

This commit fixes an issue where Xcode's renaming engine couldn't find the
reference to the second occurrence of "InnerClass" in this example:

template<typename T> struct Ts { template<typename U> struct InnerClass { }; };

template<> struct Ts<int> {
template<typename U> struct InnerClass; // This occurrence wasn't renamed
};

rdar://31884960

Differential Revision: https://reviews.llvm.org/D34392

llvm-svn: 305911
2017-06-21 13:51:04 +00:00
Simon Pilgrim 5309b7d5c9 [X86][SSE] Regenerate merge store tests
llvm-svn: 305910
2017-06-21 13:46:42 +00:00
Simon Pilgrim e74e08fe61 [X86][SSE] Dropped -mcpu from vector blend shuffle tests and regenerate
Use triple and attribute only for consistency 

llvm-svn: 305909
2017-06-21 13:45:33 +00:00
Simon Pilgrim 98aab7c6fc [X86][SSE] Dropped -mcpu from vector shuffle tests
Use triple and attribute only for consistency 

llvm-svn: 305908
2017-06-21 13:26:52 +00:00
Simon Pilgrim 6d5d6b542b [X86][SSE] Dropped -mcpu from vector zero extend tests
Use triple and attribute only for consistency 

llvm-svn: 305907
2017-06-21 13:17:14 +00:00
Simon Pilgrim c388ec32e0 [X86][SSE] Dropped -mcpu from variable shuffle tests
Use triple and attribute only for consistency 

llvm-svn: 305906
2017-06-21 13:15:41 +00:00
Simon Pilgrim 73814a2594 [X86][AVX] Add AVX1 shuffle truncation tests
llvm-svn: 305905
2017-06-21 12:58:56 +00:00
Simon Pilgrim db6c3fa872 [X86][SSE] Add SSE2/SSE42 shuffle truncation tests
llvm-svn: 305904
2017-06-21 12:58:19 +00:00
Serge Pavlov 25dbe1a16e Function with unparsed body is a definition
While a function body is being parsed, the function declaration is not considered
as a definition because it does not have a body yet. In some cases it leads to
incorrect interpretation, the case is presented in
https://bugs.llvm.org/show_bug.cgi?id=14785:
```
    template<typename T> struct Somewhat {
      void internal() const {}
      friend void operator+(int const &, Somewhat<T> const &) {}
    };
void operator+(int const &, Somewhat<char> const &x) { x.internal(); }
```
When statement `x.internal()` in the body of global `operator+` is parsed, the type
of `x` must be completed, so the instantiation of `Somewhat<char>` is started. It
instantiates the declaration of `operator+` defined inline, and makes a check for
redefinition. The check does not detect another definition because the declaration
of `operator+` is still not defining as does not have a body yet.

To solves this problem the function `isThisDeclarationADefinition` considers
a function declaration as a definition if it has flag `WillHaveBody` set.

This change fixes PR14785.

Differential Revision: https://reviews.llvm.org/D30375

This is a recommit of 305379, reverted in 305381, with small changes.

llvm-svn: 305903
2017-06-21 12:46:57 +00:00
Ilya Biryukov f81d46f45e Fixed compiler warnings after r305890.
Should fix buildbots that pass -Werror.

llvm-svn: 305902
2017-06-21 12:34:27 +00:00
Krasimir Georgiev b03877ab83 [clang-format] Support sorting using declarations
Summary:
This patch adds UsingDeclarationsSorter, a TokenAnalyzer that sorts consecutive
using declarations.

Reviewers: klimek

Reviewed By: klimek

Subscribers: Typz, djasper, cfe-commits, klimek, mgorny

Differential Revision: https://reviews.llvm.org/D33823

llvm-svn: 305901
2017-06-21 12:03:12 +00:00
Artem Dergachev 4a084cfde7 [analyzer] Bump a few default performance thresholds.
This makes the analyzer around 10% slower by default,
allowing it to find deeper bugs.

Default values for the following -analyzer-config change:
max-nodes: 150000 -> 225000;
max-inlinable-size: 50 -> 100.

rdar://problem/32539666
Differential Revision: https://reviews.llvm.org/D34277

llvm-svn: 305900
2017-06-21 11:29:35 +00:00
Simon Dardis f62399945c [mips][compiler-rt] Fix build breakage.
Change some reinterpret_casts to c-style casts due to template instantiation
restrictions and build breakage due to missing paranthesises.

llvm-svn: 305899
2017-06-21 11:29:15 +00:00
Haojian Wu 53dd644c5d Fix unused-variable compilation error.
llvm-svn: 305898
2017-06-21 11:26:58 +00:00
Zvi Rackover 845ca8fba9 [X86] Rerun the update_llc_test_checks tool on test. NFC.
llvm-svn: 305897
2017-06-21 11:21:43 +00:00
Artem Dergachev 928d72fa36 [analyzer] LocalizationChecker: Support new localizable APIs.
Add support for new methods that were added in macOS High Sierra & iOS 11
and require a localized string.

Patch by Kulpreet Chilana!

rdar://problem/32795210
Differential Revision: https://reviews.llvm.org/D34266

llvm-svn: 305896
2017-06-21 11:12:07 +00:00
Pavel Labath 2c1e8b7a7e Fix build after r305892
Make sure to #include <cerrno> in Support/Errno.h

llvm-svn: 305895
2017-06-21 11:10:02 +00:00
Christof Douma c1c28051d2 [AARCH64][LSE] Preliminary support for ARMv8.1 LSE Atomics.
Implemented support to AArch64 codegen for ARMv8.1 Large System
Extensions atomic instructions. Where supported, these instructions can
provide atomic operations with higher performance.

Currently supported operations include: fetch_add, fetch_or, fetch_xor,
fetch_smin, fetch_min/max (signed and unsigned), swap, and
compare_exchange.

This implementation implies sequential-consistency ordering, more
relaxed ordering is under development.

Subtarget->hasLSE is currently supported for Cavium ThunderX2T99.

Patch by Ananth Jasty.

Differential Revision: https://reviews.llvm.org/D33586

Change-Id: I82f6d3d64255622791ceb0715b7ab9f4dc4d4b2c
llvm-svn: 305893
2017-06-21 10:58:31 +00:00
Pavel Labath 1f6aea2eb3 [Support] Add RetryAfterSignal helper function
Summary:
This function retries an operation if it was interrupted by a signal
(failed with EINTR). It's inspired by the TEMP_FAILURE_RETRY macro in
glibc, but I've turned that into a template function. I've also added a
fail-value argument, to enable the function to be used with e.g.
fopen(3), which is documented to fail for any reason that open(2) can
fail (which includes EINTR).

The main user of this function will be lldb, but there were also a
couple of uses within llvm that I could simplify using this function.

Reviewers: zturner, silvas, joerg

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D33895

llvm-svn: 305892
2017-06-21 10:55:34 +00:00
Alex Lorenz 71d72135b0 Revert r305678: [driver][macOS] Pick the system version for the
deployment target if the SDK is newer than the system

This commit also reverts follow-up commits r305680 and r305685 that have
buildbot fixes.

The change in r305678 wasn't correct because it relied on
`llvm::sys::getProcessTriple`, which uses a pre-configured OS version. We should
lookup the actual macOS version of the system on which the compiler is running.

llvm-svn: 305891
2017-06-21 10:27:24 +00:00
Ilya Biryukov 200b328972 Moved code hanlding precompiled preamble out of the ASTUnit.
Reviewers: bkramer, krasimir, arphaman, akyrtzi, klimek

Reviewed By: klimek

Subscribers: mgorny, klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D34287

llvm-svn: 305890
2017-06-21 10:24:58 +00:00
Florian Hahn 8552e591a1 [AArch64] Add early exit to promoteLoadFromStore.
There should be at most a single kill flag for the
promoted operand between the store/load pair.
Discussed in https://reviews.llvm.org/D34402.

llvm-svn: 305889
2017-06-21 09:51:52 +00:00
Strahinja Petrovic d280ea4f76 [MIPS] Fix for selecting of DINS/INS instruction
This patch adds one more condition in selection DINS/INS
instruction, which fixes MultiSource/Applications/JM/ldecod/
for mips32r2 (and mips64r2 n32 abi).

Differential Revision: https://reviews.llvm.org/D33725

llvm-svn: 305888
2017-06-21 09:25:51 +00:00
Javed Absar e3a0cc2ca0 Use range-loop in machine-scheduler. NFCI.
Converts to range-loop usage in machine scheduler.
This makes the code neater and easier to read,
and also keeps pace of the machine scheduler
implementation with C++11 features.

Reviewed by: Matthias Braun
Differential Revision: https://reviews.llvm.org/D34320

llvm-svn: 305887
2017-06-21 09:10:10 +00:00
Sam Kolton 549c89d2c9 [AMDGPU] SDWA: merge VI and GFX9 pseudo instructions
Summary: Previously there were two separate pseudo instruction for SDWA on VI and on GFX9. Created one pseudo instruction that is union of both of them. Added verifier to check that operands conform either VI or GFX9.

Reviewers: dp, arsenm, vpykhtin

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, artem.tamazov

Differential Revision: https://reviews.llvm.org/D34026

llvm-svn: 305886
2017-06-21 08:53:38 +00:00
Florian Hahn 80e485179e [AArch64] Preserve register flags when promoting a load from store.
Summary:
This patch updates promoteLoadFromStore to use the store MachineOperand as the
source operand of the of the new instruction instead of creating a new
register MachineOperand. This way, the existing register flags are
preserved. 

This fixes PR33468 (https://bugs.llvm.org/show_bug.cgi?id=33468). 


Reviewers: MatzeB, t.p.northover, junbuml

Reviewed By: MatzeB

Subscribers: aemerson, rengolin, javed.absar, kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D34402

llvm-svn: 305885
2017-06-21 08:47:23 +00:00
Guy Blank 52d73fce85 [DAGCombiner] Add another combine from build vector to shuffle
Add support for combining a build vector to a shuffle.
When the build vector is of extracted elements from 2 vectors (vec1, vec2) where vec2 is 2 times smaller than vec1.

llvm-svn: 305883
2017-06-21 07:38:41 +00:00
Max Kazantsev eac01d4c62 [SCEV] Make MulOpsInlineThreshold lower to avoid excessive compilation time
MulOpsInlineThreshold option of SCEV is defaulted to 1000, which is inadequately high.
When constructing SCEVs of expressions like:

  x1 = a * a
  x2 = x1 * x1
  x3 = x2 * x2
    ...

We actually have huge SCEVs with max allowed amount of operands inlined.
Such expressions are easy to get from unrolling of loops looking like

  x = a
  for (i = 0; i < n; i++)
    x = x * x

Or more tricky cases where big powers are involved. If some non-linear analysis
tries to work with a SCEV that has 1000 operands, it may lead to excessively long
compilation. The attached test does not pass within 1 minute with default threshold.

This patch decreases its default value to 32, which looks much more reasonable if we
use analyzes with complexity O(N^2) or O(N^3) working with SCEV.

Differential Revision: https://reviews.llvm.org/D34397

llvm-svn: 305882
2017-06-21 07:28:13 +00:00
Rafael Espindola 2c8e3ed00f Simplify test.
llvm-svn: 305881
2017-06-21 06:42:56 +00:00
Dean Michael Berris 28ecff5cf1 [XRay] Reduce synthetic references emitted by XRay
Summary:
When we're building with XRay instrumentation, we use a trick that
preserves references from the function to a function sled index. This
index table lives in a separate section, and without this trick the
linker is free to garbage-collect this section and all the segments it
refers to. Until we're able to tell the linkers to preserve these
sections, we use this reference trick to keep around both the index and
the entries in the instrumentation map.

Before this change we emitted both a synthetic reference to the label in
the instrumentation map, and to the entry in the function map index.
This change removes the first synthetic reference and only emits one
synthetic reference to the index -- the index entry has the references
to the labels in the instrumentation map, so the linker will still
preserve those if the function itself is preserved.

This reduces the amount of synthetic references we emit from 16 bytes to
just 8 bytes in x86_64, and similarly to other platforms.

Reviewers: dblaikie

Subscribers: javed.absar, kpw, pelikan, llvm-commits

Differential Revision: https://reviews.llvm.org/D34340

llvm-svn: 305880
2017-06-21 06:39:42 +00:00
Serguei Katkov 0b0dc57dd8 [ImplicitNullChecks] Uphold an invariant in areMemoryOpsAliased
Right now areMemoryOpsAliased has an assertion justified as:

MMO1 should have a value due it comes from operation we'd like to use
as implicit null check.
assert(MMO1->getValue() && "MMO1 should have a Value!");
However, it is possible for that invariant to not be upheld in the
following situation (conceptually):

Null check %RAX
NotNullSucc:

%RAX = LEA %RSP, 16            // I0
%RDX = MOV64rm %RAX            // I1
With the current code, we will have an early exit from
ImplicitNullChecks::isSuitableMemoryOp on I0 with SR_Unsuitable.
However, I1 will look plausible (since it loads from %RAX) and
will go ahead and call areMemoryOpsAliased(I1, I0). This will cause
us to fail the assert mentioned above since I1 does not load from an
IR level value and thus is allowed to have a non-Value base address.

The fix is to bail out earlier whenever we see an unsuitable
instruction overwrite PointerReg. This would guarantee that when we
call areMemoryOpsAliased, we're guaranteed to be looking at an
instruction that loads from or stores to an IR level value.

Original Patch Author: sanjoy
Reviewers: sanjoy, mkazantsev, reames
Reviewed By: sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34385

llvm-svn: 305879
2017-06-21 06:38:23 +00:00
Raphael Isemann 676b457b8b Changed wording in comment
llvm-svn: 305878
2017-06-21 05:41:39 +00:00
Rui Ueyama d2ccdbfa61 Remove redundant namespace specifier.
llvm-svn: 305877
2017-06-21 03:05:08 +00:00
Rui Ueyama 2f740f74bb Define __guard_{iat,longjmp}_{count,table} symbols.
VC2017 contains these new symbols as undefined symobls. They are used
for /guard:cf. Since we do not support the control flow guard, but we
want to at least ignore these symbols so that we can link against VS2017
libraries.

Fixes https://bugs.chromium.org/p/chromium/issues/detail?id=727193.

llvm-svn: 305876
2017-06-21 02:26:19 +00:00
Bruno Cardoso Lopes afa47c91ce Support MS builtins using 'long' on LP64 platforms
This allows for -fms-extensions to work the same on LP64. For example,
_BitScanReverse is expected to be 32-bit, matching Windows/LLP64, even
though long is 64-bit on x86_64 Darwin or Linux (LP64).

Implement this by adding a new character code 'N', which is 'int' if
the target is LP64 and the same 'L' otherwise

Differential Revision: https://reviews.llvm.org/D34377

rdar://problem/32599746

llvm-svn: 305875
2017-06-21 02:20:46 +00:00
Bruno Cardoso Lopes 37423941dc Run dos2unix on ms-intrinsics-rotations.c test. NFC
llvm-svn: 305874
2017-06-21 02:20:40 +00:00
Zachary Turner 10a601adb2 Fix a python object leak in SWIG glue.
PyObject_CallFunction returns a PyObject which needs to be
decref'ed when it is no longer needed.

Patch by David Luyer
Differential Revision: https://reviews.llvm.org/D33740

llvm-svn: 305873
2017-06-21 01:52:37 +00:00
Richard Trieu ca48d369ba [ODRHash] Supply more information when generic error message is emitted.
llvm-svn: 305872
2017-06-21 01:43:13 +00:00
Vitaly Buka ff7b8ea2a0 Revert "[compiler-rt] Don't reset non-default user handler if allow_user_segv_handler is true."
Summary:
On Android we still need to reset preinstalled handlers and allow use handlers later.

This reverts commit r304039.

Reviewers: eugenis

Subscribers: kubamracek, dberris, llvm-commits

Differential Revision: https://reviews.llvm.org/D34434

llvm-svn: 305871
2017-06-21 01:10:23 +00:00
Evgeniy Stepanov 827cd74618 [asan] Fix android compiler wrapper lost in r301617.
llvm-svn: 305870
2017-06-21 00:56:31 +00:00
Rui Ueyama f076b97a80 Improve error messages.
llvm-svn: 305868
2017-06-20 23:11:28 +00:00
Davide Italiano 0ec715be1f [NewGVN] Fix a bug that made the store verifier less effective.
We weren't actually checking for duplicated stores, as the condition
was always actually false. This was found by Coverity, and I have
no clue how to trigger this in real-world code (although I
 tried for a bit).

llvm-svn: 305867
2017-06-20 22:57:40 +00:00
Kevin Enderby 1ce3858488 Updated llvm-objdump with Mach-O files and the -objc-meta-data option so
that it symbolically prints the superclass when it has dyld bind info for it.

rdar://7638823

llvm-svn: 305866
2017-06-20 22:55:11 +00:00
Rafael Espindola 3ac4c09daf clang-format a region.
It will make a followup patch easier to read.

llvm-svn: 305865
2017-06-20 22:53:29 +00:00
Eli Friedman 5e589ea4b1 [ScopInfo] Fix crash with sum of invariant load and AddRec.
r303971 added an assertion that SCEV addition involving an AddRec
and a SCEVUnknown must involve a dominance relation: either the
SCEVUnknown value dominates the AddRec's loop, or the AddRec's
loop header dominates the SCEVUnknown. This is generally fine
for most usage of SCEV because it isn't possible to write an
expression in IR which would violate it, but it's a bit inconvenient
here for polly.

To solve the issue, just avoid creating a SCEV expression which
triggers the asssertion.

I'm not really happy with this solution, but I don't have any better
ideas.

Fixes https://bugs.llvm.org/show_bug.cgi?id=33464.

Differential Revision: https://reviews.llvm.org/D34259

llvm-svn: 305864
2017-06-20 22:53:02 +00:00
Lang Hames cd22753689 Add a cantFail overload for Expected-reference (Expected<T&>) types.
llvm-svn: 305863
2017-06-20 22:18:02 +00:00
Sunil Srivastava 15ed292906 Prevent devirtualization of calls to un-instantiated functions.
PR 27895

Differential Revision: https://reviews.llvm.org/D22057

llvm-svn: 305862
2017-06-20 22:08:44 +00:00
Lang Hames 0d93185b2c Special-case handling of destructors in override lists when dumping ASTs.
Fixes a bug in r305850: CXXDestructors don't have names, so we need to handle
printing of them separately.

llvm-svn: 305860
2017-06-20 21:30:43 +00:00
Alex Shlyapnikov ccab11b0e8 [Sanitizers] Move cached allocator_may_return_null flag to sanitizer_allocator
Summary:
Move cached allocator_may_return_null flag to sanitizer_allocator.cc and
provide API to consolidate and unify the behavior of all specific allocators.

Make all sanitizers using CombinedAllocator to follow
AllocatorReturnNullOrDieOnOOM() rules to behave the same way when OOM
happens.

When OOM happens, turn allocator_out_of_memory flag on regardless of
allocator_may_return_null flag value (it used to not to be set when
allocator_may_return_null == true).

release_to_os_interval_ms and rss_limit_exceeded will likely be moved to
sanitizer_allocator.cc too (later).

Reviewers: eugenis

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D34310

llvm-svn: 305858
2017-06-20 21:23:02 +00:00