platform/upstream/llvm.git
7 years ago[sancov] Disable failing test on SystemZ as well
Ulrich Weigand [Tue, 13 Dec 2016 14:44:25 +0000 (14:44 +0000)]
[sancov] Disable failing test on SystemZ as well

This doesn't work at all on big-endian systems, even just reading in the
magic bytes in the binary .sancov file header gets byte order wrong.

llvm-svn: 289539

7 years ago[DAGCombiner] Match load by bytes idiom and fold it into a single load
Artur Pilipenko [Tue, 13 Dec 2016 14:21:14 +0000 (14:21 +0000)]
[DAGCombiner] Match load by bytes idiom and fold it into a single load

Match a pattern where a wide type scalar value is loaded by several narrow loads and combined by shifts and ors. Fold it into a single load or a load and a bswap if the targets supports it.

Assuming little endian target:
  i8 *a = ...
  i32 val = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24)
=>
  i32 val = *((i32)a)

  i8 *a = ...
  i32 val = (a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3]
=>
  i32 val = BSWAP(*((i32)a))

This optimization was discussed on llvm-dev some time ago in "Load combine pass" thread. We came to the conclusion that we want to do this transformation late in the pipeline because in presence of atomic loads load widening is irreversible transformation and it might hinder other optimizations.

Eventually we'd like to support folding patterns like this where the offset has a variable and a constant part:
  i32 val = a[i] | (a[i + 1] << 8) | (a[i + 2] << 16) | (a[i + 3] << 24)

Matching the pattern above is easier at SelectionDAG level since address reassociation has already happened and the fact that the loads are adjacent is clear. Understanding that these loads are adjacent at IR level would have involved looking through geps/zexts/adds while looking at the addresses.

The general scheme is to match OR expressions by recursively calculating the origin of individual bits which constitute the resulting OR value. If all the OR bits come from memory verify that they are adjacent and match with little or big endian encoding of a wider value. If so and the load of the wider type (and bswap if needed) is allowed by the target generate a load and a bswap if needed.

Reviewed By: hfinkel, RKSimon, filcab

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

llvm-svn: 289538

7 years agoMove BaseIndexOffset in DAGCombiner.cpp so it will be available for the upcoming...
Artur Pilipenko [Tue, 13 Dec 2016 14:16:02 +0000 (14:16 +0000)]
Move BaseIndexOffset in DAGCombiner.cpp so it will be available for the upcoming user

llvm-svn: 289537

7 years ago[OpenCL] Improve address space diagnostics.
Egor Churaev [Tue, 13 Dec 2016 14:07:23 +0000 (14:07 +0000)]
[OpenCL] Improve address space diagnostics.

Reviewers: Anastasia

Subscribers: bader, yaxunl, cfe-commits

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

llvm-svn: 289536

7 years ago[OpenCL] Enable unroll hint for OpenCL 1.x.
Egor Churaev [Tue, 13 Dec 2016 14:02:35 +0000 (14:02 +0000)]
[OpenCL] Enable unroll hint for OpenCL 1.x.

Summary: Although the feature was introduced only in OpenCL C v2.0 spec., it's useful for OpenCL 1.x too and doesn't require HW support.

Reviewers: Anastasia

Subscribers: yaxunl, cfe-commits, bader

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

llvm-svn: 289535

7 years ago[SelectionDAG] computeKnownBits - simplified knownbits sign extension. NFCI.
Simon Pilgrim [Tue, 13 Dec 2016 13:36:27 +0000 (13:36 +0000)]
[SelectionDAG] computeKnownBits - simplified knownbits sign extension. NFCI.

We don't need to extract+test the sign bit of the known ones/zeros, we can use sext which will handle all of this.

llvm-svn: 289534

7 years agoAdjust clang-format formatting to r289531
Tobias Grosser [Tue, 13 Dec 2016 12:44:00 +0000 (12:44 +0000)]
Adjust clang-format formatting to r289531

clang-format has been updated in r289531 to keep labels and values on
the same line. This change updates Polly to the new formatting style.

llvm-svn: 289533

7 years ago[mips][rtdyld] Move MIPS relocation resolution to a subclass and implement N32 reloca...
Simon Dardis [Tue, 13 Dec 2016 11:39:18 +0000 (11:39 +0000)]
[mips][rtdyld] Move MIPS relocation resolution to a subclass and implement N32 relocations

N32 relocations are only correct for individual relocations at the moment.
Support for relocation composition will follow in a later patch.

Patch By: Daniel Sanders

Reviwers: vkalintiris, atanasyan

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

llvm-svn: 289532

7 years agoclang-format: Keep string-literal-label + value pairs on a line.
Daniel Jasper [Tue, 13 Dec 2016 11:16:42 +0000 (11:16 +0000)]
clang-format: Keep string-literal-label + value pairs on a line.

We have previously done that for <<-operators. This patch also adds
this logic for "," and "+".

Before:
  string v = "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa + "aaaaaaaaaaaaaaaa: " +
             aaaaaaaaaaaaaaaa + "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa;
  string v = StrCat("aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa, "aaaaaaaaaaaaaaaa: ",
                    aaaaaaaaaaaaaaaa, "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa);

After:
  string v = "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa +
     "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa +
     "aaaaaaaaaaaaaaaa: " + aaaaaaaaaaaaaaaa;
  string v = StrCat("aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa,
    "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa,
    "aaaaaaaaaaaaaaaa: ", aaaaaaaaaaaaaaaa);

llvm-svn: 289531

7 years ago[mips] Fix comment to respect 80 chars per line; NFC
Simon Dardis [Tue, 13 Dec 2016 11:10:53 +0000 (11:10 +0000)]
[mips] Fix comment to respect 80 chars per line; NFC

llvm-svn: 289530

7 years ago[mips] Fix compact branch hazard detection
Simon Dardis [Tue, 13 Dec 2016 11:07:51 +0000 (11:07 +0000)]
[mips] Fix compact branch hazard detection

In certain cases it is possible that transient instructions such as
%reg = IMPLICIT_DEF as a single instruction in a basic block to reach
the MipsHazardSchedule pass. This patch teaches MipsHazardSchedule to
properly look through such cases.

Reviewers: vkalintiris, zoran.jovanovic

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

llvm-svn: 289529

7 years ago[GlobalISel] Move extendRegister where it belongs. NFCI
Diana Picus [Tue, 13 Dec 2016 10:46:12 +0000 (10:46 +0000)]
[GlobalISel] Move extendRegister where it belongs. NFCI

Apparently I missed this one when I moved ValueHandler back in r288658. Sorry!

llvm-svn: 289528

7 years ago[ELF] Add R_ARM_RELATIVE to relocations that can be applied to GotSection
Peter Smith [Tue, 13 Dec 2016 10:42:05 +0000 (10:42 +0000)]
[ELF] Add R_ARM_RELATIVE to relocations that can be applied to GotSection

When compiling -fpie and linking with the --pie option the R_ARM_GOTBREL
relocation to D is resolved by writing the value of D into the .got slot
and emitting an R_ARM_RELATIVE relocation for it.

This changes adds the R_ARM_RELATIVE relocation to the switch in
relocateOne() so we can process the GotSection relocation to write the
value of the variable as well as emitting the dynamic relocation.

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

llvm-svn: 289527

7 years ago[sancov] Mark as unstable on ARM, not XFAIL, since it does pass on some config
Renato Golin [Tue, 13 Dec 2016 10:22:49 +0000 (10:22 +0000)]
[sancov] Mark as unstable on ARM, not XFAIL, since it does pass on some config

llvm-svn: 289526

7 years agoclang-format: Improve braced-list detection.
Daniel Jasper [Tue, 13 Dec 2016 10:05:03 +0000 (10:05 +0000)]
clang-format: Improve braced-list detection.

Before:
  vector<int> v { 12 }
      GUARDED_BY(mutex);

After:
  vector<int> v{12} GUARDED_BY(mutex);

llvm-svn: 289525

7 years ago[clang-tidy] Add check for redundant function pointer dereferences
Malcolm Parsons [Tue, 13 Dec 2016 08:04:11 +0000 (08:04 +0000)]
[clang-tidy] Add check for redundant function pointer dereferences

Reviewers: alexfh, aaron.ballman, hokein

Subscribers: mgorny, JDevlieghere, cfe-commits

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

llvm-svn: 289524

7 years ago[X86][InstCombine] Fix SimplifyDemandedVectorElts to handle frcz scalar intrinsics...
Craig Topper [Tue, 13 Dec 2016 07:45:45 +0000 (07:45 +0000)]
[X86][InstCombine] Fix SimplifyDemandedVectorElts to handle frcz scalar intrinsics correctly.

Only the lower bits of the input element are used. And only the lower element can be undef since the upper bits are zeroed.

Have InstCombineCalls call SimplifyDemandedVectorElts for these intrinsics to reuse this support.

llvm-svn: 289523

7 years agollvm/test/Transforms/PGOProfile/noreturncall.ll REQUIRES asserts due to -debug-only.
NAKAMURA Takumi [Tue, 13 Dec 2016 07:04:03 +0000 (07:04 +0000)]
llvm/test/Transforms/PGOProfile/noreturncall.ll REQUIRES asserts due to -debug-only.

llvm-svn: 289522

7 years ago[PGO] Fix insane counts due to nonreturn calls
Rong Xu [Tue, 13 Dec 2016 06:41:14 +0000 (06:41 +0000)]
[PGO] Fix insane counts due to nonreturn calls

Summary:
Since we don't break BBs for function calls. We might get some insane counts
(wrap of unsigned) in the presence of noreturn calls.

This patch sets these counts to zero instead of the wrapped number.

Reviewers: davidxl

Subscribers: xur, eraman, llvm-commits

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

llvm-svn: 289521

7 years agoSmall tweaks to the markup in StructuredDataPlugins.
Jason Molenda [Tue, 13 Dec 2016 05:59:24 +0000 (05:59 +0000)]
Small tweaks to the markup in StructuredDataPlugins.

llvm-svn: 289520

7 years ago[SCCP] Debug diagnostic goes under DEBUG(). NFCI.
Davide Italiano [Tue, 13 Dec 2016 05:56:04 +0000 (05:56 +0000)]
[SCCP] Debug diagnostic goes under DEBUG(). NFCI.

llvm-svn: 289519

7 years agoTouch-up the markup of the DarwinLog.md documentation.
Jason Molenda [Tue, 13 Dec 2016 05:54:17 +0000 (05:54 +0000)]
Touch-up the markup of the DarwinLog.md documentation.

llvm-svn: 289518

7 years ago[AVR] Add an 'relax memory operation' pass
Dylan McKay [Tue, 13 Dec 2016 05:53:14 +0000 (05:53 +0000)]
[AVR] Add an 'relax memory operation' pass

Summary:
This pass will be used to relax instructions which use out of bounds
memory accesses to equivalent operations that can work with the
addresses.

The pass currently implements relaxation for the STDWPtrQRr instruction.

Without this pass, an assertion error would be hit in the pseudo expansion pass.

In the future, we will need to add more instructions to this pass. We can do
that on a case-by-case basic.

Reviewers: arsenm, kparzysz

Subscribers: wdng, llvm-commits, mgorny

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

llvm-svn: 289517

7 years ago[sanitizers] dso order is random, test shouldnt depend on it
Mike Aizatsky [Tue, 13 Dec 2016 05:24:57 +0000 (05:24 +0000)]
[sanitizers] dso order is random, test shouldnt depend on it

llvm-svn: 289516

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