Commit Graph

251663 Commits

Author SHA1 Message Date
Reid Kleckner 9aa2b31a02 Fix MSVC build of AlignedCharArrayUnion
Use constexpr recursion for alignof like we do for sizeof. Seems to work
with Clang and MSVC. Also, don't recurse twice to avoid slowdowns in
compilers that don't memoize constexpr results (Clang).

llvm-svn: 291514
2017-01-10 00:26:56 +00:00
Gor Nishanov d97f6bfbb1 [coroutines] Sema: Allow co_return all by itself.
Reviewers: rsmith, EricWF

Subscribers: mehdi_amini, llvm-commits, EricWF

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

llvm-svn: 291513
2017-01-10 00:08:31 +00:00
Richard Smith 43a833bec4 Check that template template arguments match template template parameters
properly even when a non-type template parameter has a dependent type.

Previously, if a non-type template parameter was dependent, but not dependent
on an outer level of template parameter, we would not match the type of the
parameter. Under [temp.arg.template], we are supposed to check that the types
are equivalent, which means checking for syntactic equivalence in the dependent
case.

This also fixes some accepts-invalids when passing templates with auto-typed
non-type template parameters as template template arguments.

llvm-svn: 291512
2017-01-09 23:54:33 +00:00
Alex Shlyapnikov 0e93c3932a ASAN activate/deactive controls thread_local_quarantine_size_kb option.
Summary: Also, bypass quarantine altogether when quarantine size is set ot zero.

Reviewers: eugenis

Subscribers: kubabrecka, llvm-commits, mehdi_amini

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

llvm-svn: 291511
2017-01-09 23:49:17 +00:00
Alex Shlyapnikov 518acec990 Bypass quarantine when quarantine size is set ot zero.
llvm-svn: 291510
2017-01-09 23:49:15 +00:00
Alex Shlyapnikov ae8e9bbb2c ASAN activate/deactive controls thread_local_quarantine_size_kb option.
llvm-svn: 291509
2017-01-09 23:49:13 +00:00
Michal Gorny c3afb8aa3d [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.

llvm-svn: 291508
2017-01-09 23:41:38 +00:00
Michal Gorny db2e8acccf [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.

llvm-svn: 291506
2017-01-09 23:31:05 +00:00
Michal Gorny 33f27fd842 [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.

llvm-svn: 291505
2017-01-09 23:27:04 +00:00
Michal Gorny 72f8c5f555 [cmake] Obtain LLVM_CMAKE_PATH from llvm-config if available
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config. Fallback to local reconstruction if llvm-config does not
support this option.

llvm-svn: 291504
2017-01-09 23:23:56 +00:00
Sean Callanan 4d9c5c2280 Lift the 10-type limit for AlignedCharArrayUnion
This patch uses C++11 parameter packs and constexpr functions
to allow AlignedCharArrayUnion to hold an arbitrary number of
types.

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

llvm-svn: 291503
2017-01-09 23:23:25 +00:00
Michal Gorny 47132e5cab [cmake] Obtain LLVM_CMAKE_PATH from llvm-config
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config instead of reconstructing it locally.

llvm-svn: 291502
2017-01-09 23:17:10 +00:00
Meador Inge 9a77ea8a86 [ELF] Fix `_gp` linker script test
Rafael suggested in review to wrap the `.` in an
`ABSOLUTE` op to force the section to be in the
*ABS* "section":

  * http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170109/417865.html

llvm-svn: 291501
2017-01-09 23:16:01 +00:00
Michal Gorny eb200b2ccf [cmake] Obtain LLVM_CMAKE_PATH from llvm-config
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config instead of reconstructing it locally.

llvm-svn: 291500
2017-01-09 23:12:37 +00:00
James Y Knight 5b30b67cd1 Commit a test for match-full-lines.
I unfortunately neglected to add it in r260540, but it has been
sitting in my working dir ever since. D'oh.

Modified to work with r290069, which made the CHECK patterns
themselves whitespace-sensitive as well, and remove the test added
then, as this tests both strict and non-strict modes.

llvm-svn: 291499
2017-01-09 23:11:25 +00:00
Dan Gohman 6055fbae62 [WebAssembly] Add return type annotations in fast isel.
llvm-svn: 291498
2017-01-09 23:09:38 +00:00
Justin Bogner 603715c66b Adorn __call_once_proxy with `inline` and `_LIBCPP_INLINE_VISIBILITY`
As per discussion with mclow and EricWF on irc, this is small and
simple enough to deserve being inlined.

llvm-svn: 291497
2017-01-09 23:07:12 +00:00
Rui Ueyama 817c9d66f0 Support non-regular output files.
This patch enables something like "-o /dev/null".
Previouly, it failed because such files cannot be renamed.

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

llvm-svn: 291496
2017-01-09 23:07:05 +00:00
Michal Gorny 8c5c7ffb8d [cmake] Obtain LLVM_CMAKE_PATH from llvm-config
Use the new --cmakedir option to obtain LLVM_CMAKE_PATH straight from
llvm-config instead of reconstructing it locally.

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

llvm-svn: 291495
2017-01-09 23:06:39 +00:00
Rui Ueyama e9d17545bc TarWriter: Fix a bug in Ustar header.
If we split a filename into `Name` and `Prefix`, `Prefix` is at most
145 bytes. We had a bug that didn't split a path correctly. This bug
was pointed out by Rafael in the post commit review.

This patch adds a unit test for TarWriter to verify the fix.

llvm-svn: 291494
2017-01-09 22:55:00 +00:00
George Burgess IV be92d5e930 Add a test for diagnose_if.
Forgot to add this file as a part of r291418.

llvm-svn: 291493
2017-01-09 22:43:16 +00:00
Marshall Clow 04b9853a97 Swap two lines in __mutex_base. On systems with high clock rates, we could mistakenly return no_timeout when a mutex had timed out if we got a tick between these two lines. Thanks to Brian Cain for the bug report.
llvm-svn: 291492
2017-01-09 22:32:11 +00:00
Douglas Yung 46d134c4ab Fixing test to work when the compiler defaults to a different C++ standard version.
Differential Revision: https://reviews.llvm.org/D28418

llvm-svn: 291491
2017-01-09 22:20:10 +00:00
Eugene Zelenko c9f1f6b8ec [NVPTX] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 291490
2017-01-09 22:16:51 +00:00
Richard Smith cf63b845df MSVC seems to use (void) in __FUNCSIG__ for a zero-parameter function even in C++. Follow suit.
llvm-svn: 291489
2017-01-09 22:16:16 +00:00
Simon Pilgrim fa32894730 [X86][AVX512VL] Added AVX512VL to 128/256 bit vector shift tests
llvm-svn: 291488
2017-01-09 22:13:51 +00:00
Easwaran Raman e08b139d7d Refactor inline threshold update code.
Functional change: Previously, if a callee is cold, we used ColdThreshold if it minimizes the existing threshold. This was irrespective of whether we were optimizing for minsize (-Oz) or not. But -Oz uses very low threshold to begin with and the inlining with -Oz is expected to be tuned for lowering code size, so there is no good reason to set an even lower threshold for cold callees. We now lower the threshold for cold callees only when -Oz is not used. For default values of -inlinethreshold and -inlinecold-threshold, this change has no effect and this simplifies the code.

NFC changes: Group all threshold updates that are guarded by !Caller->optForMinSize() and within that group threshold updates that require profile summary info.

Differential revision: https://reviews.llvm.org/D28369

llvm-svn: 291487
2017-01-09 21:56:26 +00:00
Davide Italiano 472684eaf5 [SimplifyLibCalls] pow(x, -0.5) -> 1.0 / sqrt(x).
Differential Revision:  https://reviews.llvm.org/D28479

llvm-svn: 291486
2017-01-09 21:55:23 +00:00
Rafael Espindola d4b24eda73 Support outputting to /dev/null.
When writing to a non regular file we cannot rename to it. Since we
have to write, we may as well create a temporary file to avoid trying
to create an unique file in /dev when trying to write to /dev/null.

llvm-svn: 291485
2017-01-09 21:52:35 +00:00
Richard Smith 2f63d4612f PR31587: Fix handling of __FUNCSIG__ in C.
Fix crash if __FUNCSIG__ is used in a function without a prototype, and use
"(void)" as parameter list instead of "()" for a function with a no-parameters
prototype, matching MSVC's observed behavior.

llvm-svn: 291484
2017-01-09 21:40:40 +00:00
Matthias Braun ba7d95d425 PeepholeOptimizer: Do not replace SubregToReg(bitcast like)
While we can usually replace bitcast like instructions
(MachineInstr::isBitcast()) with a COPY this is not legal if any of the
users uses SUBREG_TO_REG to assert the upper bits of the result are
zero.

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

llvm-svn: 291483
2017-01-09 21:38:17 +00:00
Matthias Braun c612891cc5 Drive by typo fix
llvm-svn: 291482
2017-01-09 21:38:14 +00:00
Matthias Braun a37430844c MachineInstr: Print name for subreg index in SUBREG_TO_REG
SUBREG_TO_REG takes a subregister index as 3rd operand, print the name
instead of a number. We already do the same for INSERT_SUBREG and
REG_SEQUENCE.

llvm-svn: 291481
2017-01-09 21:38:10 +00:00
David L. Jones f55ce36c02 Allow constexpr construction of subobjects unconditionally, not just in C++14.
Summary:
Per https://wg21.link/CWG1677, the C++11 standard did not clarify that constant
initialization of an object allowed constexpr brace-or-equal initialization of
subobjects:

  struct foo_t { union { int i; volatile int j; } u; };

  __attribute__((__require_constant_initialization__))
  static const foo_t x = {{0}};

Because foo_t::u has a volatile member, the initializer for x fails. However,
there is really no good reason, because this:

  union foo_u { int i; volatile int j; };
  __attribute__((__require_constant_initialization__))
  static const foo_u x = {0};

does have a constant initializer.

(This was triggered by musl's pthread_mutex_t type when building under C++11.)

Reviewers: rsmith

Subscribers: EricWF, cfe-commits

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

llvm-svn: 291480
2017-01-09 21:38:07 +00:00
Rui Ueyama a84ab073d9 TarWriter: Set "00" to Ustar version field.
Most (maybe all?) tar commands can handle tar archives with blank
version fields, but POSIX requires "00" to be set to the field, so
doing it is good for compliance.

llvm-svn: 291479
2017-01-09 21:20:42 +00:00
Michael Kuperstein 1559e8863e Revert r291092 because it introduces a crash.
See PR31589 for details.

llvm-svn: 291478
2017-01-09 21:04:46 +00:00
Michal Gorny dc155744c8 [Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtin
Correct the logic used to set ATOMIC_*_LOCK_FREE preprocessor macros not
to rely on the ABI alignment of types. Instead, just assume all those
types are aligned correctly by default since clang uses safe alignment
for _Atomic types even if the underlying types are aligned to a lower
boundary by default.

For example, the 'long long' and 'double' types on x86 are aligned to
32-bit boundary by default. However, '_Atomic long long' and '_Atomic
double' are aligned to 64-bit boundary, therefore satisfying
the requirements of lock-free atomic operations.

This fixes PR #19355 by correcting the value of
__GCC_ATOMIC_LLONG_LOCK_FREE on x86, and therefore also fixing
the assumption made in libc++ tests. This also fixes PR #30581 by
applying a consistent logic between the functions used to implement
both interfaces.

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

llvm-svn: 291477
2017-01-09 20:54:20 +00:00
Dimitry Andric 082fa545cc Move _PairT declaration out of __hash_combine to avoid warning under C++98
Summary:
Some parts of the FreeBSD tree are still compiled with C++98, and until
rL288554 this has always worked fine.  After that, a complaint about the
newly introduced local _PairT is produced:

    /usr/include/c++/v1/memory:3354:27: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args]
        typedef __scalar_hash<_PairT> _HashT;
                              ^~~~~~
    /usr/include/c++/v1/memory:3284:29: error: template argument uses local type '_PairT' [-Werror,-Wlocal-type-template-args]
        : public unary_function<_Tp, size_t>
                                ^~~
    /usr/include/c++/v1/memory:3356:12: note: in instantiation of template class 'std::__1::__scalar_hash<_PairT, 2>' requested here
        return _HashT()(__p);
               ^

As far as I can see, there should be no problem moving the _PairT
struct to just before the __hash_combine() function, which fixes this
particular warning.

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits, emaste

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

llvm-svn: 291476
2017-01-09 20:29:35 +00:00
Marshall Clow 6f8e7e0853 Added XFAIL for the apple versions of clang as well
llvm-svn: 291475
2017-01-09 20:29:28 +00:00
Peter Collingbourne c39e5d64b3 ELF: Discard .gnu.linkonce.* sections.
The linkonce feature is a sort of proto-comdat. As far as I am aware no
compiler produces linkonce sections anymore, but some glibc i386 object
files contain definitions of symbol "__x86.get_pc_thunk.bx" in linkonce
sections. Drop those sections to avoid duplicate symbol errors.

This is glibc PR20543, we should remove this hack once that has been
fixed for a while.

Fixes PR31215.

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

llvm-svn: 291474
2017-01-09 20:26:33 +00:00
Vyacheslav Klochkov d497d36083 X86-specific path: Implemented the fusing of MUL+ADDSUB to FMADDSUB.
Differential Revision: https://reviews.llvm.org/D28087

llvm-svn: 291473
2017-01-09 20:26:17 +00:00
Sanjay Patel 8f4910e26a [InstCombine] add test to show missed fold using llvm.assume; NFC
llvm-svn: 291472
2017-01-09 20:18:30 +00:00
Chris Bieneman e62e684fdd Revert "[ObjectYAML] Support for DWARF line tables"
This reverts commit r291470 due to failing bots:

http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/47209/steps/test_llvm/logs/stdio

llvm-svn: 291471
2017-01-09 20:04:55 +00:00
Chris Bieneman 0396f99184 [ObjectYAML] Support for DWARF line tables
This patch adds support for the DWARF debug_lines section. The line table state machine opcodes are preserved, so this can be used to test the state machine evaluation directly.

llvm-svn: 291470
2017-01-09 20:01:37 +00:00
Sanjay Patel eaa143c98c [InstCombine] regenerate checks; NFC
llvm-svn: 291469
2017-01-09 19:43:26 +00:00
Sanjay Patel baac743254 [ValueTracking] regenerate checks; NFC
llvm-svn: 291468
2017-01-09 19:31:20 +00:00
Daniel Berlin 101db5f7bc Fix function regex in update_tests so it can handle {}'s in function args
llvm-svn: 291467
2017-01-09 19:24:19 +00:00
Bruno Cardoso Lopes e542373920 [Chrono][Darwin] Make steady_clock use CLOCK_UPTIME_RAW
Use CLOCK_UPTIME_RAW in case clock_gettime is available on Darwin.

On Apple platforms only CLOCK_UPTIME_RAW or mach_absolute_time are able
to time functions in the nanosecond range. Thus, they are the only
acceptable implementations of steady_clock.

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

rdar://problem/29449467

llvm-svn: 291466
2017-01-09 19:21:48 +00:00
Manman Ren ffd3e9d766 PCH: fix a regression that reports a module is defined in both pch and pcm.
In r276159, we started to say that a module X is defined in a pch if we specify
-fmodule-name when building the pch. This caused a regression that reports
module X is defined in both pch and pcm if we generate the pch with
-fmodule-name=X and then in a separate clang invocation, we include the pch and
also import X.pcm.

This patch adds an option CompilingPCH similar to CompilingModule. When we use
-fmodule-name=X while building a pch, modular headers in X will be textually
included and the compiler knows that we are not building module X, so we don't
put module X in SUBMODULE_DEFINITION of the pch.

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

llvm-svn: 291465
2017-01-09 19:20:18 +00:00
Sanjay Patel 87495eb8ef [InstCombine] regenerate checks; NFC
llvm-svn: 291464
2017-01-09 19:18:46 +00:00