Commit Graph

259504 Commits

Author SHA1 Message Date
Jason Molenda 9b7fcdcb57 Use two LC_NOTE load commands for identifying the main binary that
lldb should use when given a corefile.

This uses an LC_NOTE "main bin spec" or an LC_NOTE "kern ver str"
if they are present in a Mach-O core file.

Core files may have multiple different binaries -- different kernels,
or a mix of user process and kernel binaries -- and it can be
difficult for lldb to detect the correct one to use simply by looking
at the pages of memory.  These two new LC_NOTE load commands allow
for the correct binary to be recorded unambiguously.

<rdar://problem/20878266> 

llvm-svn: 300138
2017-04-12 23:33:30 +00:00
Zachary Turner 75999dff93 Fix initialization order of class members.
llvm-svn: 300137
2017-04-12 23:27:43 +00:00
Richard Smith ac65f642a5 Update to match LLVM r300135.
Remove "REQUIRES: long_tests" from test/Driver/response-file.c since it is now about 10x faster. (We can add that back if it's still too slow for some buildbot.)

llvm-svn: 300136
2017-04-12 23:21:25 +00:00
Richard Smith 4e1ec636e1 ArgList: cache index ranges containing arguments with each ID
Improve performance of argument list parsing with large numbers of IDs and
large numbers of arguments, by tracking a conservative range of indexes within
the argument list that might contain an argument with each ID. In the worst
case (when the first and last argument with a given ID are at the opposite ends
of the argument list), this still results in a linear-time walk of the list,
but it helps substantially in the common case where each ID occurs only once,
or a few times close together in the list.

This gives a ~10x speedup to clang's `test/Driver/response-file.c`, which
constructs a very large set of command line arguments and feeds them to the
clang driver.

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

llvm-svn: 300135
2017-04-12 23:19:51 +00:00
Zachary Turner 9e7dda3c6d [llvm-pdbdump] Minor prepatory refactor of Class Def Dumper.
In a followup patch I intend to introduce an additional dumping
mode which dumps a graphical representation of a class's layout.
In preparation for this, the text-based layout printer needs to
be split out from the graphical layout printer, and both need
to be able to use the same code for printing the intro and outro
of a class's definition (e.g. base class list, etc).

This patch does so, and in the process introduces a skeleton
definition for the graphical printer, while currently making
the graphical printer just print nothing.

NFC

llvm-svn: 300134
2017-04-12 23:18:51 +00:00
Zachary Turner c883a8c6dc [llvm-pdbdump] More advanced class definition dumping.
Previously the dumping of class definitions was very primitive,
and it made it hard to do more than the most trivial of output
formats when dumping.  As such, we would only dump one line for
each field, and then dump non-layout items like nested types
and enums.

With this patch, we do a complete analysis of the object
hierarchy including aggregate types, bases, virtual bases,
vftable analysis, etc.  The only immediately visible effects
of this are that a) we can now dump a line for the vfptr where
before we would treat that as padding, and b) we now don't
treat virtual bases that come at the end of a class as padding
since we have a more detailed analysis of the class's storage
usage.

In subsequent patches, we should be able to use this analysis
to display a complete graphical view of a class's layout including
recursing arbitrarily deep into an object's base class / aggregate
member hierarchy.

llvm-svn: 300133
2017-04-12 23:18:21 +00:00
Eric Fiselier 1b39514444 Fix test failures with older Clang versions
llvm-svn: 300132
2017-04-12 23:17:17 +00:00
Rui Ueyama 040af7deab Allow expressions in MEMORY command.
Previously, we allowed only integers in this context. Now you can
write expressions there. LLD is now able to handle the following
linker, for example.

  MEMORY { rom (rx) : ORIGIN = (1024 * 1024) }

llvm-svn: 300131
2017-04-12 23:16:52 +00:00
Rui Ueyama e9c9edf67b Make intentional typos look more obvious.
We do not check for similarities when handling unknown tokens in
linker scripts, so "ORIGI" and "LENTH" are not good tokens as a test
for unknown tokens, as I was tempted to "fix" them.

llvm-svn: 300130
2017-04-12 23:16:33 +00:00
Rui Ueyama 732baa4d03 Remove redundant spaces.
llvm-svn: 300129
2017-04-12 23:16:13 +00:00
Rui Ueyama 53e0fd33d4 Remove useless 0x prefixes.
llvm-svn: 300128
2017-04-12 23:15:55 +00:00
Akira Hatanaka 48b1dee7b4 [libFuzzer] XFAIL fuzzer-oom.test on Darwin.
The test fails on Darwin because Fuzzer::DeathCallback (which calls
DumpCurrentUnit("crash-")) is called before DumpCurrentUnit("oom-") is
called in Fuzzer::RssLimitCallback. DeathCallback is transitively called
from __sanitizer_print_memory_profile.

This should fix the fuzzer bot that has been failing for a while:

http://lab.llvm.org:8080/green/job/libFuzzer/

llvm-svn: 300127
2017-04-12 23:15:10 +00:00
Eric Fiselier da04d79a1f [libc++] Implement LWG 2911 - add an is_aggregate type-trait
Summary:
This patch implements http://cplusplus.github.io/LWG/lwg-defects.html#2911.

I'm putting this up for review until __is_aggregate is added to clang (See D31513)

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 300126
2017-04-12 23:08:46 +00:00
Craig Topper 81c03a7784 [InstSimplify] Don't try to constant fold AllocaInsts since it won't do anything.
Should give a small compile time improvement.

llvm-svn: 300125
2017-04-12 22:54:24 +00:00
Marshall Clow e391d9653f Additional test file for r300123
llvm-svn: 300124
2017-04-12 22:51:56 +00:00
Marshall Clow 5c80f4f6a2 Implement part of LWG#2857 - any/optional. Still to do - variant. Reviewed as https://reviews.llvm.org/D31956
llvm-svn: 300123
2017-04-12 22:51:27 +00:00
Reid Kleckner a13ffe119a [clang-cl] Make all sanitizer flags available in clang-cl
Summary:
Use a tablegen let {} block so that new sanitizer flags are available by
default in all driver modes. This should cut down on time wasted with
bugs like http://crbug.com/710928.

Reviewers: vitalybuka, hans

Subscribers: kcc, llvm-commits

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

llvm-svn: 300122
2017-04-12 22:50:51 +00:00
Eric Fiselier 34e38caa2f Fix incorrectly qualified return type from unique_ptr::get_deleter().
For reference deleter types the const qualifier on the return type
of get_deleter() should be ignored, and a non-const deleter should
be returned.

This patch fixes a bug where "const deleter_type&" is incorrectly
formed.

llvm-svn: 300121
2017-04-12 22:43:49 +00:00
Rui Ueyama 58c18f8f23 Make a few tests shorter. NFC.
llvm-svn: 300120
2017-04-12 22:38:02 +00:00
Reid Kleckner 78144bc3ab [IR] Make AttributeSet constructor from AttributeSetNode* explicit
llvm-svn: 300119
2017-04-12 22:30:37 +00:00
Craig Topper 854824139e [ValueTracking] Teach GetUnderlyingObject to stop when it reachs an alloca instruction.
Previously it tried to call SimplifyInstruction which doesn't know anything about alloca so defers to constant folding which also doesn't do anything with alloca. This results in wasted cycles making calls that won't do anything. Given the frequency with which this function is called this time adds up.

llvm-svn: 300118
2017-04-12 22:29:23 +00:00
Reid Kleckner ec0fc037af [IR] Assert that we never create an empty AttributeListImpl, NFC
Delete following conditional that is always true as a result.

llvm-svn: 300117
2017-04-12 22:22:01 +00:00
Eric Fiselier 0736066b0b [Sema] Add __is_aggregate type-trait
Summary:
[LWG 2911](http://cplusplus.github.io/LWG/lwg-defects.html#2911) adds `std::is_aggregate` to the library, which requires a new builtin trait. This patch implements `__is_aggregate`.


Reviewers: rsmith, majnemer, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: STL_MSFT, cfe-commits

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

llvm-svn: 300116
2017-04-12 22:12:15 +00:00
Eric Fiselier 6eee3a3fca Fix clang-tidy shared link with libc++
Currently the ClangTidyMain.cpp fails to link against shared LLVM/Clang libraries
due to the missing symbol:

  clang::tooling::operator<(clang::tooling::Replacement const&,
                            clang::tooling::Replacement const&);

This patch fixes the issue by correctly linking clangToolingCore which contains
the definition.

llvm-svn: 300115
2017-04-12 22:07:47 +00:00
Alexander Shaposhnikov 5f24c12dc4 [analyzer] Add a check for IvarRegion in getExtraInvalidatedValues
This diff adds a defensive check in getExtraInvalidatedValues
for the case when there are no regions for the ivar associated with
a property. Corresponding test case added.

Test plan:
make check-clang
make check-clang-analysis

llvm-svn: 300114
2017-04-12 22:00:13 +00:00
Matt Arsenault 0d0d6c2f25 AMDGPU: Fix invalid copies when copying i1 to phys reg
Insert a VReg_1 virtual register so the i1 workaround pass
can handle it.

llvm-svn: 300113
2017-04-12 21:58:23 +00:00
Chris Bieneman a4f532e0ac [NFC] Adding a new wrapper for getaddrinfo
Summary: This patch adds a new wrapper for getaddrinfo which returns a std::vector of SocketAddresses. While this patch doesn't add any uses of the new function, I have two separable patches that are dependent on this, so I put it in its own patch.

Reviewers: zturner

Reviewed By: zturner

Subscribers: lldb-commits

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

llvm-svn: 300112
2017-04-12 21:56:33 +00:00
Chris Bieneman efd065e6a0 Support Unit Testing debugserver
Summary:
This patch refactors the CMake build system's support for building debugserver to allow us to build the majority of debugserver's sources into the debugserverCommon library which can then be reused by unit tests.

The first unit test I've written tests debug server's ability to accept incoming connections from LLDB. The test forks the process, and one side creates a listening socket using debugserver's socket API, the other side creates a transmitting socket using LLDB's TCPSocket class.

I have no clue where to even start getting this connected into the LLDB Xcode project, so for now these tests are CMake-only.

Reviewers: zturner, labath, jasonmolenda

Subscribers: lldb-commits, mgorny

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

llvm-svn: 300111
2017-04-12 21:56:29 +00:00
Vassil Vassilev 46afbbb210 [modules] Delay calling DeclMustBeEmitted until it's safe.
This patch implements the suggestion in D29753 that calling DeclMustBeEmitted in
the middle of deserialization should be avoided and that the actual check should
be deferred until it's safe to do so.

This patch fixes a crash when accessing the invalid redecl chains while trying
to evaluate the value of a const VarDecl that contains a function call.

Patch by Raphael Isemann (D30793)!

llvm-svn: 300110
2017-04-12 21:56:05 +00:00
Bruno Cardoso Lopes 52dfe71645 [Driver] Add compiler option to generate a reproducer
One way to currently test the reproducers is to setup
"FORCE_CLANG_DIAGNOSTICS_CRASH=1" before invoking clang. This simulates
a crash and produces the same contents needed by the reproducers.  The
reproducers are specially useful when triaging Modules issues, not only
on crashes, but also for reproducing misleading warnings, errors, etc.

Add a '-gen-reproducer' driver option to clang (or any similar name) and
give users a flag option.

Note that clang already has a -fno-crash-diagnostics, which disables the
crash reproducers. I've decided not to propose "-fcrash-diagnostics"
since it doesn't convey the ideia of reproduction despite a crash.

rdar://problem/24114619

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

llvm-svn: 300109
2017-04-12 21:46:20 +00:00
Bruno Cardoso Lopes c69f9f3530 [Modules] Enable local submodule visibility for ObjC/C
Remove the restriction where this is only valid with C++

rdar://problem/29055656

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

llvm-svn: 300108
2017-04-12 21:46:16 +00:00
Alex Shlyapnikov daa342d9c3 Cache size per class size in SizeClassAllocatorXLocalCache.
Summary:
Allocator::ClassIdToSize() is not free and calling it in every
Allocate/Deallocate has noticeable impact on perf.

Reviewers: eugenis, kcc

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 300107
2017-04-12 21:44:56 +00:00
David Blaikie e60aa5182f Modular Codegen: Include testing for inline asm as well as some commentary on the implementaiton choice.
llvm-svn: 300106
2017-04-12 21:14:04 +00:00
David Blaikie 061afdca40 Fix up test to handle the now split -fmodules-codegen and -fmodules-debuginfo flags
llvm-svn: 300105
2017-04-12 21:09:34 +00:00
David Blaikie f63556d8b4 Modular Codegen: Separate flags for function and debug info support
This allows using and testing these two features separately. (noteably,
debug info is, so far as I know, always a win (basically). But function
modular codegen is currently a loss for highly optimized code - where
most of the linkonce_odr definitions are optimized away, so providing
weak_odr definitions is only overhead)

llvm-svn: 300104
2017-04-12 20:58:33 +00:00
Alex Shlyapnikov 05bf27ac3f Avoid calling SizeClassMap::MaxCachedHint on hot path, it's not free.
Summary: Remove unecessary SizeClassMap::MaxCachedHint call.

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 300103
2017-04-12 20:51:42 +00:00
Stanislav Mekhanoshin c90347d760 [AMDGPU] Generate range metadata for workitem id
If workgroup size is known inform llvm about range returned by local
id  and local size queries.

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

llvm-svn: 300102
2017-04-12 20:48:56 +00:00
Piotr Padlewski 04aee46779 Remove readnone from invariant.group.barrier
Summary:
Readnone attribute would cause CSE of two barriers with
the same argument, which is invalid by example:

    struct Base {
          virtual int foo() { return 42; }
    };

    struct Derived1 : Base {
          int foo() override { return 50; }
    };

    struct Derived2 : Base {
          int foo() override { return 100; }
    };

    void foo() {
        Base *x = new Base{};
        new (x) Derived1{};
        int a = std::launder(x)->foo();
        new (x) Derived2{};
        int b = std::launder(x)->foo();
    }

Here 2 calls of std::launder will produce @llvm.invariant.group.barrier,
which would be merged into one call, causing devirtualization
to devirtualize second call into Derived1::foo() instead of
Derived2::foo()

Reviewers: chandlerc, dberlin, hfinkel

Subscribers: llvm-commits, rsmith, amharc

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

llvm-svn: 300101
2017-04-12 20:45:12 +00:00
Vassil Vassilev 7a3a6e26c6 Append -w when LLVM_ENABLE_WARNINGS is Off.
Reviewed by rnk (D31702)!

llvm-svn: 300100
2017-04-12 20:43:11 +00:00
Peter Collingbourne ce24a2aa93 Bitcode: Move version and global value module code parsers to separate functions. NFCI.
This will make it easier to teach this code about the string table.

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

llvm-svn: 300099
2017-04-12 20:02:09 +00:00
Zachary Turner 2bb94cd0dd [Support] Add support for unique_ptr<> to Casting.h.
Often you have a unique_ptr<T> where T supports LLVM's
casting methods, and you wish to cast it to a unique_ptr<U>.
Prior to this patch, this requires doing hacky things like:

unique_ptr<U> Casted;
if (isa<U>(Orig.get()))
  Casted.reset(cast<U>(Orig.release()));

This is overly verbose, and it would be nice to just be able
to use unique_ptr directly with cast and dyn_cast.  To this end,
this patch updates cast<> to work directly with unique_ptr<T>,
so you can now write:

auto Casted = cast<U>(std::move(Orig));

Since it's possible for dyn_cast<> to fail, however, we choose
to use a slightly different API here, because it's awkward to
write

if (auto Casted = dyn_cast<U>(std::move(Orig))) {}

when Orig may end up not having been moved at all.  So the
interface for dyn_cast is

if (auto Casted = unique_dyn_cast<U>(Orig)) {}

Where the inclusion of `unique` in the name of the cast operator
re-affirms that regardless of success of or fail of the casting,
exactly one of the input value and the return value will contain
a non-null result.

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

llvm-svn: 300098
2017-04-12 19:59:37 +00:00
Shoaib Meenai 538b3f4198 [libc++] Use more appropriate conditional for ABI macro definition
The inline function definition ABI macro is gated on COFF dllexport
semantics, so it's more appropriate to mark it with the object file
format macro rather than the generic _WIN32 macro. We now have no uses
of _WIN32 apart from those used to define the other Windows macros :)

Clarify the ABI macro comment and make the object file format check
exhaustive while I'm here.

llvm-svn: 300097
2017-04-12 19:56:37 +00:00
Zachary Turner 55306e706d Remove svnprop eol-style:native from Casting.h
llvm-svn: 300096
2017-04-12 19:52:47 +00:00
Craig Topper c75f94bfa5 [InstCombine] Teach SimplifyMultipleUseDemandedBits to handle And/Or/Xor known bits using the LHS/RHS known bits it already acquired without recursing back into computeKnownBits.
This replicates the known bits and constant creation code from the single use case for these instructions and adds it here. The computeKnownBits and constant creation code for other instructions is now in the default case of the opcode switch.

llvm-svn: 300094
2017-04-12 19:32:47 +00:00
Craig Topper cf3641fd57 [InstCombine] Remove unreachable code for turning an And where all demanded bits on both sides are known to be zero into a constant 0.
We already handled a superset check that included the known ones too and folded to a constant that may include ones. But it can also handle the case of no ones.

llvm-svn: 300093
2017-04-12 19:08:03 +00:00
Sanjay Patel 6e41018942 [InstCombine] fix wrong undef handling when converting select to shuffle
As discussed in:
https://bugs.llvm.org/show_bug.cgi?id=32486
...the canonicalization of vector select to shufflevector does not hold up
when undef elements are present in the condition vector. 

Try to make the undef handling clear in the code and the LangRef.

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

llvm-svn: 300092
2017-04-12 18:39:53 +00:00
Craig Topper 8b459c24f3 [SelectionDAG] Use APInt move assignment to avoid 2 memory allocations and copies when bit width is larger than 64-bits.
llvm-svn: 300091
2017-04-12 18:39:27 +00:00
Bob Haarman dd4b4325ee [coff] default to multiple parallel ThinLTO jobs
Summary:
lld-link allows the number of parallel ThinLTO jobs to be specified
using /opt:lldltojobs=N. If left unspecified, the implementation
conservatively defaults to 1. This leads to very long link times. This
change makes it so that the default is to automatically set the
parallelism, as we do in the ELF linker.

Reviewers: ruiu, hans

Reviewed By: ruiu, hans

Subscribers: pcc, mehdi_amini, Prazek, llvm-commits

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

llvm-svn: 300089
2017-04-12 18:36:13 +00:00
Kyle Butt 336c78fdbe CodeGen: BlockPlacement: Add comment about DenseMap Safety.
The use of a DenseMap in precomputeTriangleChains does not cause
non-determinism, even though it is iterated over, as the only thing the
iteration does is to insert entries into a new DenseMap, which is not iterated.
Comment only change.

llvm-svn: 300088
2017-04-12 18:30:32 +00:00
Rui Ueyama 5c5bc7bc0a Accept not only lld-link but also LLD-LINK, for example.
Filenames are case-insensitive on Windows, so when we dispatch based
on argv0, we need to handle it case-insensitively.

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

llvm-svn: 300087
2017-04-12 18:29:52 +00:00