platform/upstream/llvm.git
6 years ago[ObjC] Fix function signature handling for blocks literals with attributes
Alex Lorenz [Wed, 8 Nov 2017 22:44:34 +0000 (22:44 +0000)]
[ObjC] Fix function signature handling for blocks literals with attributes

Block literals can have a type with attributes in its signature, e.g.
ns_returns_retained. The code that inspected the type loc of the block when
declaring its parameters didn't account for this fact, and only looked through
paren type loc. This commit ensures that getAsAdjusted is used instead of
IgnoreParens to find the block's FunctionProtoTypeLoc. This ensures that
block parameters are declared correctly in the block and avoids the
'undeclared identifier' error.

rdar://35416160

llvm-svn: 317736

6 years agoCorrect atexit(3) support in TSan/NetBSD
Kamil Rytarowski [Wed, 8 Nov 2017 22:34:17 +0000 (22:34 +0000)]
Correct atexit(3) support in TSan/NetBSD

Summary:
The NetBSD specific implementation of cxa_atexit() does not
preserve the 2nd argument if dso is equal to NULL.

Changes:

 - Split paths of handling intercepted __cxa_atexit() and atexit(3).
   This affects all supported Operating Systems.
 - Add a local stack-like structure to hold the __cxa_atexit() context.
   atexit(3) is documented in the C standard as calling callback from the
   earliest to the oldest entry. This path also fixes potential ABI
   problem of passing an argument to a function from the atexit(3)
   callback mechanism.
 - Add new test to ensure LIFO style of atexit(3) callbacks: atexit3.cc

Proposal to change the behavior of __cxa_atexit() in NetBSD has been rejected.

With the above changes TSan/NetBSD with the current tsan_interceptors.cc
can bootstrap into operation.

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, dvyukov, joerg, kcc, eugenis

Reviewed By: dvyukov

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 317735

6 years ago[libcxx] Mark test cxa_deleted_virtual.pass.cpp as failing for previous libcxx versions.
Volodymyr Sapsai [Wed, 8 Nov 2017 22:30:29 +0000 (22:30 +0000)]
[libcxx] Mark test cxa_deleted_virtual.pass.cpp as failing for previous libcxx versions.

r313500 added a fix for undefined "___cxa_deleted_virtual" symbol.
Previous libcxx versions don't have the fix and corresponding test
should be failing.

rdar://problem/34521053

Reviewers: EricWF, mclow.lists, ahatanak

Reviewed By: ahatanak

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 317734

6 years ago[X86] X86MaskedGatherSDNode shouldn't inherit from MaskedGatherScatterSDNode
Craig Topper [Wed, 8 Nov 2017 22:26:41 +0000 (22:26 +0000)]
[X86] X86MaskedGatherSDNode shouldn't inherit from MaskedGatherScatterSDNode

The classof implementation in MaskedGatherScatterSDNode doesn't consider X86MaskedGatherSDNode so its misleading.

llvm-svn: 317733

6 years ago[X86] Preserve memory refs when folding loads into divides.
Craig Topper [Wed, 8 Nov 2017 22:26:39 +0000 (22:26 +0000)]
[X86] Preserve memory refs when folding loads into divides.

This is similar to what we already do for multiplies. Without this we can't unfold and hoist an invariant load.

llvm-svn: 317732

6 years ago[X86] Remove an if check on the result of a cast. NFC
Craig Topper [Wed, 8 Nov 2017 22:26:37 +0000 (22:26 +0000)]
[X86] Remove an if check on the result of a cast. NFC

cast takes a non-null input and produces a non-null output. So this if can never fail.

llvm-svn: 317731

6 years agoLet replaceVTableHolder accept any type.
Adrian Prantl [Wed, 8 Nov 2017 22:04:43 +0000 (22:04 +0000)]
Let replaceVTableHolder accept any type.

In Rust, a trait can be implemented for any type, and if a trait
object pointer is used for the type, then a virtual table will be
emitted for that trait/type combination.

We would like debuggers to be able to inspect trait objects, which
requires finding the concrete type associated with a given vtable.

This patch changes LLVM so that any type can be passed to
replaceVTableHolder. This allows the Rust compiler to emit the needed
debug info -- associating a vtable with the concrete type for which it
was emitted.

This is a DWARF extension: DWARF only specifies the meaning of
DW_AT_containing_type in one specific situation. This style of DWARF
extension is routine, though, and LLVM already has one such case for
DW_AT_containing_type.

Patch by Tom Tromey!

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

llvm-svn: 317730

6 years agoAdd an @llvm.sideeffect intrinsic
Dan Gohman [Wed, 8 Nov 2017 21:59:51 +0000 (21:59 +0000)]
Add an @llvm.sideeffect intrinsic

This patch implements Chandler's idea [0] for supporting languages that
require support for infinite loops with side effects, such as Rust, providing
part of a solution to bug 965 [1].

Specifically, it adds an `llvm.sideeffect()` intrinsic, which has no actual
effect, but which appears to optimization passes to have obscure side effects,
such that they don't optimize away loops containing it. It also teaches
several optimization passes to ignore this intrinsic, so that it doesn't
significantly impact optimization in most cases.

As discussed on llvm-dev [2], this patch is the first of two major parts.
The second part, to change LLVM's semantics to have defined behavior
on infinite loops by default, with a function attribute for opting into
potential-undefined-behavior, will be implemented and posted for review in
a separate patch.

[0] http://lists.llvm.org/pipermail/llvm-dev/2015-July/088103.html
[1] https://bugs.llvm.org/show_bug.cgi?id=965
[2] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118632.html

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

llvm-svn: 317729

6 years ago[ThinLTO] New test needs to require LTO
Teresa Johnson [Wed, 8 Nov 2017 21:48:27 +0000 (21:48 +0000)]
[ThinLTO] New test needs to require LTO

Fix buildbot failures:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/5262/steps/annotate/logs/stdio

llvm-svn: 317728

6 years ago[ObjC] Boxed strings should use the nullability from stringWithUTF8String's return...
Alex Lorenz [Wed, 8 Nov 2017 21:33:15 +0000 (21:33 +0000)]
[ObjC] Boxed strings should use the nullability from stringWithUTF8String's return type

Objective-C NSString has a class method stringWithUTF8String that creates a new
NSString from a C string. Objective-C box expression @(...) can be used to
create an NSString instead of invoking the stringWithUTF8String method directly
(The compiler lowers it down to the invocation though). This commit ensures that
the type of @(string-value) gets the same nullability attributes as the return
type of stringWithUTF8String to ensure that the diagnostics are consistent
between the two.

rdar://33847186

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

llvm-svn: 317727

6 years agoRevert "Correct dwarf unwind information in function epilogue for X86"
Reid Kleckner [Wed, 8 Nov 2017 21:31:14 +0000 (21:31 +0000)]
Revert "Correct dwarf unwind information in function epilogue for X86"

This reverts r317579, originally committed as r317100.

There is a design issue with marking CFI instructions duplicatable. Not
all targets support the CFIInstrInserter pass, and targets like Darwin
can't cope with duplicated prologue setup CFI instructions. The compact
unwind info emission fails.

When the following code is compiled for arm64 on Mac at -O3, the CFI
instructions end up getting tail duplicated, which causes compact unwind
info emission to fail:
  int a, c, d, e, f, g, h, i, j, k, l, m;
  void n(int o, int *b) {
    if (g)
      f = 0;
    for (; f < o; f++) {
      m = a;
      if (l > j * k > i)
        j = i = k = d;
      h = b[c] - e;
    }
  }

We get assembly that looks like this:
; BB#1:                                 ; %if.then
Lloh3:
adrp x9, _f@GOTPAGE
Lloh4:
ldr x9, [x9, _f@GOTPAGEOFF]
mov  w8, wzr
Lloh5:
str wzr, [x9]
stp x20, x19, [sp, #-16]!   ; 8-byte Folded Spill
.cfi_def_cfa_offset 16
.cfi_offset w19, -8
.cfi_offset w20, -16
cmp w8, w0
b.lt LBB0_3
b LBB0_7
LBB0_2:                                 ; %entry.if.end_crit_edge
Lloh6:
adrp x8, _f@GOTPAGE
Lloh7:
ldr x8, [x8, _f@GOTPAGEOFF]
Lloh8:
ldr w8, [x8]
stp x20, x19, [sp, #-16]!   ; 8-byte Folded Spill
.cfi_def_cfa_offset 16
.cfi_offset w19, -8
.cfi_offset w20, -16
cmp w8, w0
b.ge LBB0_7
LBB0_3:                                 ; %for.body.lr.ph

Note the multiple .cfi_def* directives. Compact unwind info emission
can't handle that.

llvm-svn: 317726

6 years ago[cmake] Allow LLVM_BUILD_INSTRUMENTED to be set to IR or Frontend
Vedant Kumar [Wed, 8 Nov 2017 21:26:40 +0000 (21:26 +0000)]
[cmake] Allow LLVM_BUILD_INSTRUMENTED to be set to IR or Frontend

- This deprecates LLVM_ENABLE_IR_PGO but keeps it around for now.
- Errors out when LLVM_BUILD_INSTRUMENTED and LLVM_BUILD_INSTRUMENTED_COVERAGE
  are both set.

Motivated by bogner's post-commit review of r313770.

llvm-svn: 317725

6 years agoMake sure an error is always handled.
Rafael Espindola [Wed, 8 Nov 2017 21:15:21 +0000 (21:15 +0000)]
Make sure an error is always handled.

llvm-svn: 317724

6 years ago[ThinLTO] Ensure sanitizer passes are run
Teresa Johnson [Wed, 8 Nov 2017 20:27:28 +0000 (20:27 +0000)]
[ThinLTO] Ensure sanitizer passes are run

Recommit new test as linux-only.

llvm-svn: 317723

6 years agoAdded include for <cassert>
Marshall Clow [Wed, 8 Nov 2017 20:25:47 +0000 (20:25 +0000)]
Added include for <cassert>

llvm-svn: 317722

6 years agoSet hasSideEffects=0 for PHI and fix affected passes
Alex Bradbury [Wed, 8 Nov 2017 20:19:16 +0000 (20:19 +0000)]
Set hasSideEffects=0 for PHI and fix affected passes

Previously, hasSideEffects was ? for TargetOpcode::PHI and would be inferred
as 1. D37065 sets the previously inferred properties explicitly. This patch sets
hasSideEffects=0 for PHI, as it is for G_PHI. MachineInstr::isSafeToMove has
been updated so it still returns false for PHI.

Additionally, HexagonBitSimplify relied on a PHI node having the
hasUnmodeledSideEffects property. This patch fixes that assumption.

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

llvm-svn: 317721

6 years ago[X86] Correct the implementation of BEXTR load folding to use the shift as the parent...
Craig Topper [Wed, 8 Nov 2017 20:17:33 +0000 (20:17 +0000)]
[X86] Correct the implementation of BEXTR load folding to use the shift as the parent node and pass a separate root.

We were calling tryFoldLoad with the 'and' node was the root and parent node of the load. But the parent of the load should be the shift that proceeds the and. While the and node is correctly the root node.

To fix this I had to make tryFoldLoad take a separate use and root input. I've added a convenience version with the old signature to avoid updating the other call sites.

llvm-svn: 317720

6 years ago[OPENMP] Codegen for `#pragma omp target parallel for`.
Alexey Bataev [Wed, 8 Nov 2017 20:16:14 +0000 (20:16 +0000)]
[OPENMP] Codegen for `#pragma omp target parallel for`.

llvm-svn: 317719

6 years ago[WebAssembly] Update test expectations
Sam Clegg [Wed, 8 Nov 2017 20:14:06 +0000 (20:14 +0000)]
[WebAssembly] Update test expectations

I believe these were fixed in rL317707

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

llvm-svn: 317718

6 years agoRevert "[ThinLTO] Ensure sanitizer passes are run"
Teresa Johnson [Wed, 8 Nov 2017 20:08:15 +0000 (20:08 +0000)]
Revert "[ThinLTO] Ensure sanitizer passes are run"

This reverts commit r317715. It failed a Windows buildbot since
ThinLTO is presumably not supported, leading to a corrupt file error
on the object file:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/19395/steps/run%20check-asan/logs/stdio

Will re-commit the new ThinLTO part of the test to a linux only test
file.

llvm-svn: 317717

6 years agoAdd a missing "REQUIRES: system-windows" to a Windows-only test.
David L. Jones [Wed, 8 Nov 2017 20:03:11 +0000 (20:03 +0000)]
Add a missing "REQUIRES: system-windows" to a Windows-only test.

This un-breaks builds on other platforms. Otherwise, they fail due to warnings like:

warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found]
llvm-svn: 317716

6 years ago[ThinLTO] Ensure sanitizer passes are run
Teresa Johnson [Wed, 8 Nov 2017 19:46:25 +0000 (19:46 +0000)]
[ThinLTO] Ensure sanitizer passes are run

Summary:
Test fix to pass manager for ThinLTO.

Depends on D39565.

Reviewers: pcc

Subscribers: kubamracek, mehdi_amini, llvm-commits, inglorion

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

llvm-svn: 317715

6 years ago[ThinLTO] Ensure sanitizer passes are run
Teresa Johnson [Wed, 8 Nov 2017 19:45:52 +0000 (19:45 +0000)]
[ThinLTO] Ensure sanitizer passes are run

Summary:
In ThinLTO compilation, we exit populateModulePassManager early and
were not adding PM extension passes meant to run at the end of the
pipeline. This includes sanitizer passes. Add these passes before
the early exit.

A test will be added to projects/compiler-rt.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, llvm-commits

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

llvm-svn: 317714

6 years ago[X86] Don't call validateInstruction from MatchAndEmitInstruction when MatchingInline...
Craig Topper [Wed, 8 Nov 2017 19:38:48 +0000 (19:38 +0000)]
[X86] Don't call validateInstruction from MatchAndEmitInstruction when MatchingInlineAsm is set. The MCInst won't be populated.

Without this we can't parse gather instructions in ms inline asm blocks. The validateInstruction function was introduced in r316700 to check gather constraints.

llvm-svn: 317713

6 years ago[ValueTracking] Use APInt::isNullValue/isOneValue which are more efficient for large...
Craig Topper [Wed, 8 Nov 2017 19:38:45 +0000 (19:38 +0000)]
[ValueTracking] Use APInt::isNullValue/isOneValue which are more efficient for large APInts.

llvm-svn: 317712

6 years ago[WebAssembly] Add a test for inline-asm "m" constraints.
Dan Gohman [Wed, 8 Nov 2017 19:37:24 +0000 (19:37 +0000)]
[WebAssembly] Add a test for inline-asm "m" constraints.

llvm-svn: 317711

6 years ago[WebAssembly] Call signExtend to get sign extended register
Dan Gohman [Wed, 8 Nov 2017 19:24:21 +0000 (19:24 +0000)]
[WebAssembly] Call signExtend to get sign extended register

Patch by Jatin Bhateja!

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

llvm-svn: 317710

6 years agoAdd CoreOption flag to "-coverage" option to make it available for clang-cl
Marco Castelluccio [Wed, 8 Nov 2017 19:21:54 +0000 (19:21 +0000)]
Add CoreOption flag to "-coverage" option to make it available for clang-cl

Summary:
The -coverage option is not a CoreOption, so it is not available to clang-cl.
This patch adds the CoreOption flag to "-coverage" to allow it to be used with clang-cl.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 317709

6 years agoUn-XFAIL a test after the bugfix in r317702.
Adrian Prantl [Wed, 8 Nov 2017 19:18:20 +0000 (19:18 +0000)]
Un-XFAIL a test after the bugfix in r317702.

llvm-svn: 317708

6 years ago[WebAssembly] Revise the strategy for inline asm.
Dan Gohman [Wed, 8 Nov 2017 19:18:08 +0000 (19:18 +0000)]
[WebAssembly] Revise the strategy for inline asm.

Previously, an "r" constraint would mean the compiler provides a value
on WebAssembly's operand stack. This was tricky to use properly,
particularly since it isn't possible to declare a new local from within
an inline asm string.

With this patch, "r" provides the value in a WebAssembly local, and the
local index is provided to the inline asm string. This requires inline
asm to use get_local and set_local to read the register. This does
potentially result in larger code size, however inline asm should
hopefully be quite rare in WebAssembly.

This also means that the "m" constraint can no longer be supported, as
WebAssembly has nothing like a "memory operand" that includes an
implicit get_local.

This fixes PR34599 for the wasm32-unknown-unknown-wasm target (though
not for the ELF target).

llvm-svn: 317707

6 years ago[bindings] fix TLS test failure
Masud Rahman [Wed, 8 Nov 2017 19:17:27 +0000 (19:17 +0000)]
[bindings] fix TLS test failure

Since cfe commit r237337, '__declspec(thread)' and 'thread_local' have
been the same since MSVC 2015.  i.e. they are both considered to supply
a dynamic TLS kind, not a static TLS kind.

This test originally did not specify which version of MS compatibility
to assume.  As a result, the test was brittle, since changing the
default compatibility version could break the test.

This commit adds a specific version when building up the flags used to
parse the translation unit, and tests both versions.

llvm-svn: 317706

6 years agoImplement flock for Windows in compiler-rt
Marco Castelluccio [Wed, 8 Nov 2017 19:11:54 +0000 (19:11 +0000)]
Implement flock for Windows in compiler-rt

Summary:
This patch implements flock for Windows, needed to make gcda writing work in a multiprocessing scenario.

Fixes https://bugs.llvm.org/show_bug.cgi?id=34923.

Reviewers: zturner

Reviewed By: zturner

Subscribers: rnk, zturner, llvm-commits

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

llvm-svn: 317705

6 years agoNFC: Rename MCSafeSEHFragment to MCSymbolIdFragment
Adrian McCarthy [Wed, 8 Nov 2017 18:57:02 +0000 (18:57 +0000)]
NFC:  Rename MCSafeSEHFragment to MCSymbolIdFragment

Summary:
This fragment emits a symbol ID and will be useful for more than just Safe SEH
tables (e.g., I plan to re-use it for Control Flow Guard tables).  This is
simply a rename refactor.

Reviewers: rnk

Subscribers: llvm-commits, hiraditya

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

llvm-svn: 317703

6 years agoHandle inlined variables in SelectionDAGBuilder::EmitFuncArgumentDbgValue().
Adrian Prantl [Wed, 8 Nov 2017 18:27:13 +0000 (18:27 +0000)]
Handle inlined variables in SelectionDAGBuilder::EmitFuncArgumentDbgValue().

In 2010 a commit with no testcase and no further explanation
explicitly disabled the handling of inlined variables in
EmitFuncArgumentDbgValue(). I don't think there is a good reason for
this any more and re-enabling this adds debug locations for variables
associated with an LLVM function argument in functions that are
inlined into the first basic block. The only downside of doing this is
that we may insert a DBG_VALUE before the inlined scope, but (1) this
could be filtered out later, and (2) LiveDebugValues will not
propagate it into subsequent basic blocks if they don't dominate the
variable's lexical scope, so this seems like a small price to pay.

rdar://problem/26228128

llvm-svn: 317702

6 years ago[analyzer] Fix a crash on logical operators with vectors.
Artem Dergachev [Wed, 8 Nov 2017 17:27:58 +0000 (17:27 +0000)]
[analyzer] Fix a crash on logical operators with vectors.

Do not crash when trying to compute x && y or x || y where x and y are
of a vector type.

For now we do not seem to properly model operations with vectors. In particular,
operations && and || on a pair of vectors are not short-circuit, unlike regular
logical operators, so even our CFG is incorrect.

Avoid the crash, add respective FIXME tests for later.

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

rdar://problem/34317663

llvm-svn: 317700

6 years ago[sanitizer] Add Scudo to the sanitizer lint checks.
Kostya Kortchinsky [Wed, 8 Nov 2017 16:42:29 +0000 (16:42 +0000)]
[sanitizer] Add Scudo to the sanitizer lint checks.

Summary:
Scudo abides by the coding style enforced by the sanitizer_common
linter, but as of right now, it's not linter-enforced.

Add Scudo to the list of directories checked by check_lint.sh.

Also: fixes some linter errors found after getting this running.

Reviewers: cryptoad

Reviewed By: cryptoad

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 317699

6 years ago[X86] Add some initial scheduling tests for generic x86 instructions
Simon Pilgrim [Wed, 8 Nov 2017 16:35:42 +0000 (16:35 +0000)]
[X86] Add some initial scheduling tests for generic x86 instructions

These will be using inline asm to ensure we have coverage that we're unlikely to get from lowering of basic ir.

Currently waiting for D39728 to land to add support for scheduler comments for inline asm.

llvm-svn: 317698

6 years ago[clang-refactor] Get rid of OccurrencesFinder in RenamingAction, NFC
Haojian Wu [Wed, 8 Nov 2017 14:53:08 +0000 (14:53 +0000)]
[clang-refactor] Get rid of OccurrencesFinder in RenamingAction, NFC

Summary:
The OccurrencesFinder is only used in RenameOccurrences to find symbol
occurrences, there is no need to inherit RefactoringRule.

Replace it with a single utility function to avoid code misleading.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 317696

6 years ago[CMake] Remove target to build native tablegen
Jonas Hahnfeld [Wed, 8 Nov 2017 14:31:54 +0000 (14:31 +0000)]
[CMake] Remove target to build native tablegen

This was once needed so that multiple tablegen binaries don't compile
the library concurrently. However, this isn't needed anymore since
adding USES_TERMINAL to the custom_command.
This is supported by the fact that the target was only building
LLVMSupport since some cleanups a year ago. If this dependency had
really been needed, we would have seen complaints.

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

llvm-svn: 317695

6 years ago[CMake] Add custom target to create build directory
Jonas Hahnfeld [Wed, 8 Nov 2017 14:31:51 +0000 (14:31 +0000)]
[CMake] Add custom target to create build directory

CMake does a poor job in tracking dependencies on files and directories
directly. Create custom target similar to the configuration step.
On my system, this avoids the reconfiguration on each build.

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

llvm-svn: 317694

6 years ago[utils] Add RISC-V support to update_llc_test_checks.py
Alex Bradbury [Wed, 8 Nov 2017 14:24:42 +0000 (14:24 +0000)]
[utils] Add RISC-V support to update_llc_test_checks.py

This should be a trivial change, and I've started using it for generating all
tests at https://github.com/lowrisc/riscv-llvm (i.e. it's been tested in
action quite a lot). Note that the regex does not attempt to match
.cfi_startproc, as I want to ensure compatibility with functions that have the
nounwind attribute.

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

llvm-svn: 317693

6 years agoRelax definitions.test to accept windows file paths.
Sam McCall [Wed, 8 Nov 2017 13:52:21 +0000 (13:52 +0000)]
Relax definitions.test to accept windows file paths.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 317692

6 years ago[RISCV] Initial support for function calls
Alex Bradbury [Wed, 8 Nov 2017 13:41:21 +0000 (13:41 +0000)]
[RISCV] Initial support for function calls

Note that this is just enough for simple function call examples to generate
working code. Support for varargs etc follows in future patches.

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

llvm-svn: 317691

6 years ago[RISCV] Codegen for conditional branches
Alex Bradbury [Wed, 8 Nov 2017 13:31:40 +0000 (13:31 +0000)]
[RISCV] Codegen for conditional branches

A good portion of this patch is the extra functions that needed to be
implemented to support the test case. e.g. storeRegToStackSlot,
loadRegFromStackSlot, eliminateFrameIndex.

Setting ISD::BR_CC to Expand may appear non-obvious on an architecture with
branch+cmp instructions. However, I found it much easier to deal with matching
the expanded form.

I had to change simm13_lsb0 and simm21_lsb0 to inherit from the
Operand<OtherVT> class rather than Operand<i32> in order to keep tablegen
happy. This isn't a big deal, but it does seem a shame to lose the uniformity
across immediate types when there's not an obvious benefit (I'm hoping a
tablegen expert will educate me on what I'm missing here!).

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

llvm-svn: 317690

6 years ago[clang-tidy] Add a note about modernize-replace-random-shuffle
Krasimir Georgiev [Wed, 8 Nov 2017 13:28:53 +0000 (13:28 +0000)]
[clang-tidy] Add a note about modernize-replace-random-shuffle

Summary:
This adds a note warning the users that the way the suggested fix seeds the
random number generator is poor.

Reviewers: hokein

Reviewed By: hokein

Subscribers: cfe-commits, xazax.hun

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

llvm-svn: 317689

6 years ago[RISCV] Codegen support for memory operations on global addresses
Alex Bradbury [Wed, 8 Nov 2017 13:24:21 +0000 (13:24 +0000)]
[RISCV] Codegen support for memory operations on global addresses

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

llvm-svn: 317688

6 years agoWorkaround reverse-iteration buildbot breakages. Filed PR35244.
Ilya Biryukov [Wed, 8 Nov 2017 13:05:52 +0000 (13:05 +0000)]
Workaround reverse-iteration buildbot breakages. Filed PR35244.

Clang's completion output is non-deterministic, causing test failures
with turned on LLVM_REVERSE_ITERATION.
The workaround is to use CHECK-DAGs for now, will remove them when
PR35244 gets fixed.

llvm-svn: 317687

6 years ago[clangd] tolerate windows filepaths in tests
Sam McCall [Wed, 8 Nov 2017 12:25:00 +0000 (12:25 +0000)]
[clangd] tolerate windows filepaths in tests

llvm-svn: 317686

6 years ago[RISCV] Codegen support for memory operations
Alex Bradbury [Wed, 8 Nov 2017 12:20:01 +0000 (12:20 +0000)]
[RISCV] Codegen support for memory operations

This required the implementation of RISCVTargetInstrInfo::copyPhysReg. Support
for lowering global addresses follow in the next patch.

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

llvm-svn: 317685

6 years ago[RISCV] Codegen support for materializing constants
Alex Bradbury [Wed, 8 Nov 2017 12:02:22 +0000 (12:02 +0000)]
[RISCV] Codegen support for materializing constants

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

llvm-svn: 317684

6 years agoXfail TestConcurrentTwoWatchpointsOneSignal on arm
Pavel Labath [Wed, 8 Nov 2017 11:51:49 +0000 (11:51 +0000)]
Xfail TestConcurrentTwoWatchpointsOneSignal on arm

r317561 exposed an interesting bug (pr35228) in handling of simultaneous
watchpoint hits. Disabling the test until we can get that fixed.

llvm-svn: 317683

6 years ago[Analysis] Fix merging TBAA tags with different final access types
Ivan A. Kosarev [Wed, 8 Nov 2017 11:42:21 +0000 (11:42 +0000)]
[Analysis] Fix merging TBAA tags with different final access types

There are cases when we have to merge TBAA access tags with the
same base access type, but different final access types. For
example, accesses to different members of the same structure may
be vectorized into a single load or store instruction. Since we
currently assume that the tags to merge always share the same
final access type, we incorrectly return a tag that describes an
access to one of the original final access types as the generic
tag. This patch fixes that by producing generic tags for the
common type and not the final access types of the original tags.

Resolves:
PR35225: Wrong tbaa metadata after load store vectorizer due to
recent change
https://bugs.llvm.org/show_bug.cgi?id=35225

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

llvm-svn: 317682

6 years ago[mips] Guard indirect and tailcall pseudo instructions correctly.
Simon Dardis [Wed, 8 Nov 2017 11:13:44 +0000 (11:13 +0000)]
[mips] Guard indirect and tailcall pseudo instructions correctly.

Previously these pseudo instructions were not guarded by ISA, so their
select was dependant on the ordering of the entries in the DAG matcher.

Reviewers: atanasyan

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

llvm-svn: 317681

6 years agoBasicAA: fix bug where we would return partialalias instead of noalias
Nuno Lopes [Wed, 8 Nov 2017 10:59:00 +0000 (10:59 +0000)]
BasicAA: fix bug where we would return partialalias instead of noalias
My fix is conservative and will make us return may-alias instead.

The test case is:
check(gep(x, 0), n, gep(x, n), -1)  with  n == sizeof(x)

Here, the first value accesses the whole object, but the second access
doesn't access anything. The semantics of -1 is read until the end of the
object, which in this case means read nothing.

No test case, since isn't trivial to exploit this one, but I've proved it correct.

llvm-svn: 317680

6 years agoLog: delimit thread name in log message
Pavel Labath [Wed, 8 Nov 2017 10:48:54 +0000 (10:48 +0000)]
Log: delimit thread name in log message

The thread name was not followed by a space, which meant it was glued to
the log message. I also align the name as we do that with other log
fields. I align it to 16 chars instead of llvm::max_thread_name(), as
that can be 64 on darwin, which is rather long. If anybody feels
differently about that, we can change it.

llvm-svn: 317679

6 years agoMake TestTopLevelExprs more robust in face of linker GC
Pavel Labath [Wed, 8 Nov 2017 10:48:50 +0000 (10:48 +0000)]
Make TestTopLevelExprs more robust in face of linker GC

Summary:
This test was failing in various configurations on linux in a fairly
unpredictible way. The success depended on whether the c++ abi library
was linked in statically or not and how well was the linker able to
strip parts of it. This introduces additional code to the "dummmy" test
executable, which ensures that all parts of the library needed to
evaluate the expressions are always present.

Reviewers: clayborg

Subscribers: srhines, tatyana-krasnukha, davide, lldb-commits

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

llvm-svn: 317678

6 years agoAvoid printing some redundant name qualifiers in completion
Ilya Biryukov [Wed, 8 Nov 2017 10:39:09 +0000 (10:39 +0000)]
Avoid printing some redundant name qualifiers in completion

Summary:
Adjusted PrintingPolicy inside code completion to avoid printing some
redundant name qualifiers.

Before this change, typedefs that were written unqualified in source
code were printed with qualifiers in completion. For example, in the
following code

    struct foo {
        typedef int type;
        type method();
    };

completion item for `method` had return type of `foo::type`, even
though the original code used `type` without qualifiers.
After this change, the completion item has return type `type`, as
originally written in the source code.

Note that this change does not suppress qualifiers written by the
user. For example, in the following code

    typedef int type;
    struct foo {
        typedef int type;
        ::type method(foo::type);
    };

completion item for `method` has return type of `::type` and
parameter type of `foo::type`, as originally written in the source
code.

Reviewers: arphaman, bkramer, klimek

Reviewed By: arphaman

Subscribers: mgorny, eraman, cfe-commits

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

llvm-svn: 317677

6 years agoMoved QualTypeNames.h from Tooling to AST.
Ilya Biryukov [Wed, 8 Nov 2017 10:39:03 +0000 (10:39 +0000)]
Moved QualTypeNames.h from Tooling to AST.

Summary:
For code reuse in SemaCodeComplete.
Note that the tests for QualTypeNames are still in Tooling as they use
Tooling's common testing code.

Reviewers: rsmith, saugustine, rnk, klimek, bkramer

Reviewed By: rnk

Subscribers: cfe-commits, mgorny

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

llvm-svn: 317676

6 years agoFixed link to bugzilla in the sidebar
Raphael Isemann [Wed, 8 Nov 2017 10:10:31 +0000 (10:10 +0000)]
Fixed link to bugzilla in the sidebar

llvm-svn: 317675

6 years ago[NFCI] Ensure TargetOpcode::* are compatible with guessInstructionProperties=0
Alex Bradbury [Wed, 8 Nov 2017 09:26:06 +0000 (09:26 +0000)]
[NFCI] Ensure TargetOpcode::* are compatible with guessInstructionProperties=0

rL162640 introduced CodeGenTarget::guessInstructionProperties. If a target
sets guessInstructionProperties=0 in its FooInstrInfo, tablegen will error if
it has to guess properties from patterns. Unfortunately,
guessInstructionProperties=0 can't be used with current upstream LLVM as
instructions in the TargetOpcode namespace are always included and sometimes
have inferred properties for mayLoad, mayStore, and hasSideEffects. This patch
provides the simplest possible fix to this problem, setting default values for
these fields in the TargetOpcode scope. There is no intended functional
change, as the explicitly set properties should match what was previously
inferred. A number of the instructions had hasSideEffects=1 inferred
unintentionally. This patch makes it explicit, while future patches (such as
D37097) correct the property.

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

llvm-svn: 317674

6 years ago[clangd] loosen tests for flag-dependence revealed by r317670
Sam McCall [Wed, 8 Nov 2017 09:15:01 +0000 (09:15 +0000)]
[clangd] loosen tests for flag-dependence revealed by r317670

llvm-svn: 317673

6 years ago[clang-refactor] Introduce a new rename rule for qualified symbols
Haojian Wu [Wed, 8 Nov 2017 08:56:56 +0000 (08:56 +0000)]
[clang-refactor] Introduce a new rename rule for qualified symbols

Summary: Prototype of a new rename rule for renaming qualified symbol.

Reviewers: arphaman, ioeric, sammccall

Reviewed By: arphaman, sammccall

Subscribers: jklaehn, cfe-commits, klimek

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

llvm-svn: 317672

6 years agoDAG: Add computeKnownBitsForFrameIndex
Matt Arsenault [Wed, 8 Nov 2017 08:52:31 +0000 (08:52 +0000)]
DAG: Add computeKnownBitsForFrameIndex

Some of the AMDGPU stack addressing modes require knowing the sign
bit is zero. We used to accomplish this by custom lowering
frame indexes, and then putting an AssertZext around a
TargetFrameIndex. This required specifically looking for
the AssextZext + frame index pattern which was moderately
disgusting. The same could probably be accomplished
with a target specific node, but would still
require special handling of frame indexes.

llvm-svn: 317671

6 years ago[clangd] Sort completion results.
Sam McCall [Wed, 8 Nov 2017 07:44:12 +0000 (07:44 +0000)]
[clangd] Sort completion results.

Summary:
This is (probably) not required by LSP, but at least one buggy client wants it.
It also simplifies some tests - changed a few completion tests to use -pretty.

Reviewers: hokein, malaperle

Subscribers: ilya-biryukov, cfe-commits

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

llvm-svn: 317670

6 years ago[COFF] Add support for IMAGE_REL_ARM64_SECREL
Martin Storsjo [Wed, 8 Nov 2017 07:31:50 +0000 (07:31 +0000)]
[COFF] Add support for IMAGE_REL_ARM64_SECREL

I never ran into this until lld-link started enabling debug output
by default for the mingw mode. I haven't been able to verify that
this actually behaves correctly, but this relocation is handled
identically on all other architectures so far.

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

llvm-svn: 317669

6 years agoAlways use prctl(PR_SET_PTRACER)
Sylvestre Ledru [Wed, 8 Nov 2017 07:25:19 +0000 (07:25 +0000)]
Always use prctl(PR_SET_PTRACER)

Summary:
Sufficiently old Linux kernel headers don't provide the PR_SET_PTRACER, but we can still call prctl with it if the runtime kernel is newer. Even if it's not, prctl will only return EINVAL.

Patch by Mike Hommey <mh-llvm@glandium.org>

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: sylvestre.ledru, cfe-commits, kubamracek

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

llvm-svn: 317668

6 years agoRevert "[CGP] Enable extending scope of optimizeMemoryInst"
Serguei Katkov [Wed, 8 Nov 2017 05:38:54 +0000 (05:38 +0000)]
Revert "[CGP] Enable extending scope of optimizeMemoryInst"

Revert the patch r317665 causing buildbot failures.

llvm-svn: 317667

6 years ago[CGP] Enable extending scope of optimizeMemoryInst
Serguei Katkov [Wed, 8 Nov 2017 05:02:51 +0000 (05:02 +0000)]
[CGP] Enable extending scope of optimizeMemoryInst

This patch enables the folding of address computation in
memory instruction in case adress is represented by Phi node.

The inputs of Phi node might be different in base register.

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

llvm-svn: 317665

6 years ago[X86] Add masked vcvtps2ph builtins to CheckX86BuiltinFunctionCall.
Craig Topper [Wed, 8 Nov 2017 04:54:26 +0000 (04:54 +0000)]
[X86] Add masked vcvtps2ph builtins to CheckX86BuiltinFunctionCall.

This ensures that only immediates that fit in 8-bits are used. This matches what we do for the unmasked versions.

llvm-svn: 317664

6 years agoRemove a given file even if openFileForRead fails.
Rui Ueyama [Wed, 8 Nov 2017 04:22:40 +0000 (04:22 +0000)]
Remove a given file even if openFileForRead fails.

I think the constract of this function is to remove a file in some way,
whether in background or in foreground. This patch makes sure that it
removes a given file.

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

llvm-svn: 317663

6 years ago[X86] Add patterns to fold EVEX store with EVEX encoded vcvtps2ph instructions. Remov...
Craig Topper [Wed, 8 Nov 2017 04:00:31 +0000 (04:00 +0000)]
[X86] Add patterns to fold EVEX store with EVEX encoded vcvtps2ph instructions. Remove bad pattern that had vf432 vcvtps2ph storing 128-bits.

llvm-svn: 317662

6 years ago[X86] Allow legacy vcvtps2ph intrinsics to select EVEX encoded instructions. Rely...
Craig Topper [Wed, 8 Nov 2017 04:00:30 +0000 (04:00 +0000)]
[X86] Allow legacy vcvtps2ph intrinsics to select EVEX encoded instructions. Rely on EVEX->VEX to convert back.

Missed store folding opportunities will be fixed in a subsequent commit.

llvm-svn: 317661

6 years agoUpdate for llvm change.
Rafael Espindola [Wed, 8 Nov 2017 01:50:34 +0000 (01:50 +0000)]
Update for llvm change.

llvm-svn: 317657

6 years agoConvert FileOutputBuffer::commit to Error.
Rafael Espindola [Wed, 8 Nov 2017 01:50:29 +0000 (01:50 +0000)]
Convert FileOutputBuffer::commit to Error.

llvm-svn: 317656

6 years agoRevert "[scudo] Make getNumberOfCPUs Fuchsia compliant"
Reid Kleckner [Wed, 8 Nov 2017 01:33:15 +0000 (01:33 +0000)]
Revert "[scudo] Make getNumberOfCPUs Fuchsia compliant"

This reverts commit r317604.

Android doesn't have cpu_set_t.

llvm-svn: 317655

6 years agoRevert "Reapply: Allow yaml2obj to order implicit sections for ELF"
Dave Lee [Wed, 8 Nov 2017 01:31:20 +0000 (01:31 +0000)]
Revert "Reapply: Allow yaml2obj to order implicit sections for ELF"

This reverts commit r317646.

llvm-svn: 317654

6 years agoUpdate unittest too.
Rafael Espindola [Wed, 8 Nov 2017 01:10:05 +0000 (01:10 +0000)]
Update unittest too.

llvm-svn: 317651

6 years agoUpdate for llvm change.
Rafael Espindola [Wed, 8 Nov 2017 01:05:52 +0000 (01:05 +0000)]
Update for llvm change.

llvm-svn: 317650

6 years agoConvert FileOutputBuffer to Expected. NFC.
Rafael Espindola [Wed, 8 Nov 2017 01:05:44 +0000 (01:05 +0000)]
Convert FileOutputBuffer to Expected. NFC.

llvm-svn: 317649

6 years ago[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings;...
Eugene Zelenko [Wed, 8 Nov 2017 01:03:16 +0000 (01:03 +0000)]
[Serialization] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 317648

6 years agoTarget/TargetInstrInfo.h -> CodeGen/TargetInstrInfo.h to match layering
David Blaikie [Wed, 8 Nov 2017 01:01:31 +0000 (01:01 +0000)]
Target/TargetInstrInfo.h -> CodeGen/TargetInstrInfo.h to match layering

This header includes CodeGen headers, and is not, itself, included by
any Target headers, so move it into CodeGen to match the layering of its
implementation.

llvm-svn: 317647

6 years agoReapply: Allow yaml2obj to order implicit sections for ELF
Dave Lee [Wed, 8 Nov 2017 00:58:50 +0000 (00:58 +0000)]
Reapply: Allow yaml2obj to order implicit sections for ELF

Summary:
This change allows yaml input to control the order of implicitly added sections
(`.symtab`, `.strtab`, `.shstrtab`). The order is controlled by adding a
placeholder section of the given name to the Sections field.

This change is to support changes in D39582, where it is desirable to control
the location of the `.dynsym` section.

This reapplied version fixes:
  1. use of a function call within an assert
  2. failing lld test which has an unnamed section

Additionally, one more test to cover the unnamed section failure.

Reviewers: compnerd, jakehehrlich

Reviewed By: jakehehrlich

Subscribers: llvm-commits

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

llvm-svn: 317646

6 years agoAMDGPU: Set correct sched model on v_mad_u64_u32
Matt Arsenault [Wed, 8 Nov 2017 00:48:25 +0000 (00:48 +0000)]
AMDGPU: Set correct sched model on v_mad_u64_u32

llvm-svn: 317645

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 8 Nov 2017 00:39:18 +0000 (00:39 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 317644

6 years agoFix compile issue on MSVC.
Douglas Yung [Wed, 8 Nov 2017 00:29:42 +0000 (00:29 +0000)]
Fix compile issue on MSVC.

llvm-svn: 317642

6 years agoRevert rL317618
Mitch Phillips [Wed, 8 Nov 2017 00:20:53 +0000 (00:20 +0000)]
Revert rL317618

The implemented pass fails and is breaking a large number of unit tests.
Example:
http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/5777/steps/build-stage3-compiler/logs/stdio

This reverts commit rL317618

llvm-svn: 317641

6 years ago[sanitizer] Asm implementation of syscall() for arm32.
Evgeniy Stepanov [Wed, 8 Nov 2017 00:15:12 +0000 (00:15 +0000)]
[sanitizer] Asm implementation of syscall() for arm32.

Summary:
These will be used in an ifunc resolver, when the binary may not be
completely relocated, and syscall() function from libc could not be
used.

Reviewers: dvyukov, vitalybuka

Subscribers: aemerson, kubamracek, javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 317640

6 years agoAttribute nonlazybind should not affect calls to functions with hidden visibility.
Sriraman Tallam [Wed, 8 Nov 2017 00:01:05 +0000 (00:01 +0000)]
Attribute nonlazybind should not affect calls to functions with hidden visibility.

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

llvm-svn: 317639

6 years ago(NFC) Rename GetMax{,User}VirtualAddress.
Evgeniy Stepanov [Tue, 7 Nov 2017 23:51:22 +0000 (23:51 +0000)]
(NFC) Rename GetMax{,User}VirtualAddress.

Future change will introduce GetMaxVirtualAddress that will not take
the kernel area into account.

llvm-svn: 317638

6 years agoFix unused variable error.
Rafael Espindola [Tue, 7 Nov 2017 23:43:01 +0000 (23:43 +0000)]
Fix unused variable error.

llvm-svn: 317637

6 years agoCleanup version symbol macros and attributes/declspecs
Jonathan Peyton [Tue, 7 Nov 2017 23:32:13 +0000 (23:32 +0000)]
Cleanup version symbol macros and attributes/declspecs

1) Get rid of xaliasify, xexpand and xversionify for KMP_EXPAND_NAME and
KMP_VERSION_SYMBOL. KMP_VERSION_SYMBOL is a combination of xaliasify and
xversionify.

2) Put all attribute and __declspec definitions in kmp_os.h

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

llvm-svn: 317636

6 years ago[coff] use relative instead of absolute __safe_se_handler_base when present
Bob Haarman [Tue, 7 Nov 2017 23:24:10 +0000 (23:24 +0000)]
[coff] use relative instead of absolute __safe_se_handler_base when present

Summary:
__safe_se_handler_base should be either absolute 0 (when no SafeSEH
table is present), or relative to the image base (when the table is
present). An earlier change inadvertedly made the symbol absolute in
both cases, leading to the SafeSEH table not being locatble at run
time. This change fixes that and updates the safeseh test to check for
the presence of the relocation.

Reviewers: rnk, ruiu

Reviewed By: ruiu

Subscribers: ruiu, llvm-commits

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

llvm-svn: 317635

6 years agoReapply r317609 with a simpler sed script, thanks to Justin Bogner!
Paul Robinson [Tue, 7 Nov 2017 23:17:43 +0000 (23:17 +0000)]
Reapply r317609 with a simpler sed script, thanks to Justin Bogner!

llvm-svn: 317634

6 years agoDelete dead code.
Rafael Espindola [Tue, 7 Nov 2017 23:12:41 +0000 (23:12 +0000)]
Delete dead code.

llvm-svn: 317633

6 years agoUse std::thread directly.
Rafael Espindola [Tue, 7 Nov 2017 23:09:54 +0000 (23:09 +0000)]
Use std::thread directly.

Now that this code is posix only we don't need to use runBackground.

llvm-svn: 317632

6 years agoSimplify unlinkAsync.
Rafael Espindola [Tue, 7 Nov 2017 23:01:37 +0000 (23:01 +0000)]
Simplify unlinkAsync.

It used to rename the file before removing it in a background thread.

A simpler way to delay the removal is simply to open the file.

Since this is a posix specific issue, simplify the windows
implementation.

llvm-svn: 317631

6 years agoRevert "Allow yaml2obj to order implicit sections for ELF"
Dave Lee [Tue, 7 Nov 2017 22:51:27 +0000 (22:51 +0000)]
Revert "Allow yaml2obj to order implicit sections for ELF"

Also, revert "Fix build bots after r317622"

This reverts commit r317622, r317626.

llvm-svn: 317630

6 years agoRevert r317609, test fails on one bot
Paul Robinson [Tue, 7 Nov 2017 22:39:12 +0000 (22:39 +0000)]
Revert r317609, test fails on one bot

llvm-svn: 317628

6 years agoChange noplt.c to work for non-x86 targets.
Sriraman Tallam [Tue, 7 Nov 2017 22:34:55 +0000 (22:34 +0000)]
Change noplt.c to work for non-x86 targets.

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

llvm-svn: 317627

6 years agoFix build bots after r317622
Dave Lee [Tue, 7 Nov 2017 22:33:07 +0000 (22:33 +0000)]
Fix build bots after r317622

Example build failure: http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/14660

TIL that the warning flags for local builds are loose compared to what build
servers use.

llvm-svn: 317626