platform/upstream/llvm.git
7 years ago[sanitizers] powerpc4 is also unsupported platform
Mike Aizatsky [Tue, 13 Dec 2016 05:21:19 +0000 (05:21 +0000)]
[sanitizers] powerpc4 is also unsupported platform

llvm-svn: 289515

7 years agoCodeGen: clean up -Wpedantic warning (NFC)
Saleem Abdulrasool [Tue, 13 Dec 2016 03:27:35 +0000 (03:27 +0000)]
CodeGen: clean up -Wpedantic warning (NFC)

  lib/CodeGen/CGExpr.cpp:2511:2: warning: extra ';' [-Wpedantic]
   };
    ^

Clean up warning from gcc 6.

llvm-svn: 289514

7 years ago[libc++abi] Mark failing test on Darwin as XFAIL
Shoaib Meenai [Tue, 13 Dec 2016 02:43:04 +0000 (02:43 +0000)]
[libc++abi] Mark failing test on Darwin as XFAIL

The macOS thread-local variable finalizer routines do not handle the
case where a termination function registers another termination function
correctly, causing this test to fail. I've filed a radar for this;
mark the test XFAIL in the meantime. See [1] for more details.

[1] http://lists.llvm.org/pipermail/cfe-dev/2016-November/051376.html

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

llvm-svn: 289513

7 years ago[libcxx] [test] Fix size_t-to-int truncation warnings in syserr.hash.
Stephan T. Lavavej [Tue, 13 Dec 2016 01:54:58 +0000 (01:54 +0000)]
[libcxx] [test] Fix size_t-to-int truncation warnings in syserr.hash.

After r289363, these tests were triggering MSVC x64 warning C4267
"conversion from 'size_t' to 'int', possible loss of data" by taking 0, 2, and 10
as std::size_t, then constructing error_code(int, const error_category&) or
error_condition(int, const error_category&) from that (N4618 19.5.3.2
[syserr.errcode.constructors]/3, 19.5.4.2 [syserr.errcondition.constructors]/3).

The fix is simple: take these ints as int, pass them to the int-taking
constructor, and perform a value-preserving static_cast<std::size_t>
when comparing them to `std::size_t result`.

Fixes D27691.

llvm-svn: 289512

7 years ago[analyzer] Run clang-format and fix style
Dominic Chen [Tue, 13 Dec 2016 01:40:41 +0000 (01:40 +0000)]
[analyzer] Run clang-format and fix style

Summary: Split out formatting and style changes from D26061

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

llvm-svn: 289511

7 years ago[peephole] Enhance folding logic to work for STATEPOINTs
Philip Reames [Tue, 13 Dec 2016 01:38:41 +0000 (01:38 +0000)]
[peephole] Enhance folding logic to work for STATEPOINTs

The general idea here is to get enough of the existing restrictions out of the way that the already existing folding logic in foldMemoryOperand can kick in for STATEPOINTs and fold references to immutable stack slots. The key changes are:

    Support for folding multiple operands at once which reference the same load
    Support for folding multiple loads into a single instruction
    Walk all the operands of the instruction for varidic instructions (this is a bug fix!)

Once this lands, I'll post another patch which refactors the TII interface here. There's nothing actually x86 specific about the x86 code used here.

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

llvm-svn: 289510

7 years ago[Statepoints] Reuse stack slots more than once within a basic block
Philip Reames [Tue, 13 Dec 2016 01:21:15 +0000 (01:21 +0000)]
[Statepoints] Reuse stack slots more than once within a basic block

The stack slot reuse code had a really amusing bug. We ended up only reusing a stack slot exact once (initial use + reuse) within a basic block. If we had a third statepoint to process, we ended up allocating a new set of stack slots. If we crossed a basic block boundary, the set got cleared. As a result, code which is invoke heavy doesn't see the problem, but multiple calls within a basic block does. Net result: as we optimize invokes into calls, lowering gets worse.

The root error here is that the bitmap uses by the custom allocator wasn't kept in sync. The result was that we ended up resizing the bitmap on the next statepoint (to handle the cross block case), reset the bit once, but then never reset it again.

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

llvm-svn: 289509

7 years ago[sanitizers] disabling dso test as well where appropriate
Mike Aizatsky [Tue, 13 Dec 2016 01:11:46 +0000 (01:11 +0000)]
[sanitizers] disabling dso test as well where appropriate

llvm-svn: 289508

7 years ago[sanitizers] trace-pc-guard doesn't work on mac as well
Mike Aizatsky [Tue, 13 Dec 2016 01:10:21 +0000 (01:10 +0000)]
[sanitizers] trace-pc-guard doesn't work on mac as well

fatal error: error in backend: Global variable '__sancov_gen_' has an
invalid section specifier '__sancov_guards': mach-o section specifier
requires a segment and section separated by a comma.

llvm-svn: 289507

7 years ago[libFuzzer] don't require extra flags with -minimize_crash=1 (default to -max_total_t...
Kostya Serebryany [Tue, 13 Dec 2016 00:40:47 +0000 (00:40 +0000)]
[libFuzzer] don't require extra flags with -minimize_crash=1 (default to -max_total_time=600). Also respect exact_artifact_path when outputting the end result

llvm-svn: 289506

7 years ago[sanitizers] sancov really works on x86 only
Mike Aizatsky [Tue, 13 Dec 2016 00:34:33 +0000 (00:34 +0000)]
[sanitizers] sancov really works on x86 only

llvm-svn: 289505

7 years agoMissed a file in r289503.
Chris Bieneman [Tue, 13 Dec 2016 00:32:43 +0000 (00:32 +0000)]
Missed a file in r289503.

llvm-svn: 289504

7 years ago[LIT] Fix system-windows
Chris Bieneman [Tue, 13 Dec 2016 00:29:56 +0000 (00:29 +0000)]
[LIT] Fix system-windows

Turns out if you were on windows and your default target wasn't windows the system-windows feature wasn't getting enabled.

This fixes that and updates the coff-dwarf test to rely on the new "target-windows" feature. That test was the reason why system-windows was changed to not always be enabled on Windows hosts.

llvm-svn: 289503

7 years agoRevert "Suppress LLVM::tools/llvm-symbolizer/coff-dwarf.test for mingw, for now."
Chris Bieneman [Tue, 13 Dec 2016 00:29:51 +0000 (00:29 +0000)]
Revert "Suppress LLVM::tools/llvm-symbolizer/coff-dwarf.test for mingw, for now."

This reverts commit r249937.

llvm-svn: 289502

7 years ago[XRay][compiler-rt] Use explicit comparisons in unit tests.
Dean Michael Berris [Tue, 13 Dec 2016 00:17:31 +0000 (00:17 +0000)]
[XRay][compiler-rt] Use explicit comparisons in unit tests.

Summary:
This should improve the error messages generated providing a bit more
information when the failures are printed out. One example of a
contrived error looks like:

```
Expected: (Buffers.getBuffer(Buf)) != (std::error_code()), actual:
system:0 vs system:0
```

Because we're using error codes, the default printing gets us more
useful information in case of failure.

This is a follow-up on D26232.

Reviewers: rSerge

Subscribers: llvm-commits

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

llvm-svn: 289501

7 years agoSimplify the test. NFC.
Rafael Espindola [Mon, 12 Dec 2016 23:52:21 +0000 (23:52 +0000)]
Simplify the test. NFC.

llvm-svn: 289499

7 years ago[sancov] __sanitizer_dump_coverage api
Mike Aizatsky [Mon, 12 Dec 2016 23:45:38 +0000 (23:45 +0000)]
[sancov] __sanitizer_dump_coverage api

Subscribers: kubabrecka, mgorny

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

llvm-svn: 289498

7 years ago[llvm-config] Unsupported should be win32
Chris Bieneman [Mon, 12 Dec 2016 23:42:08 +0000 (23:42 +0000)]
[llvm-config] Unsupported should be win32

Hopefully this will fix the failing Windows bot.

llvm-svn: 289497

7 years agoStop lying about pointers' required alignments.
Tim Northover [Mon, 12 Dec 2016 23:29:07 +0000 (23:29 +0000)]
Stop lying about pointers' required alignments.

These extra specializations were added in the depths of history (r67984 from
2009) and are clearly problematic now. The pointers actually are aligned to the
default (8 bytes), since otherwise UBsan would be complaining loudly.

I *think* it originally made sense because there was no "alignof" to infer the
correct value so the generic case went with what malloc returned (8-byte
aliged objects), and on 32-bit machines this specialization was correct. It
became wrong when we started compiling for 64-bit, and caused a UBSan failure
when we tried to put a ValueHandle into a DenseMap.

Should fix the Green Dragon UBSan bot.

llvm-svn: 289496

7 years ago[libFuzzer] Implement Timers for Windows.
Marcos Pividori [Mon, 12 Dec 2016 23:25:11 +0000 (23:25 +0000)]
[libFuzzer] Implement Timers for Windows.

Implemented timeouts for Windows using TimerQueueTimers.
Timers are used to supervise the time of execution of the
callback function that is being fuzzed.

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

llvm-svn: 289495

7 years agoRevert "[Modules] Make header inclusion order from umbrella dirs deterministic"
Bruno Cardoso Lopes [Mon, 12 Dec 2016 23:22:30 +0000 (23:22 +0000)]
Revert "[Modules] Make header inclusion order from umbrella dirs deterministic"

Reverts commit r289478.

This broke
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/2070
(and maybe
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/2246)

llvm-svn: 289494

7 years ago[x86] fix test specifications
Sanjay Patel [Mon, 12 Dec 2016 23:16:35 +0000 (23:16 +0000)]
[x86] fix test specifications

llvm-svn: 289493

7 years ago[x86] fix test specifications and auto-generate checks
Sanjay Patel [Mon, 12 Dec 2016 23:15:15 +0000 (23:15 +0000)]
[x86] fix test specifications and auto-generate checks

llvm-svn: 289492

7 years ago[CMake] Multi-target builtins build
Petr Hosek [Mon, 12 Dec 2016 23:15:10 +0000 (23:15 +0000)]
[CMake] Multi-target builtins build

This change enables building builtins for multiple different targets
using LLVM runtimes directory.

To specify the builtin targets to be built, use the LLVM_BUILTIN_TARGETS
variable, where the value is the list of targets.  To pass a per target
variable to the builtin build, you can set BUILTINS_<target>_<variable>
where <variable> will be passed to the builtin build for <target>.

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

llvm-svn: 289491

7 years agoRevert "Disable all llvm-config tests for now, will investigate later"
Chris Bieneman [Mon, 12 Dec 2016 23:14:58 +0000 (23:14 +0000)]
Revert "Disable all llvm-config tests for now, will investigate later"

This reverts commit r260386.

These tests all pass for me locally. I have no idea if they will pass on all configurations, so I'll watch the bots closely.

llvm-svn: 289490

7 years ago[compiler-rt] Support building builtins for a single target
Petr Hosek [Mon, 12 Dec 2016 23:14:02 +0000 (23:14 +0000)]
[compiler-rt] Support building builtins for a single target

This is used when building builtins for multiple targets as part
of LLVM runtimes.

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

llvm-svn: 289489

7 years ago[llvm-config] Fix bug where `--libfiles` and `--names` would produce
Dan Liew [Mon, 12 Dec 2016 23:07:22 +0000 (23:07 +0000)]
[llvm-config] Fix bug where `--libfiles` and `--names` would produce
incorrect output when LLVM is built with `LLVM_BUILD_LLVM_DYLIB`.

`llvm-config` previously produced output like this

```
$ llvm-config --libfiles
/usr/lib/liblibLLVM-4.0svn.so.so
$ llvm-config --libnames
liblibLLVM-4.0svn.so.so
```

The library prefix and shared library extension were added to
the library name twice which was wrong.

I wanted to write a test cases for this but it looks like **all**
`llvm-config` tests were disabled by r260386 so I'll leave this for
now.

Subscribers: llvm-commits, tstellarAMD

Reviewers: beanz, DiamondLovesYou, axw

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

llvm-svn: 289488

7 years agoRevert "[Headers] Add #include_next for tgmath.h on Darwin"
Bruno Cardoso Lopes [Mon, 12 Dec 2016 23:06:58 +0000 (23:06 +0000)]
Revert "[Headers] Add #include_next for tgmath.h on Darwin"

Reverts r289181: it's currently breaking modules using simd.h in
10.12 SDK.

This reverts commit 6e73e3464e96a4e00492c24aa790d36e1adb5702.

llvm-svn: 289487

7 years agoAvoid infinite loops in branch folding
Andrew Kaylor [Mon, 12 Dec 2016 23:05:38 +0000 (23:05 +0000)]
Avoid infinite loops in branch folding

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

llvm-svn: 289486

7 years agoclang-format to fix post-commit feedback
Chris Bieneman [Mon, 12 Dec 2016 23:05:15 +0000 (23:05 +0000)]
clang-format to fix post-commit feedback

Thanks dblaikie!

llvm-svn: 289485

7 years ago[llvm-config] Fix cflags test looking for "error"
Chris Bieneman [Mon, 12 Dec 2016 23:03:28 +0000 (23:03 +0000)]
[llvm-config] Fix cflags test looking for "error"

This test is (I think) actually trying to make sure no errors are printed, but it hits on the string "error" in flags.

llvm-svn: 289484

7 years agoRevert "Remove system-libs.test for now"
Chris Bieneman [Mon, 12 Dec 2016 23:03:01 +0000 (23:03 +0000)]
Revert "Remove system-libs.test for now"

This reverts commit r260281.

llvm-svn: 289483

7 years agoRevert "[SCEVExpander] Use llvm data structures; NFC"
Sanjoy Das [Mon, 12 Dec 2016 23:00:12 +0000 (23:00 +0000)]
Revert "[SCEVExpander] Use llvm data structures; NFC"

This reverts r289215 (git SHA1 cb7b86a1).  It breaks the ubsan build
because a DenseMap that keys off of `AssertingVH<T>` will hit UB when it
tries to cast the empty and tombstone keys to `T *` (due to insufficient
alignment).

This is the relevant stack trace (thanks to Mike Aizatsky):

    #0 0x25cf100 in llvm::AssertingVH<llvm::PHINode>::getValPtr() const llvm/include/llvm/IR/ValueHandle.h:212:39
    #1 0x25cea20 in llvm::AssertingVH<llvm::PHINode>::operator=(llvm::AssertingVH<llvm::PHINode> const&) llvm/include/llvm/IR/ValueHandle.h:234:19
    #2 0x25d0092 in llvm::DenseMapBase<llvm::DenseMap<llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >, llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >::clear() llvm/include/llvm/ADT/DenseMap.h:113:23

llvm-svn: 289482

7 years ago[libFuzzer] split one slow test into several, for more parallel testing
Kostya Serebryany [Mon, 12 Dec 2016 22:55:25 +0000 (22:55 +0000)]
[libFuzzer] split one slow test into several, for more parallel testing

llvm-svn: 289481

7 years agoFix MSVC build after 289461; MSVC isn't sure if this is std:: or llvm::
Nico Weber [Mon, 12 Dec 2016 22:46:40 +0000 (22:46 +0000)]
Fix MSVC build after 289461; MSVC isn't sure if this is std:: or llvm::

llvm-svn: 289480

7 years agoRemoving myself from code ownership file
Todd Fiala [Mon, 12 Dec 2016 22:42:00 +0000 (22:42 +0000)]
Removing myself from code ownership file

I'm transitioning away from my current employer, and I do not foresee myself
spending much time on LLDB in the near future. Ideally somebody on the Google
Android team takes over the gdb-remote protocol tests, and somebody with decent
familiarity with the test suite infrastructure takes over the parallel test
runner and test event stream portions of the Python test suite.

llvm-svn: 289479

7 years ago[Modules] Make header inclusion order from umbrella dirs deterministic
Bruno Cardoso Lopes [Mon, 12 Dec 2016 22:41:20 +0000 (22:41 +0000)]
[Modules] Make header inclusion order from umbrella dirs deterministic

Sort the headers by name before adding the includes in
collectModuleHeaderIncludes. This makes the include order for building
umbrellas deterministic across different filesystems and also guarantees
that the ASTWriter always dump top headers in the same order.

There's currently no good way to test for this behavior.

rdar://problem/28116411

llvm-svn: 289478

7 years ago[libFuzzer] make SimpleCmpTest a bit simpler to crack and more verbose
Kostya Serebryany [Mon, 12 Dec 2016 22:39:33 +0000 (22:39 +0000)]
[libFuzzer] make  SimpleCmpTest a bit simpler to crack and more verbose

llvm-svn: 289477

7 years ago[x86] fix formatting; NFC
Sanjay Patel [Mon, 12 Dec 2016 22:31:01 +0000 (22:31 +0000)]
[x86] fix formatting; NFC

llvm-svn: 289476

7 years ago[AMDGPU, PowerPC, TableGen] Fix some Clang-tidy modernize and Include What You Use...
Eugene Zelenko [Mon, 12 Dec 2016 22:23:53 +0000 (22:23 +0000)]
[AMDGPU, PowerPC, TableGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 289475

7 years ago[APFloatTest] Use std::make_tuple to make GCC 4.8 happy
Tim Shen [Mon, 12 Dec 2016 22:16:08 +0000 (22:16 +0000)]
[APFloatTest] Use std::make_tuple to make GCC 4.8 happy

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

llvm-svn: 289474

7 years ago[PPC] Prefer direct move on power8 if load 1 or 2 bytes to VSR
Guozhi Wei [Mon, 12 Dec 2016 22:09:02 +0000 (22:09 +0000)]
[PPC] Prefer direct move on power8 if load 1 or 2 bytes to VSR

Power8 has MTVSRWZ but no LXSIBZX/LXSIHZX, so move 1 or 2 bytes to VSR through MTVSRWZ is much faster than store the extended value into stack and load it with LXSIWZX.
This patch fixes pr31144.

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

llvm-svn: 289473

7 years ago[APFloat] Implement PPCDoubleDouble add and subtract.
Tim Shen [Mon, 12 Dec 2016 21:59:30 +0000 (21:59 +0000)]
[APFloat] Implement PPCDoubleDouble add and subtract.

Summary:
I looked at libgcc's implementation (which is based on the paper,
Software for Doubled-Precision Floating-Point Computations", by Seppo Linnainmaa,
ACM TOMS vol 7 no 3, September 1981, pages 272-283.) and made it generic to
arbitrary IEEE floats.

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

llvm-svn: 289472

7 years ago[ELF][MIPS] Calculate default _gp value relative to the GPREL section with the lowest...
Simon Atanasyan [Mon, 12 Dec 2016 21:34:11 +0000 (21:34 +0000)]
[ELF][MIPS] Calculate default _gp value relative to the GPREL section with the lowest address

llvm-svn: 289471

7 years ago[SLP] Fix sign-extends for type-shrinking
Matthew Simpson [Mon, 12 Dec 2016 21:11:04 +0000 (21:11 +0000)]
[SLP] Fix sign-extends for type-shrinking

This patch ensures the correct minimum bit width during type-shrinking.
Previously when type-shrinking, we always sign-extended values back to their
original width. However, if we are going to sign-extend, and the sign bit is
unknown, we have to increase the minimum bit width by one bit so the
sign-extend will fill the upper bits correctly. If the sign bit is known to be
zero, we can perform a zero-extend instead. This should fix PR31243.

Reference: https://llvm.org/bugs/show_bug.cgi?id=31243
Differential Revision: https://reviews.llvm.org/D27466

llvm-svn: 289470

7 years ago[libFuzzer] build libFuzzer itself with asan
Kostya Serebryany [Mon, 12 Dec 2016 20:58:10 +0000 (20:58 +0000)]
[libFuzzer] build libFuzzer itself with asan

llvm-svn: 289469

7 years agoRecommit r288212: Emit 'no line' information for interesting 'orphan' instructions.
Paul Robinson [Mon, 12 Dec 2016 20:49:11 +0000 (20:49 +0000)]
Recommit r288212: Emit 'no line' information for interesting 'orphan' instructions.

DWARF specifies that "line 0" really means "no appropriate source
location" in the line table.  By default, use this for branch targets
and some other cases that have no specified source location, to
prevent inheriting unfortunate line numbers from physically preceding
instructions (which might be from completely unrelated source).

Updated patch allows enabling or suppressing this behavior for all
unspecified source locations.

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

llvm-svn: 289468

7 years ago[libFuzzer] respect -max_len during merge
Kostya Serebryany [Mon, 12 Dec 2016 20:39:35 +0000 (20:39 +0000)]
[libFuzzer] respect -max_len during merge

llvm-svn: 289467

7 years ago[ThinLTO] Remove useless code (NFC)
Teresa Johnson [Mon, 12 Dec 2016 20:34:28 +0000 (20:34 +0000)]
[ThinLTO] Remove useless code (NFC)

Should have been removed in r288446.

llvm-svn: 289466

7 years ago[clang-move] Fix buildbot failures
Alexander Shaposhnikov [Mon, 12 Dec 2016 20:24:44 +0000 (20:24 +0000)]
[clang-move] Fix buildbot failures

Fix the buildbot failures introduced by D27669

llvm-svn: 289465

7 years ago[clang-move] Use appendArgumentsAdjuster for adding extra arguments
Alexander Shaposhnikov [Mon, 12 Dec 2016 19:56:37 +0000 (19:56 +0000)]
[clang-move] Use appendArgumentsAdjuster for adding extra arguments

1. Remove some boilerplate code for appending -fparse-all-comments to the list of arguments.
2. Run clang-format -i against ClangMoveMain.cpp.

Test plan: make check-all

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

llvm-svn: 289464

7 years ago[libcxx] [test] Change ifstream constructor tests to handle read-only files.
Stephan T. Lavavej [Mon, 12 Dec 2016 19:50:22 +0000 (19:50 +0000)]
[libcxx] [test] Change ifstream constructor tests to handle read-only files.

Certain source control systems like to set the read-only bit on their files,
which interferes with opening "test.dat" for both input and output.
Fortunately, we can work around this without losing test coverage.
Now, the ifstream.cons tests have comments referring to the ofstream.cons tests.
There, we're creating writable files (not checked into source control),
where the ifstream constructor tests will succeed.

Fixes D26814.

llvm-svn: 289463

7 years ago[libcxx] [test] Fix an improper assumption about Null Forward Iterators.
Stephan T. Lavavej [Mon, 12 Dec 2016 19:50:14 +0000 (19:50 +0000)]
[libcxx] [test] Fix an improper assumption about Null Forward Iterators.

Value-initialized iterators still can't be compared to those with parents.

Fixes D26626.

llvm-svn: 289462

7 years agoRefactor BitcodeReader: move Metadata and ValueId handling in their own class/file
Mehdi Amini [Mon, 12 Dec 2016 19:34:26 +0000 (19:34 +0000)]
Refactor BitcodeReader: move Metadata and ValueId handling in their own class/file

Summary:
I'm planning on changing the way we load metadata to enable laziness.
I'm getting lost in this gigantic files, and gigantic class that is the bitcode
reader. This is a first toward splitting it in a few coarse components that
are more easily understandable.

Reviewers: pcc, tejohnson

Subscribers: mgorny, llvm-commits, dexonsmith

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

llvm-svn: 289461

7 years ago[CrashReproducer] Collect PCH included via -include-pch
Bruno Cardoso Lopes [Mon, 12 Dec 2016 19:28:25 +0000 (19:28 +0000)]
[CrashReproducer] Collect PCH included via -include-pch

Collect the necessary input PCH files.

Do not try to validate the AST before copying it out because if the
crash is in this path, we won't be able to collect it. Instead only
check if it's a file containg an AST.

rdar://problem/27913709

llvm-svn: 289460

7 years ago[Frontend] Use vfs for directory iteration while searching PCHs. NFCI
Bruno Cardoso Lopes [Mon, 12 Dec 2016 19:28:21 +0000 (19:28 +0000)]
[Frontend] Use vfs for directory iteration while searching PCHs. NFCI

Use the vfs lookup instead of real filesytem and handle the case where
-include-pch is a directory and this dir is searched for a PCH.

llvm-svn: 289459

7 years agoFix typo and remove unnecessary statement.
Samuel Antao [Mon, 12 Dec 2016 19:26:31 +0000 (19:26 +0000)]
Fix typo and remove unnecessary statement.

llvm-svn: 289458

7 years agoRemove IsMetadataMaterialized from BitcodeReader (NFC)
Mehdi Amini [Mon, 12 Dec 2016 19:23:39 +0000 (19:23 +0000)]
Remove IsMetadataMaterialized from BitcodeReader (NFC)

Summary: It does not seem useful.

Reviewers: pcc, dexonsmith

Subscribers: llvm-commits

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

llvm-svn: 289457

7 years ago[LiveRangeEdit] Add assert string and descriptive comment.
Geoff Berry [Mon, 12 Dec 2016 19:12:41 +0000 (19:12 +0000)]
[LiveRangeEdit] Add assert string and descriptive comment.

llvm-svn: 289456

7 years agoBring back note about not supporting global register variables.
Michael Kuperstein [Mon, 12 Dec 2016 19:11:39 +0000 (19:11 +0000)]
Bring back note about not supporting global register variables.

This was accidentally removed in r260506, even though we only support
non-allocatable global register variables. The general (allocatable) case
is explicitly not supported.

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

llvm-svn: 289455

7 years agoFix compile with GCC 5 or later
Dimitry Andric [Mon, 12 Dec 2016 19:05:52 +0000 (19:05 +0000)]
Fix compile with GCC 5 or later

Summary:

Compiling with GCC 5 or later can fail with a bogus error "constructor
required before non-static data member for
llvm::ValueEnumerator::MDRange::First has been parsed".

This was originally fixed upstream in GCC PR 70528, but later this fix
was reverted, and released versions of GCC still show the bogus error.

To work around this, replace MDRange's declaration of a default
constructor with a definition.

Reviewers: dexonsmith, rsmith, rivanvx

Subscribers: llvm-commits, dim, dexonsmith

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

llvm-svn: 289454

7 years agoRevert "[SCEVExpand] do not hoist divisions by zero (PR30935)"
Reid Kleckner [Mon, 12 Dec 2016 18:52:32 +0000 (18:52 +0000)]
Revert "[SCEVExpand] do not hoist divisions by zero (PR30935)"

Reverts r289412. It caused an OOB PHI operand access in instcombine when
ASan is enabled. Reduction in progress.

Also reverts "[SCEVExpander] Add a test case related to r289412"

llvm-svn: 289453

7 years agoAvoid use of std::to_string. NFC.
Vedant Kumar [Mon, 12 Dec 2016 18:47:33 +0000 (18:47 +0000)]
Avoid use of std::to_string. NFC.

Apparently this routine isn't available on some Android platforms. See
the mailing list thread re: D21695.

llvm-svn: 289452

7 years agoCOFF: Fix memory leaks reported by lsan.
Peter Collingbourne [Mon, 12 Dec 2016 18:42:09 +0000 (18:42 +0000)]
COFF: Fix memory leaks reported by lsan.

llvm-svn: 289451

7 years agoFix format and a few typos in comments.
Samuel Antao [Mon, 12 Dec 2016 18:00:20 +0000 (18:00 +0000)]
Fix format and a few typos in comments.

llvm-svn: 289450

7 years agosymbolizer: Add lseek64 to global symbol list.
Peter Collingbourne [Mon, 12 Dec 2016 17:55:40 +0000 (17:55 +0000)]
symbolizer: Add lseek64 to global symbol list.

llvm-svn: 289449

7 years ago[mips] For PIC code convert unconditional jump to unconditional branch
Simon Atanasyan [Mon, 12 Dec 2016 17:40:26 +0000 (17:40 +0000)]
[mips] For PIC code convert unconditional jump to unconditional branch

Unconditional branch uses relative addressing which is the right choice
in case of position independent code.

This is a fix for the bug:
https://dmz-portal.mips.com/bugz/show_bug.cgi?id=2445

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

llvm-svn: 289448

7 years agoAMDGPU: llvm.amdgcn.interp.mov is a source of divergence
Nicolai Haehnle [Mon, 12 Dec 2016 16:52:19 +0000 (16:52 +0000)]
AMDGPU: llvm.amdgcn.interp.mov is a source of divergence

Summary:
While the result is constant across a single primitive, each pixel
shader wave can have pixels from multiple primitives.

Reviewers: tstellarAMD, arsenm

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 289447

7 years ago[Fix] Add missing include from r289444.
Filipe Cabecinhas [Mon, 12 Dec 2016 16:43:40 +0000 (16:43 +0000)]
[Fix] Add missing include from r289444.

llvm-svn: 289446

7 years agoremove stale FIXME note from test; NFC
Sanjay Patel [Mon, 12 Dec 2016 16:20:21 +0000 (16:20 +0000)]
remove stale FIXME note from test; NFC

llvm-svn: 289445

7 years ago[clang] Version support for UBSan handlers
Filipe Cabecinhas [Mon, 12 Dec 2016 16:18:40 +0000 (16:18 +0000)]
[clang] Version support for UBSan handlers

This adds a way for us to version any UBSan handler by itself.
The patch overrides D21289 for a better implementation (we're able to
rev up a single handler).

After this, then we can land a slight modification of D19667+D19668.

We probably don't want to keep all the versions in compiler-rt (maybe we
want to deprecate on one release and remove the old handler on the next
one?), but with this patch we will loudly fail to compile when mixing
incompatible handler calls, instead of silently compiling and then
providing bad error messages.

Reviewers: kcc, samsonov, rsmith, vsk

Subscribers: cfe-commits

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

llvm-svn: 289444

7 years ago[X86] Regenerate vector bitcast/widening tests.
Simon Pilgrim [Mon, 12 Dec 2016 16:15:45 +0000 (16:15 +0000)]
[X86] Regenerate vector bitcast/widening tests.

llvm-svn: 289443

7 years ago[InstCombine] fix bug when offsetting case values of a switch (PR31260)
Sanjay Patel [Mon, 12 Dec 2016 16:13:52 +0000 (16:13 +0000)]
[InstCombine] fix bug when offsetting case values of a switch (PR31260)

We could truncate the condition and then try to fold the add into the
original condition value causing wrong case constants to be used.

Move the offset transform ahead of the truncate transform and return
after each transform, so there's no chance of getting confused values.

Fix for:
https://llvm.org/bugs/show_bug.cgi?id=31260

llvm-svn: 289442

7 years ago[ThinLTO] Import only necessary DICompileUnit fields
Teresa Johnson [Mon, 12 Dec 2016 16:09:30 +0000 (16:09 +0000)]
[ThinLTO] Import only necessary DICompileUnit fields

Summary:
As discussed on mailing list, for ThinLTO importing we don't need
to import all the fields of the DICompileUnit. Don't import enums,
macros, retained types lists. Also only import local scoped imported
entities. Since we don't currently import any global variables,
we also don't need to import the list of global variables (added an
assert to verify none are being imported).

This is being done by pre-populating the value map entries to map
the unneeded metadata to nullptr. For the imported entities, we can
simply replace the source module's list with a new list containing
only those needed imported entities. This is done in the IRLinker
constructor so that value mapping automatically does the desired
mapping.

Reviewers: mehdi_amini, dexonsmith, dblaikie, aprantl

Subscribers: llvm-commits

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

llvm-svn: 289441

7 years ago[Driver] Attempt to fix new linux-ld tests on Windows
Michal Gorny [Mon, 12 Dec 2016 16:04:37 +0000 (16:04 +0000)]
[Driver] Attempt to fix new linux-ld tests on Windows

(broken by r289436)

llvm-svn: 289440

7 years ago[InstCombine] clean up range-for-loops in visitSwitchInst(); NFCI
Sanjay Patel [Mon, 12 Dec 2016 15:52:56 +0000 (15:52 +0000)]
[InstCombine] clean up range-for-loops in visitSwitchInst(); NFCI

llvm-svn: 289439

7 years ago[X86] Regenerate test.
Simon Pilgrim [Mon, 12 Dec 2016 15:47:53 +0000 (15:47 +0000)]
[X86] Regenerate test.

llvm-svn: 289438

7 years ago[InstCombine] add test to show PR31260 miscompile; NFC
Sanjay Patel [Mon, 12 Dec 2016 15:28:44 +0000 (15:28 +0000)]
[InstCombine] add test to show PR31260 miscompile; NFC

llvm-svn: 289437

7 years ago[Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)
Michal Gorny [Mon, 12 Dec 2016 15:07:43 +0000 (15:07 +0000)]
[Driver] Fix finding multilib gcc install on Gentoo (with gcc-config)

Fix the gcc-config code to support multilib gcc installs properly. This
solves two problems: -mx32 using the 64-bit gcc directory (due to matching
installation triple), and -m32 not respecting gcc-config at all (due to
mismatched installation triple).

In order to fix the former issue, split the multilib scan out of
Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple() (the code
is otherwise unchanged), and call it for each installation found via
gcc-config.

In order to fix the latter issue, split the gcc-config processing out of
Generic_GCC::GCCInstallationDetector::init() and repeat it for all
triples, including extra and biarch triples. The only change
in the gcc-config code itself is adding the call to multilib scan.

Convert the gentoo_linux_gcc_multi_version_tree test input to multilib
x86_64+32+x32 install, and add appropriate tests to linux-header-search
and linux-ld.

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

llvm-svn: 289436

7 years ago[SCEVExpander] Add a test case related to r289412
Sanjoy Das [Mon, 12 Dec 2016 14:57:11 +0000 (14:57 +0000)]
[SCEVExpander] Add a test case related to r289412

llvm-svn: 289435

7 years ago[ScheduleOptimizer] Fix memory leak. NFC.
Michael Kruse [Mon, 12 Dec 2016 14:51:06 +0000 (14:51 +0000)]
[ScheduleOptimizer] Fix memory leak. NFC.

llvm-svn: 289434

7 years agoUse function_ref to avoid allocation in std::function. NFC.
Benjamin Kramer [Mon, 12 Dec 2016 14:41:19 +0000 (14:41 +0000)]
Use function_ref to avoid allocation in std::function. NFC.

llvm-svn: 289433

7 years ago[ELF][MIPS] Fix .MIPS.options ri_gp_value on MIPS64
Simon Atanasyan [Mon, 12 Dec 2016 14:30:18 +0000 (14:30 +0000)]
[ELF][MIPS] Fix .MIPS.options ri_gp_value on MIPS64

The VA of _gp was being truncated to 32 bits when calling getVa(), but
for 64bit MIPS we need to write a 64 bit value to .MIPS.options.

Patch by Alexander Richardson.

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

llvm-svn: 289432

7 years ago[StaticAnalysis] Remove unnecessary parameter in CallGraphNode::addCallee.
Haojian Wu [Mon, 12 Dec 2016 14:12:10 +0000 (14:12 +0000)]
[StaticAnalysis] Remove unnecessary parameter in CallGraphNode::addCallee.

Summary:
Remove the CallGraph in addCallee as it is not used in addCallee.
It decouples addCallee from CallGraph, so that we can use CallGraphNode
within our customized CallGraph.

Reviewers: bkramer

Subscribers: cfe-commits, ioeric

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

llvm-svn: 289431

7 years agoUpdate inline argument comment. NFCI.
Simon Pilgrim [Mon, 12 Dec 2016 13:43:15 +0000 (13:43 +0000)]
Update inline argument comment. NFCI.

combineX86ShufflesRecursively 'HasPSHUFB' flag has been the more generic 'HasVariableMask' flag for some time.

llvm-svn: 289430

7 years ago[X86][SSE] Add support for combining SSE VSHLI/VSRLI uniform constant shifts.
Simon Pilgrim [Mon, 12 Dec 2016 13:33:58 +0000 (13:33 +0000)]
[X86][SSE] Add support for combining SSE VSHLI/VSRLI uniform constant shifts.

Fixes some missed constant folding opportunities and allows us to combine shuffles that end with a logical bit shift.

llvm-svn: 289429

7 years agoclang-format: Separate out a language kind for ObjC.
Daniel Jasper [Mon, 12 Dec 2016 12:42:29 +0000 (12:42 +0000)]
clang-format: Separate out a language kind for ObjC.

While C(++) and ObjC are generally formatted the same way and can be
mixed, people might want to choose different styles based on the
language. This patch recognizes .m and .mm files as ObjC and also
implements a very crude detection of whether or not a .h file contains
ObjC code. This can be improved over time.

Also move most of the ObjC tests into their own test file to keep file
size maintainable.

llvm-svn: 289428

7 years agoRemove some annotations from TestMultipleTargets
Pavel Labath [Mon, 12 Dec 2016 11:37:42 +0000 (11:37 +0000)]
Remove some annotations from TestMultipleTargets

The test passes on linux. The i386 case is already handled by
skipIfHostIncompatibleWithRemote.

llvm-svn: 289427

7 years ago[X86][SSE] Lower suitably sign-extended mul vXi64 using PMULDQ
Simon Pilgrim [Mon, 12 Dec 2016 10:49:15 +0000 (10:49 +0000)]
[X86][SSE] Lower suitably sign-extended mul vXi64 using PMULDQ

PMULDQ returns the 64-bit result of the signed multiplication of the lower 32-bits of vXi64 vector inputs, we can lower with this if the sign bits stretch that far.

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

llvm-svn: 289426

7 years ago[SelectionDAG] Add support for EXTRACT_SUBVECTOR to ComputeNumSignBits
Simon Pilgrim [Mon, 12 Dec 2016 10:29:43 +0000 (10:29 +0000)]
[SelectionDAG] Add support for EXTRACT_SUBVECTOR to ComputeNumSignBits

Pre-commit as discussed on D27657

llvm-svn: 289425

7 years ago[X86] Teach selectScalarSSELoad to accept full 128-bit vector loads and the X86ISD...
Craig Topper [Mon, 12 Dec 2016 07:57:24 +0000 (07:57 +0000)]
[X86] Teach selectScalarSSELoad to accept full 128-bit vector loads and the X86ISD::VZEXT_LOAD opcode.

Disable peephole on some of the tests that no longer require it to properly fold scalar intrinsics.

llvm-svn: 289424

7 years ago[X86] Change CMPSS/CMPSD intrinsic instructions to use sse_load_f32/f64 as its memory...
Craig Topper [Mon, 12 Dec 2016 07:57:21 +0000 (07:57 +0000)]
[X86] Change CMPSS/CMPSD intrinsic instructions to use sse_load_f32/f64 as its memory pattern instead of full vector load.

These intrinsics only load a single element. We should use sse_loadf32/f64 to give more options of what loads it can match.

Currently these instructions are often only getting their load folded thanks to the load folding in the peephole pass. I plan to add more types of loads to sse_load_f32/64 so we can match without the peephole.

llvm-svn: 289423

7 years ago[Driver] Simplify ToolChain::GetCXXStdlibType (NFC)
Jonas Hahnfeld [Mon, 12 Dec 2016 07:53:47 +0000 (07:53 +0000)]
[Driver] Simplify ToolChain::GetCXXStdlibType (NFC)

I made the wrong assumption that execution would continue after an error Diag
which led to unneeded complex code.
This patch aligns with the better implementation of ToolChain::GetRuntimeLibType.

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

llvm-svn: 289422

7 years agobuild: add support for standalone lld build
Saleem Abdulrasool [Mon, 12 Dec 2016 05:47:40 +0000 (05:47 +0000)]
build: add support for standalone lld build

Enable building lld as a standalone project. This is motivated by the desire to
package lld for inclusion in a linux distribution. This allows building lld
against an existing paired llvm installation. Now that lld is usable on x86_64,
it makes sense to revive this configuration to allow distributions to package
it.

llvm-svn: 289421

7 years ago[XRay][CMake] Check target for XRay Flight Data Recorder
Petr Hosek [Mon, 12 Dec 2016 05:18:36 +0000 (05:18 +0000)]
[XRay][CMake] Check target for XRay Flight Data Recorder

This target doesn't currently do anything, but it is required by
the runtimes build.

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

llvm-svn: 289420

7 years ago[X86] Remove some intrinsic instructions from hasPartialRegUpdate
Craig Topper [Mon, 12 Dec 2016 05:07:17 +0000 (05:07 +0000)]
[X86] Remove some intrinsic instructions from hasPartialRegUpdate

Summary:
These intrinsic instructions are all selected from intrinsics that have well defined behavior for where the upper bits come from. It's not the same place as the lower bits.

As you can see we were suppressing load folding for these instructions in some cases. In none of the cases was the separate load helping avoid a partial dependency on the destination register. So we should just go ahead and allow the load to be folded.

Only foldMemoryOperand was suppressing folding for these. They all have patterns for folding sse_load_f32/f64 that aren't gated with OptForSize, but sse_load_f32/f64 doesn't allow 128-bit vector loads. It only allows scalar_to_vector and vzmovl of scalar loads to match. There's no reason we can't allow a 128-bit vector load to be narrowed so I would like to fix sse_load_f32/f64 to allow that. And if I do that it changes some of these same test cases to fold the load too.

Reviewers: spatel, zvi, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 289419

7 years ago[libcxx][CMake] Move the warning to HandleOutOfTreeLLVM
Petr Hosek [Mon, 12 Dec 2016 05:05:46 +0000 (05:05 +0000)]
[libcxx][CMake] Move the warning to HandleOutOfTreeLLVM

This currently gives a warning when building libcxx under runtimes.

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

llvm-svn: 289418

7 years agoCOFF: Remove an unused mutex declaration.
Peter Collingbourne [Mon, 12 Dec 2016 03:16:18 +0000 (03:16 +0000)]
COFF: Remove an unused mutex declaration.

llvm-svn: 289415

7 years agoCOFF: Use a DenseSet instead of a map to atomic_flag to track which archive members...
Peter Collingbourne [Mon, 12 Dec 2016 03:16:14 +0000 (03:16 +0000)]
COFF: Use a DenseSet instead of a map to atomic_flag to track which archive members have been read.

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

llvm-svn: 289414

7 years agoAdd two new AST nodes to represent initialization of an array in terms of
Richard Smith [Mon, 12 Dec 2016 02:53:20 +0000 (02:53 +0000)]
Add two new AST nodes to represent initialization of an array in terms of
initialization of each array element:

 * ArrayInitLoopExpr is a prvalue of array type with two subexpressions:
   a common expression (an OpaqueValueExpr) that represents the up-front
   computation of the source of the initialization, and a subexpression
   representing a per-element initializer
 * ArrayInitIndexExpr is a prvalue of type size_t representing the current
   position in the loop

This will be used to replace the creation of explicit index variables in lambda
capture of arrays and copy/move construction of classes with array elements,
and also C++17 structured bindings of arrays by value (which inexplicably allow
copying an array by value, unlike all of C++'s other array declarations).

No uses of these nodes are introduced by this change, however.

llvm-svn: 289413