platform/upstream/llvm.git
9 years agoSelectionDAGBuilder: Rangeify a loop. NFC.
Hans Wennborg [Fri, 20 Mar 2015 18:48:40 +0000 (18:48 +0000)]
SelectionDAGBuilder: Rangeify a loop. NFC.

llvm-svn: 232831

9 years agoSelectionDAGBuilder::handleJTSwitchCase, simplify loop; NFC
Hans Wennborg [Fri, 20 Mar 2015 18:48:31 +0000 (18:48 +0000)]
SelectionDAGBuilder::handleJTSwitchCase, simplify loop; NFC

llvm-svn: 232830

9 years ago[UBSan] Don't allow to use UBSan with anything except for ASan.
Alexey Samsonov [Fri, 20 Mar 2015 18:45:06 +0000 (18:45 +0000)]
[UBSan] Don't allow to use UBSan with anything except for ASan.

We are not able to make a reliable solution for using UBSan together
with other sanitizers with runtime support (and sanitizer_common).
Instead, we want to follow the path used for LSan: have a "standalone"
UBSan tool, and plug-in UBSan that would be explicitly embedded into
specific sanitizers (in short term, it will be only ASan).

llvm-svn: 232829

9 years agoRewrite test/Feature/md_on_instruction.ll
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 18:34:53 +0000 (18:34 +0000)]
Rewrite test/Feature/md_on_instruction.ll

This test is supposed to be testing whether metadata attachments to
instructions work, but it was using invalid debug info to do so.  (This
was causing assertion failures in the `DebugInfoFinder` with a WIP patch
to be more strict about `DIDescriptor` accessors.)

Rather than fix the debug info -- which is better tested elsewhere --
just test the IR feature directly.

llvm-svn: 232828

9 years agoCorrectly estimate SROA savings for store operands in inline cost analysis.
Wei Mi [Fri, 20 Mar 2015 18:33:12 +0000 (18:33 +0000)]
Correctly estimate SROA savings for store operands in inline cost analysis.

When estimating SROA savings, we want to see if an address is derived
off an alloca in the caller. For store instructions, operand 1 is the
address operand, but the current code uses operand 0.  Use
getPointerOperand for loads and stores to fix this.

Patch by Easwaran Raman.
http://reviews.llvm.org/D8425

llvm-svn: 232827

9 years agoSmall optimization to avoid getting pass info when we will not run loop
Daniel Berlin [Fri, 20 Mar 2015 18:05:49 +0000 (18:05 +0000)]
Small optimization to avoid getting pass info when we will not run loop

llvm-svn: 232826

9 years ago[ARM] Fix handling of thumb1 out-of-range frame offsets
John Brawn [Fri, 20 Mar 2015 17:20:07 +0000 (17:20 +0000)]
[ARM] Fix handling of thumb1 out-of-range frame offsets

LocalStackSlotPass assumes that isFrameOffsetLegal doesn't change its
answer when the base register changes. Unfortunately this isn't true
in thumb1, where SP-based loads allow a larger offset than
non-SP-based loads, and this causes the base register reuse code to
generate instructions that are unencodable, causing an assertion
failure.

Solve this by adding a BaseReg parameter to isFrameOffsetLegal, which
ARMBaseRegisterInfo can then make use of to give the correct answer.

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

llvm-svn: 232825

9 years agoMS ABI: Accept calls to an unprototyped declaration of _setjmp
David Majnemer [Fri, 20 Mar 2015 17:03:35 +0000 (17:03 +0000)]
MS ABI: Accept calls to an unprototyped declaration of _setjmp

This fixes PR22961.

llvm-svn: 232824

9 years agoTry to fix configure/make build.
Zachary Turner [Fri, 20 Mar 2015 16:23:40 +0000 (16:23 +0000)]
Try to fix configure/make build.

llvm-svn: 232823

9 years agoStripped trailing whitespace. NFC.
Simon Pilgrim [Fri, 20 Mar 2015 16:08:17 +0000 (16:08 +0000)]
Stripped trailing whitespace. NFC.

llvm-svn: 232822

9 years agoRewrite StackMap location handling to pre-compute the dwarf register
Eric Christopher [Fri, 20 Mar 2015 16:03:42 +0000 (16:03 +0000)]
Rewrite StackMap location handling to pre-compute the dwarf register
numbers before emission.

This removes a dependency on being able to access TRI at the module
level and is similar to the DwarfExpression handling. I've modified
the debug support into print/dump routines that'll do the same dumping
but is now callable anywhere and if TRI isn't available will go ahead
and just print out raw register numbers.

llvm-svn: 232821

9 years agoAt the beginning of doFinalization set the MachineFunction to
Eric Christopher [Fri, 20 Mar 2015 16:03:39 +0000 (16:03 +0000)]
At the beginning of doFinalization set the MachineFunction to
nullptr so that users get an earlier dereferencing error and
so that we can use it to conditionalize access to MachineFunction
specific data.

llvm-svn: 232820

9 years agoTypo.
Chad Rosier [Fri, 20 Mar 2015 15:45:14 +0000 (15:45 +0000)]
Typo.

llvm-svn: 232819

9 years agoR600/SI: Refactor VOP2 instruction defs
Tom Stellard [Fri, 20 Mar 2015 15:14:23 +0000 (15:14 +0000)]
R600/SI: Refactor VOP2 instruction defs

llvm-svn: 232817

9 years agoR600/SI: Refactor VOP1 instruction defs
Tom Stellard [Fri, 20 Mar 2015 15:14:21 +0000 (15:14 +0000)]
R600/SI: Refactor VOP1 instruction defs

llvm-svn: 232816

9 years agoAdd missing cases to NativeProcessLinux LogThreadStopInfo
Pavel Labath [Fri, 20 Mar 2015 14:45:13 +0000 (14:45 +0000)]
Add missing cases to NativeProcessLinux LogThreadStopInfo

Test Plan: No tests, this is just a debug logging function.

Reviewers: tberghammer

Subscribers: lldb-commits

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

llvm-svn: 232815

9 years agoReduce indentation after return. NFC.
Rafael Espindola [Fri, 20 Mar 2015 14:33:25 +0000 (14:33 +0000)]
Reduce indentation after return. NFC.

llvm-svn: 232814

9 years agoUse early returns. NFC.
Rafael Espindola [Fri, 20 Mar 2015 14:23:46 +0000 (14:23 +0000)]
Use early returns. NFC.

llvm-svn: 232813

9 years ago[ASan] fix litling warnings for coverage-order-pcs.cc
Alexander Potapenko [Fri, 20 Mar 2015 14:11:05 +0000 (14:11 +0000)]
[ASan] fix litling warnings for coverage-order-pcs.cc

llvm-svn: 232812

9 years agoFold a llvm_unreachable into an assert. NFC.
Rafael Espindola [Fri, 20 Mar 2015 13:50:15 +0000 (13:50 +0000)]
Fold a llvm_unreachable into an assert. NFC.

llvm-svn: 232811

9 years agoclang-format a function. NFC.
Rafael Espindola [Fri, 20 Mar 2015 13:47:40 +0000 (13:47 +0000)]
clang-format a function. NFC.

llvm-svn: 232810

9 years ago[ASan] Move a couple of Posix-specific tests to Posix/
Alexander Potapenko [Fri, 20 Mar 2015 13:42:11 +0000 (13:42 +0000)]
[ASan] Move a couple of Posix-specific tests to Posix/
Add a comment about potential breakage of coverage-maybe-open-file.cc on Win

llvm-svn: 232809

9 years ago[ASan] Move the coverage tests that work on Darwin to common testcase dir.
Alexander Potapenko [Fri, 20 Mar 2015 13:31:03 +0000 (13:31 +0000)]
[ASan] Move the coverage tests that work on Darwin to common testcase dir.

llvm-svn: 232808

9 years ago[Mips] Create special PLT entry in case of MIPS R6 ABI
Simon Atanasyan [Fri, 20 Mar 2015 11:28:22 +0000 (11:28 +0000)]
[Mips] Create special PLT entry in case of MIPS R6 ABI

llvm-svn: 232806

9 years agoFix ninja check-lldb
Pavel Labath [Fri, 20 Mar 2015 11:24:36 +0000 (11:24 +0000)]
Fix ninja check-lldb

Ninja apparently has issues with commands writing nul characters '\0' to stdout. When it
encounters a nul character, the rest of the output is skipped (I will file a bug with ninja about
that). This breaks the linux buildbot since it parses the ninja check-lldb output to get a list
of failures.

Recently, we have started outputting nul characters in lldb-server tests. This is probably
a bug in itself, but I am not addressing that now. This is just a workaround commit, which
prevents the nul characters from appearing in the output, and gets the buildbot operational again.

llvm-svn: 232805

9 years ago[MBP] Don't outline short optional branches
Daniel Jasper [Fri, 20 Mar 2015 10:00:37 +0000 (10:00 +0000)]
[MBP] Don't outline short optional branches

With the option -outline-optional-branches, LLVM will place optional
branches out of line (more details on r231230).

With this patch, this is not done for short optional branches. A short
optional branch is a branch containing a single block with an
instruction count below a certain threshold (defaulting to 3). Still
everything is guarded under -outline-optional-branches).

Outlining a short branch can't significantly improve code locality. It
can however decrease performance because of the additional jmp and in
cases where the optional branch is hot. This fixes a compile time
regression I have observed in a benchmark.

Review: http://reviews.llvm.org/D8108
llvm-svn: 232802

9 years agoSupport for truncate/append on log files
Pavel Labath [Fri, 20 Mar 2015 09:43:20 +0000 (09:43 +0000)]
Support for truncate/append on log files

Summary:
Presently, if a log file already exists, lldb simply starts overwriting bits of it, without
truncating or anything. This patch makes it use eFileOptionFileTruncate by default. It also adds
an --append option, which will append to the file without truncating. A test is included.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 232801

9 years ago[MSVC] Explicit specializations can be declared in any namespace (fix for http:/...
Alexey Bataev [Fri, 20 Mar 2015 07:21:46 +0000 (07:21 +0000)]
[MSVC] Explicit specializations can be declared in any namespace (fix for llvm.org/PR13738)

MS compiler emits no errors in case of explicit specializations outside declaration enclosing namespaces, even when language extensions are disabled.
The patch is to suppress errors and emit extension warnings if explicit specializations are not declared in the corresponding namespaces.
This fixes PR13738.

Patch by Alexey Frolov.

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

llvm-svn: 232800

9 years agoInstrProf: Make profile variables private to reduce binary size overhead
Justin Bogner [Fri, 20 Mar 2015 06:34:38 +0000 (06:34 +0000)]
InstrProf: Make profile variables private to reduce binary size overhead

When we instrument a program for profiling, we copy the linkage of an
instrumented function so that our datastructures merge in the same way
as the function. This avoids redundant copies for things like
linkonce, but ends up emitting names we never need to reference for
normal and internal symbols. Promoting internal and external linkage
to private for these variables reduces the size overhead of profiling
drastically.

llvm-svn: 232799

9 years ago[Tablegen] Attempt to add support for patterns containing nodes with multiple results.
Craig Topper [Fri, 20 Mar 2015 05:09:06 +0000 (05:09 +0000)]
[Tablegen] Attempt to add support for patterns containing nodes with multiple results.

This is needed for AVX512 masked scatter/gather support.

The R600 change is necessary to remove a hack that was working around the lack of multiple results.

llvm-svn: 232798

9 years agoR600/SI: Add missing CHECK-LABEL lines to a test
Tom Stellard [Fri, 20 Mar 2015 03:12:42 +0000 (03:12 +0000)]
R600/SI: Add missing CHECK-LABEL lines to a test

llvm-svn: 232797

9 years agoFix comment from r232794. NFC
Nick Lewycky [Fri, 20 Mar 2015 02:52:23 +0000 (02:52 +0000)]
Fix comment from r232794. NFC

llvm-svn: 232796

9 years ago[bpf] fix build
Alexei Starovoitov [Fri, 20 Mar 2015 02:35:29 +0000 (02:35 +0000)]
[bpf] fix build

fix BPF backend build broken by r232699

llvm-svn: 232795

9 years agoWhen simplifying a SCEV truncate by distributing, consider it a simplification to...
Nick Lewycky [Fri, 20 Mar 2015 02:25:00 +0000 (02:25 +0000)]
When simplifying a SCEV truncate by distributing, consider it a simplification to replace a cast, even if we end up with a trunc around the term. Fixes PR22960!

llvm-svn: 232794

9 years ago[modules] Remove some redundant work when building a lookup table for a DeclContext.
Richard Smith [Fri, 20 Mar 2015 02:17:21 +0000 (02:17 +0000)]
[modules] Remove some redundant work when building a lookup table for a DeclContext.

When we need to build the lookup table for a DeclContext, we used to pull in
all lexical declarations for the context; instead, just build a lookup table
for the local lexical declarations. We previously didn't guarantee that the
imported declarations would be in the returned map, but in some cases we'd
happen to put them all in there regardless. Now we're even lazier about this.

This unnecessary work was papering over some other bugs:

 - LookupVisibleDecls would use the DC for name lookups in the TU in C, and
   this was not guaranteed to find all imported names (generally, the DC for
   the TU in C is not a reliable place to perform lookups). We now use an
   identifier-based lookup mechanism for this.

 - We didn't actually load in the list of eagerly-deserialized declarations
   when importing a module (so external definitions in a module wouldn't be
   emitted by users of those modules unless they happened to be deserialized
   by the user of the module).

llvm-svn: 232793

9 years agoSampleProfile: Check for missing debug locations
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 00:56:55 +0000 (00:56 +0000)]
SampleProfile: Check for missing debug locations

Don't use `DebugLoc` accessors if we're pointing at null, which will be
a problem after a WIP patch to make the `DIDescriptor` accessors more
strict.  Caught by Frontend/profile-sample-use-loc-tracking.c (in
clang).

llvm-svn: 232792

9 years agoDebugInfo: Check for null before using DIType
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 00:53:40 +0000 (00:53 +0000)]
DebugInfo: Check for null before using DIType

A WIP patch to turn on stricter `DIDescriptor` accessor checks fires
here; it's obvious from the code that `T` can be null, so add an
explicit check.  Caught by dozens of current testcases.

llvm-svn: 232791

9 years agoVerifier: Remove the separate DebugInfoVerifier class
Duncan P. N. Exon Smith [Fri, 20 Mar 2015 00:48:23 +0000 (00:48 +0000)]
Verifier: Remove the separate DebugInfoVerifier class

Remove the separate `DebugInfoVerifier` class, as a partial step toward
better integrating debug info verification with the `Verifier`.

Right now, verification of debug info is kind of a mess.

  - There are `DIDescriptor::Verify()` checks live in `DebugInfo.cpp`.
    These return `bool`, and there's no way to see (except by opening a
    debugger) why they fail.
  - We rely on `DebugInfoFinder` to traverse the debug info graph and
    dig up nodes.  However, the regular `Verifier` visits many of these
    nodes when it calls into debug info intrinsic operands.  Visiting
    twice and running different checks is kind of absurd.
  - Moreover, `DebugInfoFinder` asserts on failed type resolution -- the
    verifier should never assert!

By integrating the two verifiers, I'm aiming at solving these problems
(work to be done, obviously).  Verification can be localized to the
`Verifier`; we can use a naive `MDNode` operand traversal to find all
the nodes; we can verify type references instead of asserting on
failure.

There are `assert()`s sprinkled throughout the optimizer and dwarf
backend on `DIDescriptor::Verify()` checks.  This is a hangover from
when the debug info verifier was off, so I plan to remove them as I go
(once I confirm that the checks are done at verification time).

Note: to keep the behaviour of only running the debug info verifier when
-verify succeeds, I've added an `EverBroken` flag.  Once the
`DebugInfoFinder` assertions are gone and the two traversals have been
merged, I expect to be able to remove this.

llvm-svn: 232790

9 years agoRewrite SelectionDAGBuilder::Clusterify to run in linear time. NFC.
Hans Wennborg [Fri, 20 Mar 2015 00:41:03 +0000 (00:41 +0000)]
Rewrite SelectionDAGBuilder::Clusterify to run in linear time. NFC.

It was previously repeatedly erasing elements from the middle of a vector,
causing O(n^2) worst-case run-time.

llvm-svn: 232789

9 years agoC++14: Disable sized deallocation by default due to ABI breakage
Reid Kleckner [Fri, 20 Mar 2015 00:31:07 +0000 (00:31 +0000)]
C++14: Disable sized deallocation by default due to ABI breakage

There are no widely deployed standard libraries providing sized
deallocation functions, so we have to punt and ask the user if they want
us to use sized deallocation. In the future, when such libraries are
deployed, we can teach the driver to detect them and enable this
feature.

N3536 claimed that a weak thunk from sized to unsized deallocation could
be emitted to avoid breaking backwards compatibility with standard
libraries not providing sized deallocation. However, this approach and
other variations don't work in practice.

With the weak function approach, the thunk has to have default
visibility in order to ensure that it is overridden by other DSOs
providing sized deallocation. Weak, default visibility symbols are
particularly expensive on MachO, so John McCall was considering
disabling this feature by default on Darwin. It also changes behavior
ELF linking behavior, causing certain otherwise unreferenced object
files from an archive to be pulled into the link.

Our second approach was to use an extern_weak function declaration and
do an inline conditional branch at the deletion call site. This doesn't
work because extern_weak only works on MachO if you have some archive
providing the default value of the extern_weak symbol. Arranging to
provide such an archive has the same challenges as providing the symbol
in the standard library. Not to mention that extern_weak doesn't really
work on COFF.

Reviewers: rsmith, rjmccall

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

llvm-svn: 232788

9 years agoAllow -fsanitize-coverage with -fsanitize=dataflow
Kostya Serebryany [Fri, 20 Mar 2015 00:06:52 +0000 (00:06 +0000)]
Allow -fsanitize-coverage with -fsanitize=dataflow

Summary: Allow -fsanitize-coverage with -fsanitize=dataflow

Test Plan: check-clang

Reviewers: pcc

Reviewed By: pcc

Subscribers: cfe-commits

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

llvm-svn: 232787

9 years agoDon't crash-on-valid when an inline function is friend of class template
David Majnemer [Fri, 20 Mar 2015 00:02:27 +0000 (00:02 +0000)]
Don't crash-on-valid when an inline function is friend of class template

We assumed that the most recent declaration of an inline function would
also be inline.  However, a more recent declaration can come from a
friend declaration in a class template that is instantiated at the
definition of the function.

llvm-svn: 232786

9 years agotest: Make a start on a test suite for libLTO.
Peter Collingbourne [Thu, 19 Mar 2015 23:55:38 +0000 (23:55 +0000)]
test: Make a start on a test suite for libLTO.

This works in a similar way to the gold plugin tests. We search for a compatible
linker on $PATH and use it to run tests against our just-built libLTO. To start
with, test the just added opt level functionality.

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

llvm-svn: 232785

9 years agoReport watchpoint hits during single stepping.
Chaoren Lin [Thu, 19 Mar 2015 23:28:10 +0000 (23:28 +0000)]
Report watchpoint hits during single stepping.

Summary:
Reorganized NativeProcessLinux::MonitorSIGTRAP to check for watchpoint hits on
TRAP_TRACE.

Added test for stepping over watchpoints.

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

Reviewers: ovyalov, tberghammer, vharron, clayborg

Subscribers: jingham, labath, lldb-commits

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

llvm-svn: 232784

9 years agoUse the cached subtarget on the MachineFunction when the AsmPrinter
Eric Christopher [Thu, 19 Mar 2015 23:27:42 +0000 (23:27 +0000)]
Use the cached subtarget on the MachineFunction when the AsmPrinter
will have a MachineFunction, i.e. in places other than the module
level doInitialize/doFinalize.

llvm-svn: 232783

9 years agoUse the cached subtarget off of the machine function.
Eric Christopher [Thu, 19 Mar 2015 23:06:21 +0000 (23:06 +0000)]
Use the cached subtarget off of the machine function.

llvm-svn: 232782

9 years agomove insert, extract, concat helper functions closer to related helper functions...
Sanjay Patel [Thu, 19 Mar 2015 23:04:25 +0000 (23:04 +0000)]
move insert, extract, concat helper functions closer to related helper functions; NFCI

llvm-svn: 232781

9 years agoFix a nasty bug in DAGCombine of STORE nodes.
Owen Anderson [Thu, 19 Mar 2015 22:48:57 +0000 (22:48 +0000)]
Fix a nasty bug in DAGCombine of STORE nodes.

This is very related to the bug fixed in r174431.  The problem is that
SelectionDAG does not include alignment in the uniquing of loads and
stores.  When an otherwise no-op DAGCombine would increase the alignment
of a load or store, the original node would be returned (with the
alignment increased), which would cause the node not to be processed by
any further DAGCombines.

I don't have a direct testcase for this that manifests on an in-tree
target, but I did see some noise in the tests for other targets and have
updated them for it.

llvm-svn: 232780

9 years agoClang follow-up to LLVM r232772
Duncan P. N. Exon Smith [Thu, 19 Mar 2015 22:43:38 +0000 (22:43 +0000)]
Clang follow-up to LLVM r232772

-verify-di is dead! Long live -verify!

llvm-svn: 232779

9 years ago[Modules] Implement __builtin_isinf_sign in Clang.
Chandler Carruth [Thu, 19 Mar 2015 22:39:51 +0000 (22:39 +0000)]
[Modules] Implement __builtin_isinf_sign in Clang.

Somehow, we never managed to implement this fully. We could constant
fold it like crazy, including constant folding complex arguments, etc.
But if you actually needed to generate code for it, error.

I've implemented it using the somewhat obvious lowering. Happy for
suggestions on a more clever way to lower this.

Now, what you might ask does this have to do with modules? Fun story. So
it turns out that libstdc++ actually uses __builtin_isinf_sign to
implement std::isinf when in C++98 mode, but only inside of a template.
So if we're lucky, and we never instantiate that, everything is good.
But once we try to instantiate that template function, we need this
builtin. All of my customers at least are using C++11 and so they never
hit this code path.

But what does that have to do with modules? Fun story. So it turns out
that with modules we actually observe a bunch of bugs in libstdc++ where
their <cmath> header clobbers things exposed by <math.h>. To fix these,
we have to provide global function definitions to replace the macros
that C99 would have used. And it turns out that ::isinf needs to be
implemented using the exact semantics used by the C++98 variant of
std::isinf. And so I started to fix this bug in libstdc++ and ceased to
be able to compile libstdc++ with Clang.

The yaks are legion.

llvm-svn: 232778

9 years agoRemove unused headers.
Eric Christopher [Thu, 19 Mar 2015 22:36:38 +0000 (22:36 +0000)]
Remove unused headers.

llvm-svn: 232777

9 years agoAdd an MCSubtargetInfo variable to the TargetMachine.
Eric Christopher [Thu, 19 Mar 2015 22:36:37 +0000 (22:36 +0000)]
Add an MCSubtargetInfo variable to the TargetMachine.

This enables us to remove calls to the subtarget from the TargetMachine
and with a small hack for backends that require global subtarget
information for module level code generation, e.g. mips abi flags, as
mentioned in a fixme in the code.

llvm-svn: 232776

9 years agoAdd a TargetMachine local MCRegisterInfo and MCInstrInfo so that
Eric Christopher [Thu, 19 Mar 2015 22:36:32 +0000 (22:36 +0000)]
Add a TargetMachine local MCRegisterInfo and MCInstrInfo so that
they can be used without a subtarget in constructing subtarget
independent passes.

llvm-svn: 232775

9 years agoWinEH: Make llvm.eh.actions emission match the EH docs
Reid Kleckner [Thu, 19 Mar 2015 22:31:02 +0000 (22:31 +0000)]
WinEH: Make llvm.eh.actions emission match the EH docs

This switches the sense of the i32 values and updates the test cases.

We can also use CHECK-SAME to clean up some tests, and reduce the visual
noise from bitcasts.

llvm-svn: 232774

9 years ago[X86, AVX] use blends instead of insert128 with index 0
Sanjay Patel [Thu, 19 Mar 2015 22:29:40 +0000 (22:29 +0000)]
[X86, AVX] use blends instead of insert128 with index 0

Another case of x86-specific shuffle strength reduction:
avoid generating insert*128 instructions with index 0 because
they are slower than their non-lane-changing blend equivalents.

Shuffle lowering already catches most of these cases, but
the zero vector case and some other paths such as in the
modified test in vector-shuffle-256-v32.ll were getting
through.

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

llvm-svn: 232773

9 years agoVerifier: Remove the separate -verify-di pass
Duncan P. N. Exon Smith [Thu, 19 Mar 2015 22:24:17 +0000 (22:24 +0000)]
Verifier: Remove the separate -verify-di pass

Remove `DebugInfoVerifierLegacyPass` and the `-verify-di` pass.
Instead, call into the `DebugInfoVerifier` from inside
`VerifierLegacyPass::finalizeModule()`.  This better matches the logic
in `verifyModule()` (used by the new PassManager), avoids requiring two
separate passes to verify the IR, and makes the API for "add a pass to
verify the IR" simple.

Note: the `-verify-debug-info` flag still works (for now, at least;
eventually it might make sense to just remove it).

llvm-svn: 232772

9 years agoFix build failure.
Peter Collingbourne [Thu, 19 Mar 2015 22:12:08 +0000 (22:12 +0000)]
Fix build failure.

llvm-svn: 232771

9 years agoLowerBitSets: Avoid reusing byte set addresses.
Peter Collingbourne [Thu, 19 Mar 2015 22:02:10 +0000 (22:02 +0000)]
LowerBitSets: Avoid reusing byte set addresses.

Each use of the byte array uses a different alias. This makes the
backend less likely to reuse previously computed byte array addresses,
improving the security of the CFI mechanism based on this pass.

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

llvm-svn: 232770

9 years agolibLTO, llvm-lto, gold: Introduce flag for controlling optimization level.
Peter Collingbourne [Thu, 19 Mar 2015 22:01:00 +0000 (22:01 +0000)]
libLTO, llvm-lto, gold: Introduce flag for controlling optimization level.

This change also introduces a link-time optimization level of 1. This
optimization level runs only the globaldce pass as well as cleanup passes for
passes that run at -O0, specifically simplifycfg which cleans up lowerbitsets.

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150316/266951.html

llvm-svn: 232769

9 years agoMove LLDB initialization/shutdown to Initialization.
Zachary Turner [Thu, 19 Mar 2015 22:00:21 +0000 (22:00 +0000)]
Move LLDB initialization/shutdown to Initialization.

This creates a new top-level folder called Initialization which
is intended to hold code specific to LLDB system initialization.
Currently this holds the Initialize() and Terminate() functions,
as well as the fatal error handler.

This provides a means to break the massive dependency cycle which
is caused by the fact that Debugger depends on Initialize and
Terminate which then depends on the entire LLDB project.  With
this structure, it will be possible for applications to invoke
lldb_private::Initialize() directly, and have that invoke
Debugger::Initialize.

llvm-svn: 232768

9 years agoFix SBFrame::FindValue for when only global variables exist.
Chaoren Lin [Thu, 19 Mar 2015 22:00:13 +0000 (22:00 +0000)]
Fix SBFrame::FindValue for when only global variables exist.

Summary:
sc.block->AppendVariables(...) returns 0 if there are no arguments or local
variables, but we still need to check for global variables.

Test Plan:
```
$ cat test.cpp
int i;
int main() {
}
$ lldb test -o 'b main' -o r
(lldb) script
>>> print lldb.frame.FindValue('i', lldb.eValueTypeVariableGlobal)
(int) i = 0 # as opposed to "No value"
```

Reviewers: jingham, ovyalov, vharron, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

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

llvm-svn: 232767

9 years agoMS ABI: Implement the MSVC 2015 scheme for scope disambiguation
David Majnemer [Thu, 19 Mar 2015 21:54:30 +0000 (21:54 +0000)]
MS ABI: Implement the MSVC 2015 scheme for scope disambiguation

consider C++ that looks like:
  inline int &f(bool b) {
    if (b) {
      static int i;
      return i;
    }
    static int i;
    return i;
  }

Both 'i' variables must have distinct (and stable) names for linkage
purposes.  The MSVC 2013 ABI would number the variables using a count of
the number of scopes that have been created.  However, the final 'i'
returns to a scope that has already been created leading to a mangling
collision.

MSVC 2015 fixes this by giving the second 'i' the name it would have if
it were declared before the 'if'.  However, this results in ABI breakage
because the mangled name, in cases where there was no ambiguity, would
now be different.

We implement the new behavior and only enable it if we are targeting the
MSVC 2015 ABI, otherwise the old behavior will be used.

This fixes PR18131.

llvm-svn: 232766

9 years agoPassManagerBuilder: Remove effectively dead 'StripDebug' option
Duncan P. N. Exon Smith [Thu, 19 Mar 2015 21:37:17 +0000 (21:37 +0000)]
PassManagerBuilder: Remove effectively dead 'StripDebug' option

`StripDebug` was only used by tools/opt/opt.cpp in
`AddStandardLinkPasses()`, but opt.cpp adds the same pass based on its
command-line flag before it calls `AddStandardLinkPasses()`.  Stripping
debug info twice isn't very useful.

llvm-svn: 232765

9 years agoCreate macro to allow testing of is_convertible without the compiler builtin.
Eric Fiselier [Thu, 19 Mar 2015 21:11:02 +0000 (21:11 +0000)]
Create macro to allow testing of is_convertible without the compiler builtin.

Summary: This patch also fixes one test case that failed in the library version of is_convertible.

Reviewers: mclow.lists, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

llvm-svn: 232764

9 years ago[sanitizer] fix 'sancov.py merge' and add a test for it
Kostya Serebryany [Thu, 19 Mar 2015 21:01:27 +0000 (21:01 +0000)]
[sanitizer] fix 'sancov.py merge' and add a test for it

llvm-svn: 232763

9 years ago[libcxx] Unify LIBCXX_<ABI-Name>_INCLUDE_PATHS to be LIBCXX_CXX_ABI_INCLUDE_PATHS
Eric Fiselier [Thu, 19 Mar 2015 20:59:45 +0000 (20:59 +0000)]
[libcxx] Unify LIBCXX_<ABI-Name>_INCLUDE_PATHS to be LIBCXX_CXX_ABI_INCLUDE_PATHS

Summary:
Clean up all the different possible CMake options for specifying the ABI include paths into one CMake option named `LIBCXX_CXX_ABI_INCLUDE_PATHS`.
The documentation has been updated to reflect this change.

For the next week I have added explicit errors if any of the old flags is used. These errors inform users of the change and the new option to use.

Before committing the change I will announce this change on cfe-dev.

Reviewers: danalbert, mclow.lists

Reviewed By: danalbert, mclow.lists

Subscribers: jroelofs, cbergstrom, cfe-commits

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

llvm-svn: 232762

9 years ago[Mips] Add comments to the relocation calculation functions
Simon Atanasyan [Thu, 19 Mar 2015 20:56:34 +0000 (20:56 +0000)]
[Mips] Add comments to the relocation calculation functions

No functional changes.

llvm-svn: 232761

9 years agoCorrect typos in C11 generic-selection expressions.
Kaelyn Takata [Thu, 19 Mar 2015 20:56:07 +0000 (20:56 +0000)]
Correct typos in C11 generic-selection expressions.

llvm-svn: 232760

9 years agoSwitch lowering: extract NextBlock function. NFC.
Hans Wennborg [Thu, 19 Mar 2015 20:41:48 +0000 (20:41 +0000)]
Switch lowering: extract NextBlock function. NFC.

llvm-svn: 232759

9 years agoUnxfail test/CodeGen/Generic/vector.ll now passing on Hexagon
Krzysztof Parzyszek [Thu, 19 Mar 2015 20:22:17 +0000 (20:22 +0000)]
Unxfail test/CodeGen/Generic/vector.ll now passing on Hexagon

llvm-svn: 232758

9 years ago[Mips] Implement R_MIPS_PCHI16 / R_MIPS_PCLO16 relocations handling
Simon Atanasyan [Thu, 19 Mar 2015 19:59:17 +0000 (19:59 +0000)]
[Mips] Implement R_MIPS_PCHI16 / R_MIPS_PCLO16 relocations handling

llvm-svn: 232757

9 years ago[Mips] Implement R_MIPS_PC18_S3 relocation handling
Simon Atanasyan [Thu, 19 Mar 2015 19:59:06 +0000 (19:59 +0000)]
[Mips] Implement R_MIPS_PC18_S3 relocation handling

llvm-svn: 232756

9 years ago[Mips] Implement R_MIPS_PC19_S2 / R_MIPS_PC26_S2 relocations handling
Simon Atanasyan [Thu, 19 Mar 2015 19:58:58 +0000 (19:58 +0000)]
[Mips] Implement R_MIPS_PC19_S2 / R_MIPS_PC26_S2 relocations handling

llvm-svn: 232755

9 years ago[sanitizer] trying to fix sancov.py with 32-bit python
Kostya Serebryany [Thu, 19 Mar 2015 19:52:30 +0000 (19:52 +0000)]
[sanitizer] trying to fix sancov.py with 32-bit python

llvm-svn: 232754

9 years agoRemove unused diagnostic.
Benjamin Kramer [Thu, 19 Mar 2015 19:44:37 +0000 (19:44 +0000)]
Remove unused diagnostic.

Unused since r231851.

llvm-svn: 232751

9 years agoAdd -Wpartial-availability.
Nico Weber [Thu, 19 Mar 2015 19:18:22 +0000 (19:18 +0000)]
Add -Wpartial-availability.

This warns when using decls that are not available on all deployment targets.
For example, a call to

  - (void)ppartialMethod __attribute__((availability(macosx,introduced=10.8)));

will warn if -mmacosx-version-min is set to less than 10.8.

To silence the warning, one has to explicitly redeclare the method like so:

  @interface Whatever(MountainLionAPI)
  - (void)ppartialMethod;
  @end

This way, one cannot accidentally call a function that isn't available
everywhere.  Having to add the redeclaration will hopefully remind the user
to add an explicit respondsToSelector: call as well.

Some projects build against old SDKs to get this effect, but building against
old SDKs suppresses some bug fixes -- see http://crbug.com/463171 for examples.
The hope is that SDK headers are annotated well enough with availability
attributes that new SDK + this warning offers the same amount of protection
as using an old SDK.

llvm-svn: 232750

9 years agoRemove .CUDAIsDevice flags from CodeGenOpts as it's already
Artem Belevich [Thu, 19 Mar 2015 18:58:18 +0000 (18:58 +0000)]
Remove .CUDAIsDevice flags from CodeGenOpts as it's already
available in LangOpts.

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

llvm-svn: 232749

9 years agoFix -ast-dump of dependent new and delete exprs
Reid Kleckner [Thu, 19 Mar 2015 18:47:47 +0000 (18:47 +0000)]
Fix -ast-dump of dependent new and delete exprs

llvm-svn: 232748

9 years agoIgnore device-side asm constraint errors while compiling CUDA code for host and vice...
Artem Belevich [Thu, 19 Mar 2015 18:40:25 +0000 (18:40 +0000)]
Ignore device-side asm constraint errors while compiling CUDA code for host and vice versa.

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

llvm-svn: 232747

9 years agogold: Make powerpc support optional for the tests.
Peter Collingbourne [Thu, 19 Mar 2015 18:23:31 +0000 (18:23 +0000)]
gold: Make powerpc support optional for the tests.

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

llvm-svn: 232744

9 years agoGlobalDCE: Improve performance for large modules containing comdats.
Peter Collingbourne [Thu, 19 Mar 2015 18:23:29 +0000 (18:23 +0000)]
GlobalDCE: Improve performance for large modules containing comdats.

When we encounter a global with a comdat, rather than iterating over
every global in the module to find globals in the same comdat, store the
members in a multimap. This effectively lowers the complexity to O(N log N),
improving performance significantly for large modules such as might be
encountered during LTO.

It looks like we used to do something like this until r219191.

No functional change.

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

llvm-svn: 232743

9 years agodocs: Update llvm-cov docs for the -use-color flag
Justin Bogner [Thu, 19 Mar 2015 18:22:46 +0000 (18:22 +0000)]
docs: Update llvm-cov docs for the -use-color flag

llvm-svn: 232742

9 years agoAdded missing case for IK_PreprocessedCuda.
Artem Belevich [Thu, 19 Mar 2015 18:12:26 +0000 (18:12 +0000)]
Added missing case for IK_PreprocessedCuda.

llvm-svn: 232741

9 years agoAdd -ast-dump support for new and delete expressions to help figure out which operato...
Reid Kleckner [Thu, 19 Mar 2015 18:09:25 +0000 (18:09 +0000)]
Add -ast-dump support for new and delete expressions to help figure out which operator got selected

llvm-svn: 232740

9 years agoFix incremental linking with ninja and CMake 3.2+, see LLVM r232662 for details
Reid Kleckner [Thu, 19 Mar 2015 17:45:12 +0000 (17:45 +0000)]
Fix incremental linking with ninja and CMake 3.2+, see LLVM r232662 for details

llvm-svn: 232739

9 years agoRemove IDE_MI_APP_EXIT_OK msg on exit (MI)
Ilia K [Thu, 19 Mar 2015 17:40:15 +0000 (17:40 +0000)]
Remove IDE_MI_APP_EXIT_OK msg on exit (MI)

Summary: Remove IDE_MI_APP_EXIT_OK msg on exit (MI)

Reviewers: abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh

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

llvm-svn: 232738

9 years agoEnsure that we still parse preprocessed CUDA files as CUDA when we use
Artem Belevich [Thu, 19 Mar 2015 17:32:06 +0000 (17:32 +0000)]
Ensure that we still parse preprocessed CUDA files as CUDA when we use
-save-temps option.

Summary: Fixes PR22926.

Review: http://reviews.llvm.org/D8383
llvm-svn: 232737

9 years agoexpose 64 bit addresses through MI
Ilia K [Thu, 19 Mar 2015 17:27:23 +0000 (17:27 +0000)]
expose 64 bit addresses through MI

Summary:
This changes all reporting of addresses from lldb-mi to be 64 bit capable. There could have been cases where a 64 bit address was getting truncated to 32 bit format.

Patch from chuckr@microsoft.com

Reviewers: abidh, ChuckR

Reviewed By: abidh

Subscribers: paulmaybee, ki.stfu, zturner, lldb-commits

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

llvm-svn: 232736

9 years agoFix memory allocating inside signal handler (MI)
Ilia K [Thu, 19 Mar 2015 17:17:26 +0000 (17:17 +0000)]
Fix memory allocating inside signal handler (MI)

Summary:
This patch fixes a memory allocating inside signal handler.

This bug was found by @vharron:
> Hi all,
>
> I noticed these thread sanitizer warnings while running lldb-mi tests on
> Linux.
>
> WARNING: ThreadSanitizer: signal-unsafe call inside of a signal (pid=39721)
>
>     #0 operator new(unsigned long) <null>:0 (lldb-mi-3.7.0+0x000000092b9d)
>
>     #1 std::string::_Rep::_S_create(unsigned long, unsigned long,
> std::allocator<char> const&) <null>:0 (libstdc++.so.6+0x0000000ba3b8)
>
>     #2 CMICmnResources::GetStringFromResource(unsigned int, CMIUtilString&)
> const
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MICmnResources.cpp:434
> (lldb-mi-3.7.0+0x00000014ddd8)
>
>     #3 CMICmnResources::GetString(unsigned int) const
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MICmnResources.cpp:371
> (lldb-mi-3.7.0+0x00000014db81)
>
>     #4 sigwinch_handler(int)
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriverMain.cpp:99
> (lldb-mi-3.7.0+0x0000001589ff)
>
>     #5 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, int,
> my_siginfo_t*, void*) tsan_interceptors.o:0 (lldb-mi-3.7.0+0x00000009f25f)
>
>     #6 void std::this_thread::sleep_for<long, std::ratio<1l, 1000l>
> >(std::chrono::duration<long, std::ratio<1l, 1000l> > const&)
> /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/thread:279
> (lldb-mi-3.7.0+0x00000013243e)
>
>     #7 CMIDriver::ReadStdinLineQueue()
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriver.cpp:710
> (lldb-mi-3.7.0+0x000000155e62)
>
>     #8 CMIDriver::DoMainLoop()
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriver.cpp:631
> (lldb-mi-3.7.0+0x000000155d37)
>
>     #9 non-virtual thunk to CMIDriver::DoMainLoop()
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriver.cpp:648
> (lldb-mi-3.7.0+0x000000155fbd)
>
>     #10 CMIDriverMgr::DriverMainLoop()
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriverMgr.cpp:340
> (lldb-mi-3.7.0+0x000000159ee6)
>
>     #11 main
> /usr/local/google/home/vharron/ll/tot/llvm/tools/lldb/tools/lldb-mi/MIDriverMain.cpp:364
> (lldb-mi-3.7.0+0x000000158f60)

Reviewers: vharron, abidh

Reviewed By: abidh

Subscribers: lldb-commits, abidh, vharron

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

llvm-svn: 232735

9 years agoFix -break-insert for system functions (MI)
Ilia K [Thu, 19 Mar 2015 17:13:20 +0000 (17:13 +0000)]
Fix -break-insert for system functions (MI)

Summary:
# Fix -break-insert for system functions
# Fix MiExecTestCase to use -break-insert instead of CLI "b"
# Improve MiBreakTestCase: now it uses printf() instead of in-house function

All tests pass on OS X.

Test Plan:
```
$ bin/lldb-mi --interpreter
(gdb)
-file-exec-and-symbols ~/p/hello
^done
(gdb)
=shlibs-added,shlib-info=[num="1",name="hello",dyld-addr="-",reason="dyld",path="/Users/IliaK/p/hello",loaded_addr="-",dsym-objpath="/Users/IliaK/p/hello.dSYM/Contents/Resources/DWARF/hello"]
-break-insert -f printf
^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="??",file="??",fullname="??/??",line="0",pending=["printf"],times="0",original-location="printf"}
(gdb)
=breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0xffffffff",func="??",file="??",fullname="??/??",line="0",pending=["printf"],times="0",original-location="printf"}
-exec-run
^running
...
*stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x7fff8a476910",func="printf",args=[],file="??",fullname="??",line="-1"},thread-id="1",stopped-threads="all"
(gdb)
```

Reviewers: abidh, clayborg

Reviewed By: clayborg

Subscribers: lldb-commits, clayborg, abidh

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

llvm-svn: 232734

9 years agoAdd code to honor the match_not_bol and match_not_eol regex flats. Fixes PR#22651...
Marshall Clow [Thu, 19 Mar 2015 17:05:59 +0000 (17:05 +0000)]
Add code to honor the match_not_bol and match_not_eol regex flats. Fixes PR#22651. Thanks to Jim Porter for the report and suggested fix.

llvm-svn: 232733

9 years agoAdd support for __nvvm_reflect changes in libdevice in CUDA-7.0
Artem Belevich [Thu, 19 Mar 2015 17:05:35 +0000 (17:05 +0000)]
Add support for __nvvm_reflect changes in libdevice in CUDA-7.0

Summary:
CUDA 7.0's libdevice uses slightly different IR to call __nvvm_reflect
and that triggers an assertion in nvvm_reflect optimization pass. This
change allows nvvm_reflect pass to deal with both old and new ways to
pass an argument to __nvvm_reflect.

Test Plan: ninja check-all

Reviewers: eliben, echristo

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 232732

9 years agoRevert "Improvement on sized deallocation from r230160"
Reid Kleckner [Thu, 19 Mar 2015 17:03:58 +0000 (17:03 +0000)]
Revert "Improvement on sized deallocation from r230160"

This reverts commit r230580.

extern_weak functions don't appear to work on Darwin (PR22951), so we'll
need to come up with a new approach.

llvm-svn: 232731

9 years agoFixing dependencies for native tablegen.
Chris Bieneman [Thu, 19 Mar 2015 16:49:44 +0000 (16:49 +0000)]
Fixing dependencies for native tablegen.

The dependencies for cross-built tablegen were a bit confused. This fixes that. The following dependencies are now enforced:

(1) Tablegen tasks depend on the native tablegen
(2) Native tablegen depends on the cross-compiled tablegen

Although the native tablegen doesn't actually require the cross tablegen, having this dependency forces the native tablegen to rebuild whenever the cross tablegen changes.

llvm-svn: 232730

9 years agoSwitch lowering: remove unnecessary ConstantInt casts. NFC.
Hans Wennborg [Thu, 19 Mar 2015 16:42:21 +0000 (16:42 +0000)]
Switch lowering: remove unnecessary ConstantInt casts. NFC.

llvm-svn: 232729

9 years ago[Hexagon] Add support for vector instructions
Krzysztof Parzyszek [Thu, 19 Mar 2015 16:33:08 +0000 (16:33 +0000)]
[Hexagon] Add support for vector instructions

llvm-svn: 232728

9 years ago[CMake] Don't pass in MSVC warning flags as definitions.
Greg Bedwell [Thu, 19 Mar 2015 16:32:47 +0000 (16:32 +0000)]
[CMake] Don't pass in MSVC warning flags as definitions.

NFC currently but required as a prerequisite for using
the Microsoft resource compiler in conjunction with
CMake's ninja generator, which knows how to filter flags
appropriately, but not definitions.

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

llvm-svn: 232727

9 years agoDevirtualize Attr and all subclasses.
Benjamin Kramer [Thu, 19 Mar 2015 16:06:49 +0000 (16:06 +0000)]
Devirtualize Attr and all subclasses.

We know all subclasses in tblgen so just generate a giant switch for
the few virtual methods or turn them into a member variable using spare
bits. The giant jump tables aren't pretty but still much smaller than
a vtable for every attribute, shrinking Release+Asserts clang by ~400k.

Also halves the size of the Attr base class. No functional change
intended.

llvm-svn: 232726

9 years ago[Hexagon] ENDLOOP is a non-reversible conditional branch
Krzysztof Parzyszek [Thu, 19 Mar 2015 15:18:57 +0000 (15:18 +0000)]
[Hexagon] ENDLOOP is a non-reversible conditional branch

llvm-svn: 232725

9 years agoDon't close pseudo terminal master file descriptor on EOF
Tamas Berghammer [Thu, 19 Mar 2015 14:58:36 +0000 (14:58 +0000)]
Don't close pseudo terminal master file descriptor on EOF

Some application on Linux an all application on android close stdout and
stderr during the libc exit stage. Previously the master file descriptor
of the pseudo terminal used to communicate with the inferior was closed
on an EOF causing a race condition and a possible SIGHUP on process
exit. After this change the master file descriptor will be closed by the
destructor of the GDBRemoteCommunicationServerLLGS class.

Differential revision: http://reviews.llvm.org/D8436

llvm-svn: 232724