Commit Graph

215901 Commits

Author SHA1 Message Date
Rafael Espindola 449711cb36 Stop producing .data.rel sections.
If a section is rw, it is irrelevant if the dynamic linker will write to
it or not.

It looks like llvm implemented this because gcc was doing it. It looks
like gcc implemented this in the hope that it would put all the
relocated items close together and speed up the dynamic linker.

There are two problem with this:
* It doesn't work. Both bfd and gold will map .data.rel to .data and
  concatenate the input sections in the order they are seen.
* If we want a feature like that, it can be implemented directly in the
  linker since it knowns where the dynamic relocations are.

llvm-svn: 253436
2015-11-18 06:02:15 +00:00
Saleem Abdulrasool e113b5e9af c++abi: use __builtin_offsetof instead of offsetof
Use `__builtin_offsetof` in place of `offsetof`.  Certain environments provide a
macro definition of `offsetof` which may end up causing issues.  This was
observed on Windows.  Use `__builtin_offsetof` to ensure correct evaluation
everywhere.  NFC.

llvm-svn: 253435
2015-11-18 05:33:38 +00:00
NAKAMURA Takumi 64705c8e7b BuildUniversalActions(): Prune obsolete \param(s). [-Wdocumentation]
FIXME: Describe BAInputs.
llvm-svn: 253434
2015-11-18 05:15:21 +00:00
David Majnemer 8a4be35c9c Adjust test from fallout due to r253429
As a side note, the jump target is much nicer than before.

We went from: <bar+...> to <.plt>

llvm-svn: 253433
2015-11-18 04:37:23 +00:00
David Majnemer 153722d2f1 Fix LLD testsuite fallout from r253429
llvm-svn: 253432
2015-11-18 04:35:32 +00:00
Faisal Vali 0374bf0d07 [NFC] Change the evaluation context of a non-type default template argument from Unevaluated to ConstantEvaluated.
This patch emits a more appropriate (but still noisy) diagnostic stream when a lambda-expression is encountered within a non-type default argument. 

For e.g. template<int N = ([] { return 5; }())> int f();

As opposed to complaining that a lambda expression is not allowed in an unevaluated operand, the patch complains about the lambda being forbidden in a constant expression context (which will be allowed in C++17 now that they have been accepted by EWG, unless of course CWG or national bodies (that have so far shown no signs of concern) rise in protest) 

As I start submitting patches for constexpr lambdas (http://wg21.link/P0170R0) under C++1z (OK'd by Richard Smith at Kona), this will be one less change to make.

Thanks!

llvm-svn: 253431
2015-11-18 04:29:22 +00:00
David Majnemer 8447ff6357 Add a test for r253323
Forgot to do this simultaneously with committing the fix.

llvm-svn: 253430
2015-11-18 02:50:39 +00:00
David Majnemer fbb1c3a70b [llvm-objdump] Use the COFF export table for additional symbols
Most linked executables do not have a symbol table in COFF.
However, it is pretty typical to have some export entries.  Use those
entries to inform the disassembler about potential function definitions
and call targets.

llvm-svn: 253429
2015-11-18 02:49:19 +00:00
NAKAMURA Takumi 67361cc2e1 Revert r253401, "[clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index"
cppcoreguidelines-pro-bounds-constant-array-index.cpp is failing in several hosts.

llvm-svn: 253428
2015-11-18 02:14:35 +00:00
Jingyue Wu 1cbe0e212a [doc] simplify the doc on compiling CUDA
CUDA support doesn't reply on temporary patches any more. Thanks Artem!

llvm-svn: 253427
2015-11-18 01:59:05 +00:00
Cong Hou 136bc65ec8 Remove a redundant assertion in MachineBasicBlock.cpp. NFC.
llvm-svn: 253426
2015-11-18 01:55:56 +00:00
Cong Hou 11c1420173 Remove redundant code in MachineBasicBlock.cpp. NFC.
llvm-svn: 253425
2015-11-18 01:45:10 +00:00
Enrico Granata 0481df6af4 Remove a few vestigial typedefs from the old world
llvm-svn: 253424
2015-11-18 01:44:36 +00:00
Enrico Granata a76e894bd5 Cleanup the type X list commands to use the new ForEach goodness
llvm-svn: 253423
2015-11-18 01:37:49 +00:00
Reid Kleckner 3da7a5338e Attempt to fix uninitialized SDAG persistent ids detected by MSan
llvm-svn: 253422
2015-11-18 01:21:06 +00:00
Cong Hou e8c455d90e Let += and -= operators in BranchProbability have saturation behaviors.
This commit is for a later patch that is depend on it. The sum of two
branch probabilities can be greater than 1 due to rounding. It is safer
to saturate the results of sum and subtraction.

llvm-svn: 253421
2015-11-18 01:20:37 +00:00
Richard Smith 2a40fb78c0 Don't expose iterators into the list of types on the ASTContext; these are
unsafe, since many operations on the types can trigger lazy deserialization of
more types and invalidate the iterators. This fixes a crasher, but I've not
been able to reduce it to a reasonable testcase yet.

llvm-svn: 253420
2015-11-18 01:19:02 +00:00
Kostya Serebryany 4d62322213 [libFuzzer] remove default initializer as a workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68399. Don't need it anyway.
llvm-svn: 253419
2015-11-18 01:08:30 +00:00
Reid Kleckner 356be39f65 Try to fix leak in CXStringSet from r252853
llvm-svn: 253418
2015-11-18 01:06:39 +00:00
Cong Hou 804c1d81aa Modify the interface BranchProbability::normalizeProbabilities to let it accept a pair of iterators. NFC.
llvm-svn: 253417
2015-11-18 01:03:19 +00:00
Alexey Samsonov 1f4cb4d3d4 [TSan] List only amd64 asm file in Makefile.old (attempt 2)
llvm-svn: 253416
2015-11-18 00:56:37 +00:00
Nathan Slingerland a75d2564fb Revert "[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions"
Not ready for merge.

llvm-svn: 253415
2015-11-18 00:55:15 +00:00
Cong Hou 41cf1a5dfb Improving edge probabilities computation when choosing the best successor in machine block placement.
When looking for the best successor from the outer loop for a block
belonging to an inner loop, the edge probability computation can be
improved so that edges in the inner loop are ignored. For example,
suppose we are building chains for the non-loop part of the following
code, and looking for B1's best successor. Assume the true body is very
hot, then B3 should be the best candidate. However, because of the
existence of the back edge from B1 to B0, the probability from B1 to B3
can be very small, preventing B3 to be its successor. In this patch, when
computing the probability of the edge from B1 to B3, the weight on the
back edge B1->B0 is ignored, so that B1->B3 will have 100% probability.

if (...)
  do {
    B0;
    ... // some branches
    B1;
  } while(...);
else
  B2;
B3;


Differential revision: http://reviews.llvm.org/D10825

llvm-svn: 253414
2015-11-18 00:52:52 +00:00
Nathan Slingerland b2d95f0d2e [llvm-profdata] Fix unhandled enumeration values warning
Fix this:

llvm/tools/llvm-profdata/llvm-profdata.cpp:78:15: warning: 12 enumeration values not handled in switch: 'success', 'eof', 'unrecognized_format'... [-Wswitch]
      switch (instrError) {
                    ^

llvm-svn: 253413
2015-11-18 00:52:45 +00:00
Nathan Slingerland fda1b81f69 [llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions
Summary:
This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. It also updates the instrumentation and sample profile merge implementations to use them.

No functional changes.

Reviewers: dnovillo, bogner, davidxl

Subscribers: davidxl, llvm-commits

Differential Revision: http://reviews.llvm.org/D14720

llvm-svn: 253412
2015-11-18 00:52:43 +00:00
Quentin Colombet 8cb95b8e51 [ARM] Enable shrink-wrapping by default.
Differential Revision: http://reviews.llvm.org/D14357

rdar://problem/21942589

llvm-svn: 253411
2015-11-18 00:40:54 +00:00
Artem Belevich 6e50375286 Fix for use-after-free which caused test failure in cuda-detect.cu.
Return std::string itself instead StringRef to a temporary std::string.

llvm-svn: 253410
2015-11-18 00:37:41 +00:00
David Blaikie 6196aa06c9 Generalize ownership/passing semantics to allow dsymutil to own abbreviations via unique_ptr
While still allowing CodeGen/AsmPrinter in llvm to own them using a bump
ptr allocator. (might be nice to replace the pointers there with
something that at least automatically calls their dtors, if that's
necessary/useful, rather than having it done explicitly (I think a typed
BumpPtrAllocator already does this, or maybe a unique_ptr with a custom
deleter, etc))

llvm-svn: 253409
2015-11-18 00:34:10 +00:00
Rafael Espindola a21af73c41 Remove excess white space
llvm-svn: 253408
2015-11-18 00:31:34 +00:00
Alexey Samsonov 3408ea64ed [TSan] List only amd64 asm file in Makefile.old
llvm-svn: 253407
2015-11-18 00:31:00 +00:00
Alexey Samsonov de6fb1d9c7 [ASan] Be consistent and refer to reported issues as "errors" in hints.
llvm-svn: 253406
2015-11-18 00:24:32 +00:00
Akira Hatanaka 8c26ea663d Produce a better diagnostic for global register variables.
Currently, when there is a global register variable in a program that
is bound to an invalid register, clang/llvm prints an error message that
is not very user-friendly.

This commit improves the diagnostic and moves the check that used to be
in the backend to Sema. In addition, it makes changes to error out if
the size of the register doesn't match the declared variable size.

e.g., volatile register int B asm ("rbp");

rdar://problem/23084219

Differential Revision: http://reviews.llvm.org/D13834

llvm-svn: 253405
2015-11-18 00:15:28 +00:00
Betul Buyukkurt cbf0b5e4b6 [PGO] Removed unused code. [NFC]
llvm-svn: 253404
2015-11-18 00:14:08 +00:00
Sanjay Patel 77f4486950 [InstCombine] refactor optimizeIntToFloatBitCast() ; NFCI
The logic for handling the pattern without a shift is identical
to the logic for handling the pattern with a shift if you set 
the shift amount to zero for the former.

This should make it easier to see that we probably don't even need
optimizeIntToFloatBitCast(). 

If we call something like foldVecTruncToExtElt() from visitTrunc(),
we'll solve PR25543:
https://llvm.org/bugs/show_bug.cgi?id=25543

llvm-svn: 253403
2015-11-18 00:00:04 +00:00
Matthias Gehre 55020566ed [clang-tidy] add check cppcoreguidelines-pro-bounds-constant-array-index
Summary:
This check flags all array subscriptions on static arrays and
std::arrays that either have a non-compile-time-constant index or are
out of bounds.

Dynamic accesses into arrays are difficult for both tools and humans to
validate as safe. array_view is a bounds-checked, safe type for
accessing arrays of data. at() is another alternative that ensures
single accesses are bounds-checked. If iterators are needed to access an
array, use the iterators from an array_view constructed over the array.

This rule is part of the "Bounds safety" profile of the C++ Core
Guidelines, see
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#-bounds2-only-index-into-arrays-using-constant-expressions

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D13746

llvm-svn: 253401
2015-11-17 23:43:20 +00:00
Nathan Slingerland 11c938d122 [llvm-profdata] Show hint for other mismatch errors when merging instr profdata
Missed bit of feedback from D14720.

Show the same "Make sure that all profile
data to be merged is generated from the same binary." hint for hash mismatch
and value site count mismatch as we now do for counter mismatch when merging
incompatible instrumentation profile data.

llvm-svn: 253400
2015-11-17 23:37:09 +00:00
Matthias Gehre 4722f1921a Fix bug 25362 "cppcoreguidelines-pro-bounds-array-to-pointer-decay does not consider const"
Summary:
The current matcher is
  implicitCastExpr(unless(hasParent(explicitCastExpr())))
but the AST in the bug is
  `-CXXStaticCastExpr 0x2bb64f8 <col:21, col:55> 'void *const *'
static_cast<void *const *> <NoOp>
    `-ImplicitCastExpr 0x2bb64e0 <col:47> 'void *const *' <NoOp>
      `-ImplicitCastExpr 0x2bb64c8 <col:47> 'void **'
<ArrayToPointerDecay>
        `-DeclRefExpr 0x2bb6458 <col:47> 'void *[2]' lvalue Var
0x2bb59d0 'addrlist' 'void *[2]'
i.e. an ImplicitCastExpr (const cast) between decay and explicit cast.

Reviewers: alexfh, sbenza, bkramer, aaron.ballman

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D14517

llvm-svn: 253399
2015-11-17 23:35:39 +00:00
Richard Smith 752ada870d [modules] When a #include is mapped to a module import and appears somewhere
other than the top level, we issue an error. This breaks a fair amount of C++
code wrapping C libraries, where the C library is #included within a namespace
/ extern "C" combination, because the C library (probably) includes C++
standard library headers which may be within modules.

Without modules, this setup is harmless if (and *only* if) the corresponding
standard library module was already included outside the namespace, so
downgrade the error to a default-error extension in that case, so that it can
be selectively disabled for such misbehaving libraries.

llvm-svn: 253398
2015-11-17 23:32:01 +00:00
Peter Collingbourne 70507e59fe COFF: Destroy LTOModules as they are linked.
This should help reduce memory consumption during LTO.

Differential Revision: http://reviews.llvm.org/D14672

llvm-svn: 253397
2015-11-17 23:30:59 +00:00
Simon Pilgrim 2da4178737 [X86][AVX512] Added AVX512 SHUFP*/VPERMILP* shuffle decode comments.
llvm-svn: 253396
2015-11-17 23:29:49 +00:00
David Blaikie 1e80f2a9e8 Fix read-of-uninitialized introduced in r253277 exposed on some buildbots
Verified that this was at least /an/ issue, if not the only one, by
initializing NumBuckets to 1 (previously it was uninitialized, so if
this change made a difference, which it did (causing a bunch of tests to
crash) it demonstrates use-of-uninitialized memory). Initializing then
removes the crashes.

Thanks Reid for the debugging assistance

llvm-svn: 253395
2015-11-17 23:26:06 +00:00
Xinliang David Li 99556877ae [PGO] Move value profile data definitions out of IndexedInstrProf
Move the data structure defintions out of the namespace. The defs will
be shared by raw format. [NFC]

llvm-svn: 253394
2015-11-17 23:00:40 +00:00
David Blaikie 4689ef5943 Fix null dereference committed in r253277
llvm-svn: 253393
2015-11-17 22:39:26 +00:00
David Blaikie 35c2eebfe4 dwarfdump: support indexed string dumping in dwp based on the STR_OFFSETS component of the index
llvm-svn: 253392
2015-11-17 22:39:23 +00:00
Simon Pilgrim 8483df6e24 [X86][AVX512] Added support for AVX512 UNPCK shuffle decode comments.
llvm-svn: 253391
2015-11-17 22:35:45 +00:00
Douglas Katzman 9d40374880 [Myriad]: -nostdlib implies -nostartfiles
llvm-svn: 253390
2015-11-17 22:33:34 +00:00
Artem Belevich 8601733c1c [CUDA] Make CUDA compilation usable by default.
Currently clang requires several additional command
line options in order to enable new features needed
during CUDA compilation. This patch makes these
options default.

* Automatically include cuda_runtime.h if we've found
  a valid CUDA installation.
* Disable automatic CUDA header inclusion during unit tests.
* Added test case for command line construction.
* Enabled target overloads and relaxed call checks that are
  needed in order to include CUDA headers.
* Added CUDA-7.5 installation path to the CUDA installation search list.
* Define __CUDA__ macro to indicate CUDA compilation.

llvm-svn: 253389
2015-11-17 22:28:55 +00:00
Artem Belevich c29db84419 [CUDA] Added a wrapper header for inclusion of stock CUDA headers.
Header files that come with CUDA are assuming split host/device
compilation and are not usable by clang out of the box.
With a bit of preprocessor magic it's possible to twist them
into something clang can use.

This wrapper always includes CUDA headers exactly the same way during
host and device compilation passes and produces identical preprocessed
content during host and device side compilation for sm_35 GPUs. Device
compilation passes for older GPUs will see a smaller subset of device
functions supported by particular GPU.

The wrapper assumes specific contents of CUDA header files and works
only with CUDA 7.0 and 7.5.

Differential Revision: http://reviews.llvm.org/D13171

llvm-svn: 253388
2015-11-17 22:28:52 +00:00
Artem Belevich 34f481acc6 [CUDA] Detect and link with CUDA's libdevice bitcode library.
- added detection of libdevice bitcode file and API to find one appropriate for the GPU we're compiling for.
- pass additional cc1 options for linking with detected libdevice bitcode
- added -nocudalib to prevent automatic linking with libdevice
- added test cases to verify new functionality

Differential Revision: http://reviews.llvm.org/D14556

llvm-svn: 253387
2015-11-17 22:28:50 +00:00
Artem Belevich fa11ab53c0 [CUDA] added include paths for both sides of CUDA compilation.
In order to compile a CUDA file clang must be able to find
include files for both both host and device.

This patch passes AuxToolchain to AddPreprocessingOptions and
uses it to add include paths for the opposite side of compilation.

We also must be able to find CUDA include files. If the driver
found CUDA installation, it adds appropriate include path
to CUDA headers. This can be disabled with '-nocudainc'.

- Added include paths for the opposite side of compilation.
- Added include paths to detected CUDA installation.
- Added -nocudainc to prevent adding CUDA include path.
- Added test cases to verify new functionality.

Differential Revision: http://reviews.llvm.org/D13170

llvm-svn: 253386
2015-11-17 22:28:46 +00:00