Commit Graph

259924 Commits

Author SHA1 Message Date
Eric Fiselier a9d646a08b Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in deque
llvm-svn: 300413
2017-04-16 03:17:01 +00:00
Eric Fiselier 208156e88b Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in <array>
llvm-svn: 300412
2017-04-16 02:50:40 +00:00
Eric Fiselier b7576b892b Workaround Clang bug regarding template template parameters
llvm-svn: 300411
2017-04-16 02:47:46 +00:00
Eric Fiselier 843d910103 Replace _LIBCPP_HAS_NO_<C++03 feature> with _LIBCPP_CXX03_LANG in vector.
This patch cleans up all usages of the following feature test macros inside
<vector> and its tests:

* _LIBCPP_HAS_NO_RVALUE_REFERENCES
* _LIBCPP_HAS_NO_VARIADICS
* _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS

Where needed the above guards were replaced with _LIBCPP_CXX03_LANG.

llvm-svn: 300410
2017-04-16 02:40:45 +00:00
Petr Hosek 539b1ec9d8 [CMake][libcxx] Fix the --target and --gcc-toolchain flag handling
CMake has the problem with the single dash variant because of the
space, so use the double dash with equal sign version. We also
don't have to pass the target triple when checking for compiler-rt
since that flag is already included in compile flags now.

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

llvm-svn: 300409
2017-04-16 02:25:55 +00:00
Eric Fiselier 92e61e93ff Cleanup and better scope unique_ptr internals
llvm-svn: 300408
2017-04-16 02:14:31 +00:00
Eric Fiselier 030d19bd1a Cleanup default_delete specializations
llvm-svn: 300407
2017-04-16 02:06:25 +00:00
Eric Fiselier 4727272254 Overhaul unique_ptr - Implement LWG 2801, 2905, 2520.
This patch overhauls both specializations of unique_ptr while implementing
the following LWG issues:

* LWG 2801 - This issue constrains unique_ptr's constructors when the deleter type
  is not default constructible. Additionally it adds SFINAE conditions
  to unique_ptr<T[]>::unique_ptr(Up).

* LWG 2905 - This issue reworks the unique_ptr(pointer, /* see below */ deleter)
  constructors so that they correctly SFINAE when the deleter argument cannot
  be used to construct the stored deleter.

* LWG 2520 - This issue fixes initializing unique_ptr<T[]> from nullptr.
  Libc++ had previously implemented this issue, but the suggested resolution
  still broke initialization from NULL. This patch re-works the
  unique_ptr<T[]>(Up, deleter) overloads so that they accept NULL as well
  as nullptr.

llvm-svn: 300406
2017-04-16 01:51:04 +00:00
Craig Topper 9edfb08d93 [APInt] Fix a bug in lshr by a value more than 64 bits above the bit width.
This was throwing an assert because we determined the intra-word shift amount by subtracting the size of the full word shift from the total shift amount. But we failed to account for the fact that we clipped the full word shifts by total words first. To fix this just calculate the intra-word shift as the remainder of dividing by bits per word.

llvm-svn: 300405
2017-04-16 01:03:51 +00:00
Dimitry Andric 909b3376ba Use correct registers for "A" inline asm constraint
Summary:
In PR32594, inline assembly using the 'A' constraint on x86_64 causes
llvm to crash with a "Cannot select" stack trace.  This is because
`X86TargetLowering::getRegForInlineAsmConstraint` hardcodes that 'A'
means the EAX and EDX registers.

However, on x86_64 it means the RAX and RDX registers, and on 16-bit x86
(ia16?) it means the old AX and DX registers.

Add new register classes in `X86RegisterInfo.td` to support these cases,
and amend the logic in `getRegForInlineAsmConstraint` to cope with
different subtargets.  Also add a test case, derived from PR32594.

Reviewers: craig.topper, qcolombet, RKSimon, ab

Reviewed By: ab

Subscribers: ab, emaste, royger, llvm-commits

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

llvm-svn: 300404
2017-04-15 22:15:01 +00:00
Eric Fiselier 2551475596 Implement LWG 2857 for variant. Tests from Casey Carter @ Microsoft.
Also mark LWG 2857 as complete, since the changes to optional and
any were completed by Marshall earlier.

llvm-svn: 300403
2017-04-15 19:32:02 +00:00
Sanjay Patel ef9f586bb2 [InstCombine] allow (X != C1 && X != C2) and similar patterns to match splat vector constants
llvm-svn: 300402
2017-04-15 17:55:06 +00:00
Sanjay Patel c8405b82a1 [InstCombine] add tests to show missing transforms for vectors; NFC
llvm-svn: 300401
2017-04-15 17:50:45 +00:00
Aaron Ballman 565019ff32 Add isStaticStorageClass to the dynamic matcher registry so that it can be used from clang-query.
Patch by Dave Lee.

llvm-svn: 300400
2017-04-15 12:53:20 +00:00
Eric Fiselier 2f121a722c Simplify test helper
llvm-svn: 300399
2017-04-15 12:05:11 +00:00
Tobias Grosser 1f8b84094f Update isl bindings to latest version (+ Polly extensions)
After the isl C++ binding generator is now close to being upstreamed to isl, we
synchronize the latest changes to Polly. These are mostly formatting changes
plus a small interface change for the foreach callback function and some naming
changes in isl::boolean.

llvm-svn: 300398
2017-04-15 08:15:54 +00:00
Eric Fiselier e84fcb5f3d Fix PR32642 - string::insert and string::append don't work with move_iterator.
llvm-svn: 300397
2017-04-15 06:49:02 +00:00
Akira Hatanaka 4d53a1cb31 [ObjC] Use empty Objective-C collection literal constants when
available.

Original patch by Douglas Gregor with minor modifications.

This recommits r300389, which broke bots because there have been API
changes since the original patch was written.

rdar://problem/20689633

llvm-svn: 300396
2017-04-15 06:42:00 +00:00
Eric Christopher d26d8839d8 When we turn on vsx it should also turn on altivec explicitly, same
with disabling it as well as disabling all vsx specific features when
turning off altivec.

Fixes PR32663.

llvm-svn: 300395
2017-04-15 06:15:00 +00:00
Eric Christopher 908ed7f20c Tidy checking for the soft float attribute.
llvm-svn: 300394
2017-04-15 06:14:52 +00:00
Eric Christopher 85be8ca881 Cache the DataLayout rather than looking it up frequently.
llvm-svn: 300393
2017-04-15 06:14:50 +00:00
Serge Pavlov a693b907c7 Do not run tests for crash recovery if libstdc++ safe mode is enabled
If expensive checks are enabled, safe mode of libstdc++ is enabled too.
In this mode the library uses more complex data that allow additional
checks, for instance, a container may keep list of iterators that points
to it. If a code crashes it can leave these complex library objects in
inconsistent state. It occurs in a few tests that check error recovery
if compiler crashes. These test hang in expensive check mode, as the
library tries to synchronize access to the iterators pointing to some
container, but corresponding mutex remains locked after the crash.

This fix marks these tests as unsupported if clang is built with
libstdc++ safe mode enabled.

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

llvm-svn: 300392
2017-04-15 05:53:49 +00:00
Akira Hatanaka f8a27a96e2 Revert "[ObjC] Use empty Objective-C collection literal constants when"
This reverts commit r300389. There were mistakes in the changes I made
to CodeGen.

llvm-svn: 300391
2017-04-15 05:44:27 +00:00
Eric Fiselier 9b25fb7f4b [libcxx] Fix check-cxx-abilist on OS X
Summary:
Recent commits broke the check-cxx-abilist by changing the default OS X to use `-rexport_library` instead of `-reexport_symbol_list`. Apparently `-reexport_library` doesn't export the symbols into `libc++.dylib`s symbol table, whereas `-reexport_symbol_list` does.

This means the change removed ~500 symbols from the symbol table. I've been told this change is non ABI breaking, but it does make it harder to maintain the ABI lists, and hence the ABI.

This patch fixes the issue by switching back to `-reexport_symbol_list`. It still avoid the issues fixed in r299052 by putting the new/delete symbols in a different symbol list file, which is only exported when LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS in OFF.


Reviewers: mehdi_amini, smeenai, dexonsmith

Reviewed By: smeenai

Subscribers: mgorny, cfe-commits

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

llvm-svn: 300390
2017-04-15 05:41:45 +00:00
Akira Hatanaka dad5266044 [ObjC] Use empty Objective-C collection literal constants when
available.

Original patch by Douglas Gregor with minor modifications.

rdar://problem/20689633

llvm-svn: 300389
2017-04-15 05:31:35 +00:00
Eric Fiselier 2561885f57 Rewrite and cleanup unique_ptr tests.
This patch almost entirely rewrites the unique_ptr tests. There are a couple
of reasons for this:

A) Most of the *.fail.cpp tests were either incorrect or could be better written
  as a *.pass.cpp test that uses <type_traits> to check if certain operations
  are valid (Ex. Using static_assert(!std::is_copy_constructible_v<T>) instead
  of writing a failure test).

B) [unique.ptr.runtime] has very poor test coverage. Many of the constructors
  and assignment operators have to tests at all. The special members that have
  tests have very few test cases and are typically way out of date.

C) The tests for [unique.ptr.single] and [unique.ptr.runtime] are largely
  duplicates of each other. This means common requirements have two different
  sets of tests in two different test files. This makes the tests harder to
  maintain than if there was a single copy.

To address (A) this patch changes almost all of the *.fail.cpp tests into
.pass.cpp tests using type traits; Allowing the *.fail.cpp tests to be removed.

The address (B) and (C) the tests for [unique.ptr.single] and [unique.ptr.runtime]
have been combined into a single directory, allowing both specializations to share
common tests. Tests specific to the single/runtime specializations are given the
suffix "*.single.pass.cpp" or "*.runtime.pass.cpp".

Finally the unique.ptr test have been moved into the correct directory according
to the standard. Specifically they have been removed from "utilities/memory" into
"utilities/smartptr".

PS. This patch also adds newly written tests for upcoming unique_ptr changes/fixes.
However since these tests don't currently pass they are guarded by the macro
TEST_WORKAROUND_UPCOMING_UNIQUE_PTR_CHANGES. This allows other STL's to validate
the tests before libc++ implements the changes. The relevant libc++ changes should
land in the next week.

llvm-svn: 300388
2017-04-15 05:28:06 +00:00
Eric Fiselier 73b76bcf2f Make clang-format use C++03 syntax
llvm-svn: 300387
2017-04-15 02:45:43 +00:00
Zachary Turner 426d1379b0 Fix crash when completing in the current directory.
llvm-svn: 300386
2017-04-15 02:44:53 +00:00
Davide Italiano 0eb8030369 [MachO/X86_64] Simplify isDataInCodeTransition().
llvm-svn: 300385
2017-04-15 01:50:51 +00:00
Davide Italiano 2a34b6395f [MachO/AArch64] Merge multiple switch cases into one. NFCI.
llvm-svn: 300384
2017-04-15 01:42:55 +00:00
Vedant Kumar 4afdcb0975 [profile] Sync up InstrProfData.inc (NFC)
llvm-svn: 300383
2017-04-15 00:10:33 +00:00
Vedant Kumar 8a767a430d [Coverage] Use the new getInstrProfSectionName API (NFC)
llvm-svn: 300382
2017-04-15 00:10:05 +00:00
Vedant Kumar 1a6a2b642b [ProfileData] Unify getInstrProf*SectionName helpers
This is a version of D32090 that unifies all of the
`getInstrProf*SectionName` helper functions. (Note: the build failures
which D32090 would have addressed were fixed with r300352.)

We should unify these helper functions because they are hard to use in
their current form. E.g we recently introduced more helpers to fix
section naming for COFF files. This scheme doesn't totally succeed at
hiding low-level details about section naming, so we should switch to an
API that is easier to maintain.

This is not an NFC commit because it fixes llvm-cov's testing support
for COFF files (this falls out of the API change naturally). This is an
area where we lack tests -- I will see about adding one as a follow up.

Testing: check-clang, check-profile, check-llvm.

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

llvm-svn: 300381
2017-04-15 00:09:57 +00:00
Duncan P. N. Exon Smith 03df14c6dd Modules: Do not serialize #pragma pack state
The modules side of r299226, which serializes #pragma pack state,
doesn't work well.

The main purpose was to make -include and -include-pch match semantics
(the PCH side).  We also started serializing #pragma pack in PCMs, in
the hopes of making modules and non-modules builds more consistent.  But
consider:

    $ cat a.h
    $ cat b.h
    #pragma pack(push, 2)
    $ cat module.modulemap
    module M {
        module a { header "a.h" }
        module b { header "b.h" }
    }
    $ cat t.cpp
    #include "a.h"
    #pragma pack(show)

As of r299226, the #pragma pack(show) gives "2", even though we've only
included "a.h".

- With -fmodules-local-submodule-visibility, this is clearly wrong.  We
  should get the default state (8 on x86_64).

- Without -fmodules-local-submodule-visibility, this kind of matches how
  other things work (as if include-the-whole-module), but it's still
  really terrible, and it doesn't actually make modules and non-modules
  builds more consistent.

This commit disables the serialization for modules, essentially a
partial revert of r299226.

Going forward:

 1. Having this #pragma pack stuff escape is terrible design (or, more
    often, a horrible bug).  We should prioritize adding warnings (maybe
    -Werror by default?).

 2. If we eventually reintroduce this for modules, it should only apply
    to -fmodules-local-submodule-visibility, and it should be tracked on
    a per-submodule basis.

llvm-svn: 300380
2017-04-15 00:07:57 +00:00
Sanjoy Das 044f956f9a Generalize SCEV's unit testing helper a bit
llvm-svn: 300379
2017-04-14 23:47:53 +00:00
Davide Italiano cf8a8294e5 [Interpreter] Make a static func a lambda and remove always_inline.
The attribute was fairly dubious as: a) we shouldn't tell the compiler
when to inline functions, b) GCC complains that the function may be
not always inlinable.

llvm-svn: 300377
2017-04-14 22:36:08 +00:00
Craig Topper 9a458cd517 [InstCombine] MakeAnd/Or/Xor handling to reuse previous APInt computations
When checking if we should return a constant, we create some temporary APInts to see if we know all bits. But the exact computations we do are needed in several other locations in the same code.

This patch moves them to named temporaries so we can reuse them.

Ideally we'd write directly to KnownZero/One, but we currently seem to only write those variables after all the simplifications checks and I didn't want to change that with this patch.

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

llvm-svn: 300376
2017-04-14 22:34:14 +00:00
Davide Italiano 49a28fdafb [ARM/Emulation] Remove an unneeded comparison and simplify. NFCI.
reg0 is always zero and comparison to an unsigned always yields
true.

llvm-svn: 300375
2017-04-14 22:27:28 +00:00
Chris Bieneman e0f17785f8 Fix bot breakage from r300372
Use #cmakedefine instead of #cmakedefine01 because the uses are ifndef instead of if.

llvm-svn: 300374
2017-04-14 22:20:36 +00:00
Davide Italiano 6462def06d [Process/Utility] Remove dead code. NFCI.
llvm-svn: 300373
2017-04-14 22:04:05 +00:00
Chris Bieneman b90bee044b [CMake] Support generating Config.h
Summary:
This patch removes the hand maintained config files in favor of auto-generating the config file. We will still need to maintain the defines for the Xcode builds on Mac, but all CMake builds use the generated header instead.

This will enable finer grained platform support tests and enable supporting LLDB on more platforms with less manual maintenance.

I have only tested this patch on Darwin, and any help testing it out on other platforms would be greatly appreciated. I've probably messed something up somewhere.

Reviewers: labath, zturner

Reviewed By: labath

Subscribers: krytarowski, emaste, srhines, lldb-commits, mgorny

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

llvm-svn: 300372
2017-04-14 22:03:45 +00:00
Vedant Kumar 116aebcae0 [ubsan] Don't check alignment if the alignment is 1
If a pointer is 1-byte aligned, there's no use in checking its
alignment. Somewhat surprisingly, ubsan can spend a significant amount
of time doing just that!

This loosely depends on D30283.

Testing: check-clang, check-ubsan, and a stage2 ubsan build.

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

llvm-svn: 300371
2017-04-14 22:03:37 +00:00
Vedant Kumar ffd7c887d6 [ubsan] Reduce alignment checking of C++ object pointers
This patch teaches ubsan to insert an alignment check for the 'this'
pointer at the start of each method/lambda. This allows clang to emit
significantly fewer alignment checks overall, because if 'this' is
aligned, so are its fields.

This is essentially the same thing r295515 does, but for the alignment
check instead of the null check. One difference is that we keep the
alignment checks on member expressions where the base is a DeclRefExpr.
There's an opportunity to diagnose unaligned accesses in this situation
(as pointed out by Eli, see PR32630).

Testing: check-clang, check-ubsan, and a stage2 ubsan build.

Along with the patch from D30285, this roughly halves the amount of
alignment checks we emit when compiling X86FastISel.cpp. Here are the
numbers from patched/unpatched clangs based on r298160.

  ------------------------------------------
  | Setup          | # of alignment checks |
  ------------------------------------------
  | unpatched, -O0 |                 24326 |
  | patched, -O0   |                 12717 | (-47.7%)
  ------------------------------------------

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

llvm-svn: 300370
2017-04-14 22:03:34 +00:00
Krzysztof Parzyszek 9edaea21af [RDF] No longer ignore implicit defs or uses on any instructions
This used to be a Hexagon-specific treatment, but is no longer needed
since it's switched to subregister liveness tracking.

llvm-svn: 300369
2017-04-14 21:19:17 +00:00
Krzysztof Parzyszek fabb68fc06 [RDF] Correctly enumerate reg units for reg masks
llvm-svn: 300368
2017-04-14 21:17:36 +00:00
Reid Kleckner fb502d2f5e [IR] Make paramHasAttr to use arg indices instead of attr indices
This avoids the confusing 'CS.paramHasAttr(ArgNo + 1, Foo)' pattern.

Previously we were testing return value attributes with index 0, so I
introduced hasReturnAttr() for that use case.

llvm-svn: 300367
2017-04-14 20:19:02 +00:00
Kostya Serebryany 23f28e6c75 [libFuzzer] more trophies
llvm-svn: 300366
2017-04-14 20:11:16 +00:00
Sam Clegg 135a4b8ea1 [WebAssembly] Improve readobj and nm support for wasm
Now that the libObect support for wasm is better we can
have readobj and nm produce more useful output too.

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

llvm-svn: 300365
2017-04-14 19:50:44 +00:00
Sanjay Patel 7cfe41659c [InstCombine] (X != C1 && X != C2) --> (X | (C1 ^ C2)) != C2
...when C1 differs from C2 by one bit and C1 <u C2:
http://rise4fun.com/Alive/Vuo

And move related folds to a helper function. This reduces code duplication and
will make it easier to remove the scalar-only restriction as a follow-up step.

llvm-svn: 300364
2017-04-14 19:23:50 +00:00
Craig Topper fb71b7d3e0 [InstCombine] Support folding a subtract with a constant LHS into a phi node
We currently only support folding a subtract into a select but not a PHI. This fixes that.

I had to fix an assumption in FoldOpIntoPhi that assumed the PHI node was always in operand 0. Now we pass it in like we do for FoldOpIntoSelect. But we still require some dancing to find the Constant when we create the BinOp or ConstantExpr. This is based code is similar to what we do for selects.

Since I touched all call sites, this also renames FoldOpIntoPhi to foldOpIntoPhi to match coding standards.

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

llvm-svn: 300363
2017-04-14 19:20:12 +00:00