Commit Graph

259541 Commits

Author SHA1 Message Date
Rui Ueyama 9d773f3cb2 Add comments for the RELRO segment.
RELRO is a feature to make segments read-only after dynamic relocations
are applied. It is different from read-only segments because RELRO is
initially writable. And of course RELRO is different from writable
segments.

RELRO is not a very well known feature. We have a series of checks to
make a decision whether a section should be in a RELRO segment or not,
but we didn't describe why. This patch adds comments to explain how
that decision is made.

llvm-svn: 300176
2017-04-13 05:40:07 +00:00
Eric Fiselier 4365d4e951 Cleanup any_cast failure test
llvm-svn: 300175
2017-04-13 05:27:55 +00:00
Lang Hames 7d3aaedc13 [Orc] Fix bool serialization for RawByteChannels.
The bool type may be larger than the char type, so assuming we can cast from
bool to char and write a byte out to the stream is unsafe.

Hopefully this will get RPCUtilsTest.ReturnExpectedFailure passing on the bots.

llvm-svn: 300174
2017-04-13 05:23:50 +00:00
Lang Hames 068655911e [ORC] Remove more extraneous semicolons from r300167, rename the RPC Expected
tests to be consistent with the Error tests.

llvm-svn: 300173
2017-04-13 05:05:26 +00:00
George Burgess IV 8a464a7592 Remove more lies from the LangRef.
Same change as in r300168, but for invoke instead of call.

llvm-svn: 300172
2017-04-13 05:00:31 +00:00
Craig Topper 90377de972 [APInt] Reorder fields to avoid a hole in the middle of the class
Summary:
APInt is currently implemented with an unsigned BitWidth field first and then a uint_64/pointer union. Due to the 64-bit size of the union there is a hole after the bitwidth.

Putting the union first allows the class to be packed. Making it 12 bytes instead of 16 bytes. An APSInt goes from 20 bytes to 16 bytes.

This shows a 4k reduction on the size of the opt binary on my local x86-64 build. So this enables some other improvement to the code as well.

Reviewers: dblaikie, RKSimon, hans, davide

Reviewed By: davide

Subscribers: davide, llvm-commits

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

llvm-svn: 300171
2017-04-13 04:59:11 +00:00
Lang Hames b9054d6b86 [ORC] Remove extraneous semi-colon added in r300167.
llvm-svn: 300170
2017-04-13 04:49:00 +00:00
Craig Topper 92fc477292 [APInt] Generalize the implementation of tcIncrement to support adding a full 'word' by introducing tcAddPart. Use this to support tcIncrement, operator++ and operator+=(uint64_t). Do the same for subtract. NFCI.
llvm-svn: 300169
2017-04-13 04:36:06 +00:00
George Burgess IV 39c9105e25 Update the LangRef to reflect reality.
At the very least, we have CallInst::setIsNoInline() for adding the
noinline attribute to callsites, and I'm told alwaysinline seems to
work.

Thought of adding "not all attributes are guaranteed to work here". If
someone thinks that would be better (or has a better way of phrasing
that, etc.), happy to add it.

llvm-svn: 300168
2017-04-13 04:01:55 +00:00
Lang Hames ffad0103c7 [ORC] Add RPC and serialization support for Errors and Expecteds.
This patch allows Error and Expected types to be passed to and returned from
RPC functions.

Serializers and deserializers for custom error types (types deriving from the
ErrorInfo class template) can be registered with the SerializationTraits for
a given channel type (see registerStringError in RPCSerialization.h for an
example), allowing a given custom type to be sent/received. Unregistered types
will be serialized/deserialized as StringErrors using the custom type's log
message as the error string.

llvm-svn: 300167
2017-04-13 03:51:35 +00:00
Eric Fiselier 80dcad0977 Fix template >> within C++03 code
llvm-svn: 300165
2017-04-13 02:56:03 +00:00
Eric Fiselier e02ed1c255 Diagnose when reverse_iterator is used on path::iterator.
path::iterator isn't a strictly conforming iterator. Specifically
it stashes the current element inside the iterator. This leads to
UB when used with reverse_iterator since it requires the element
to outlive the lifetime of the iterator.

This patch adds a static_assert inside reverse_iterator to disallow
"stashing iterator types", and it tags path::iterator as such a type.

Additionally this patch removes all uses of reverse_iterator<path::iterator>
within the tests.

llvm-svn: 300164
2017-04-13 02:54:13 +00:00
Zachary Turner d3d084a0a5 Remove some unused private fields.
llvm-svn: 300163
2017-04-13 02:28:17 +00:00
Jason Molenda 3f60829455 Don't use uuid_clear(), non-darwin platforms include
Utility/UuidCompatibility.h which gets you a definiton
of uuid_t but none of the functions that operate on it.

llvm-svn: 300162
2017-04-13 02:12:32 +00:00
Craig Topper e70dffeb54 [InstCombine] Add vector version of a test to show missing optimization.
llvm-svn: 300161
2017-04-13 01:31:40 +00:00
Peter Collingbourne 942fa56f40 Support: Add a VCSRevision.h header file.
This is a magic header file supported by the build system that provides a
single definition, LLVM_REVISION, containing an LLVM revision identifier,
if available. This functionality previously lived in the LTO library, but
I am moving it out to lib/Support because I want to also start using it in
lib/Object to create the IR symbol table.

This change also fixes a bug where LLVM_REVISION was never actually being
used in lib/LTO because the macro HAS_LLVM_REVISION was never defined (it
was misspelled as HAVE_SVN_VERSION_INC in lib/LTO/CMakeLists.txt, and was
only being defined in a non-existent file Version.cpp).

I also changed the code to use "git rev-parse --git-dir" to locate the .git
directory, instead of looking for it in the LLVM source root directory,
which makes this compatible with monorepos as well as git worktrees.

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

llvm-svn: 300160
2017-04-13 01:26:12 +00:00
Eric Fiselier b411e9ce4d Fix C++03 test failures
llvm-svn: 300159
2017-04-13 01:13:58 +00:00
Eric Fiselier ed9caee9a8 Add tests that std::unique_ptr's default constructor is constexpr.
std::unique_ptr's default constructor must be constexpr in order
to allow constant initialization to take place for static objects;
Even though we can never have a constexpr unique_ptr variable since
it's not a literal type.

This patch adds tests that constant initialization takes place by
using the __attribute__((require_constant_initialization)) macro.

llvm-svn: 300158
2017-04-13 01:11:58 +00:00
Lang Hames fde9aafe3d [ORC] Add missing file from r300155.
llvm-svn: 300157
2017-04-13 01:06:45 +00:00
Eric Fiselier 6e47b7ea91 Update tests -verify error messages after r300140.
llvm-svn: 300156
2017-04-13 01:03:41 +00:00
Lang Hames 22bc7b9648 [ORC] Use native Errors rather than converted std::error_codes for ORC RPC.
llvm-svn: 300155
2017-04-13 01:03:06 +00:00
Eric Fiselier b3f5742551 Fix more bad member swap definitions in unordered_map.
The __unordered_map_equal and __unordered_map_hash wrappers
attempt to swap const qualified predicates whenever the predicate
is empty, and is subject to the EBO.

Swapping const values seems blatently incorrect. This patch removes
the const qualifier so the values are swapped as non-const.

llvm-svn: 300154
2017-04-13 01:02:41 +00:00
Reid Kleckner 7f72033e1c [IR] Take func, ret, and arg attrs separately in AttributeList::get
This seems like a much more natural API, based on Derek Schuff's
comments on r300015. It further hides the implementation detail of
AttributeList that function attributes come last and appear at index
~0U, which is easy for the user to screw up. git diff says it saves code
as well: 97 insertions(+), 137 deletions(-)

This also makes it easier to change the implementation, which I want to
do next.

llvm-svn: 300153
2017-04-13 00:58:09 +00:00
Eric Fiselier 4104cf8257 Fix the default constructibility of __compressed_pair.
This patch fixes a bug where the =default default ctor for
__compressed_pair was incorrect for const qualified types.

llvm-svn: 300152
2017-04-13 00:50:45 +00:00
Richard Smith 29a0f0db9e Fix broken test. We can't assume that 2MB of args is enough to require a response file.
This test has apparently been broken for years, but we never noticed before
because it's a long test and long tests approximately never get run.

llvm-svn: 300151
2017-04-13 00:46:50 +00:00
Vitaly Buka 0d2b80d499 [msan] Fix msan_test broken after r299884.
Bind to ANY as some machines may have IPv6 support but without IPv6 on loopback
interface.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 300150
2017-04-13 00:36:03 +00:00
Vitaly Buka b3cc24c289 [msan] Fix invalid use of vector constructor introduced by r299884.
llvm-svn: 300149
2017-04-13 00:36:02 +00:00
Eric Fiselier e1ec29869b Fix most failures caused by r300140
r300140 introduced a bunch of failures by changing the internal
interface provided by __compressed_pair. This patch fixes all of
the failures caused by the new interface by changing the existing
code to use it.

In addition to those changes this patch also fixes two separate
issues causing test failures:

1) Fix the member swap definition for __map_value_compare. Previously
   the swap was incorrectly configured to swap the comparator as const.

2) Fix an assertion failure in futures.task.members/ctor_func_alloc.pass.cpp
that incorrectly expected a move to take place when a single copy is sufficient.

There is one remaining failure regarding make_shared. I'll commit a fix for that
shortly.

llvm-svn: 300148
2017-04-13 00:34:24 +00:00
Rui Ueyama 3233d3eb46 Do not initialize this->SoName with this->DefaultSoName.
This patch uses DefaultSoName in getSoName instead of in parseSoName.
I think this is more readable. This patch also add comments.

llvm-svn: 300147
2017-04-13 00:23:32 +00:00
Craig Topper 37df0180a0 [IR] Remove the APIntMoveTy typedef from ConstantRange. Use APInt type directly.
This typedef used to be conditional based on whether rvalue references were supported. Looks like it got left behind when we switched to always having rvalue references with c++11. I don't think it provides any value now.

llvm-svn: 300146
2017-04-13 00:20:31 +00:00
NAKAMURA Takumi 23ad196a22 ExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]
llvm-svn: 300145
2017-04-13 00:17:28 +00:00
Richard Smith 1f5a05bba1 Work around MSVC rejects-valid bug related to C++11 narrowing conversions.
llvm-svn: 300144
2017-04-13 00:14:39 +00:00
Konstantin Zhuravlyov 6df95b7c45 Fix compiler error in Attributes.cpp
```
Compiling Attributes.cpp ...
../../../Attributes.cpp: In member function 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> > llvm::AttributeSet::getAllocSizeArgs() const':
../../../Attributes.cpp:542:69: error: operands to ?: have different types 'std::__1::pair<unsigned int, llvm::Optional<unsigned int> >' and 'std::__1::pair<int, int>'
   return SetNode ? SetNode->getAllocSizeArgs() : std::make_pair(0, 0);
                                                                     ^
../../../Attributes.cpp:543:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
```

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

llvm-svn: 300143
2017-04-12 23:57:37 +00:00
Wei Ding 74da350b85 AMDGPU : Fix common dominator of two incoming blocks terminates with uniform branch issue.
Differential Revision: http://reviews.llvm.org/D31350

llvm-svn: 300142
2017-04-12 23:51:47 +00:00
Richard Smith a13714ea5f Update to match LLVM r300135.
llvm-svn: 300141
2017-04-12 23:51:20 +00:00
Eric Fiselier c88580c400 [libcxx] Fix __compressed_pair so it doesn't copy the argument multiple times, and add constexpr.
Summary:
__compressed_pair takes and passes it's constructor arguments by value. This causes arguments to be moved 3 times instead of once. This patch addresses that issue and fixes `constexpr` on the constructors.

I would rather have this fix than D27564, and I'm fairly confident it's not ABI breaking but I'm not 100% sure.

I prefer this solution because it removes a lot of code and makes the implementation *much* smaller.

Reviewers: mclow.lists, K-ballo

Reviewed By: K-ballo

Subscribers: K-ballo, cfe-commits

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

llvm-svn: 300140
2017-04-12 23:45:53 +00:00
Richard Smith 6fd4bc6b22 Fix some ArgList uses after API change in r300135.
llvm-svn: 300139
2017-04-12 23:43:58 +00:00
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