platform/upstream/llvm.git
9 years agoSearch through all memory regions of the core file for
Jason Molenda [Thu, 12 Feb 2015 06:14:23 +0000 (06:14 +0000)]
Search through all memory regions of the core file for
both a user process dyld and for a kernel binary -- we
will decide which to prefer after one or both have been
located.

It would be faster to stop the search thorugh the core
segments one we've found a dyld/kernel binary - but that
may trick us into missing the one we would prefer.

<rdar://problem/19806413>

llvm-svn: 228910

9 years agoCast EOF to get a proper comparison.
Justin Hibbits [Thu, 12 Feb 2015 05:31:46 +0000 (05:31 +0000)]
Cast EOF to get a proper comparison.

On PowerPC, and maybe some other architectures, 'char' is unsigned.  Comparing
an unsigned char with a signed int (-1) is always false.  To fix this, down-cast
EOF to a char.

llvm-svn: 228909

9 years agoQuiet Coverity
Justin Hibbits [Thu, 12 Feb 2015 05:31:31 +0000 (05:31 +0000)]
Quiet Coverity

Summary: Coverity warns that unsigned >= 0 is always true, and k_first_gpr_powerpc happens to be 0.  Quiet Coverity by changing that comparison instead to a static_assert(), in case things change in the future.

Reviewers: emaste

Reviewed By: emaste

Subscribers: lldb-commits

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

llvm-svn: 228908

9 years ago[ELF][Cleanup] Remove unused function
Shankar Easwaran [Thu, 12 Feb 2015 05:29:50 +0000 (05:29 +0000)]
[ELF][Cleanup] Remove unused function

We can add this function when we really have a need.

llvm-svn: 228907

9 years ago[ELF] Support --wrap option
Shankar Easwaran [Thu, 12 Feb 2015 05:02:46 +0000 (05:02 +0000)]
[ELF] Support --wrap option

Use a wrapper function for symbol. Any undefined reference to symbol will be
resolved to "__wrap_symbol". Any undefined reference to "__real_symbol" will be
resolved to symbol.

This can be used to provide a wrapper for a system function. The wrapper
function should be called "__wrap_symbol". If it wishes to call the system
function, it should call "__real_symbol".

Here is a trivial example:

void * __wrap_malloc (size_t c)
{
  printf ("malloc called with %zu\n", c);
  return __real_malloc (c);
}

If you link other code with this file using --wrap malloc, then all calls
to "malloc" will call the function "__wrap_malloc" instead. The call to
"__real_malloc" in "__wrap_malloc" will call the real "malloc" function.

llvm-svn: 228906

9 years ago[ELF] Add LinkingContext to the ELFReader.
Shankar Easwaran [Thu, 12 Feb 2015 05:02:41 +0000 (05:02 +0000)]
[ELF] Add LinkingContext to the ELFReader.

This adds the LinkingContext parameter to the ELFReader. Previously the flags in
that were needed in the Context was passed to the ELFReader, this made it very
hard to access data structures in the LinkingContext when reading an ELF file.

This change makes the ELFReader more flexible so that required parameters can be
grabbed directly from the LinkingContext.

Future patches make use of the changes.

There is no change in functionality though.

llvm-svn: 228905

9 years agounwind: use explicit memcpy for register saving
Saleem Abdulrasool [Thu, 12 Feb 2015 04:25:05 +0000 (04:25 +0000)]
unwind: use explicit memcpy for register saving

Convert the register saving code to use an explicit memcpy rather than the
implicit memcpy from the assignment.  This avoids warnings from -Wcast-qual on
GCC and makes the code more explicit.  Furthermore, use sizeof to calculate the
offsets rather than adding magic numbers, improving legibility of the code.
NFC.

llvm-svn: 228904

9 years agounwind: move exported APIs out of header
Saleem Abdulrasool [Thu, 12 Feb 2015 04:25:03 +0000 (04:25 +0000)]
unwind: move exported APIs out of header

Ideally, we would do something like inline __declspec(dllexport) to ensure that
the symbol was inlined within libunwind as well as emitted into the final DSO.
This simply moves the definition out of the header to ensure that the *public*
interfaces are defined and exported into the final DSO.

This change also has "gratuitous" code movement so that the EHABI and generic
implementations are co-located making it easier to find them.

The movement from the header has one minor change introduced into the code:
additional tracing to mirror the behaviour of the non-EHABI interfaces.

llvm-svn: 228903

9 years agoFix tests so they work when the linker is gcc
Filipe Cabecinhas [Thu, 12 Feb 2015 03:37:55 +0000 (03:37 +0000)]
Fix tests so they work when the linker is gcc

If the linker is gcc (the default for Generic_ELF toolchains), we end up
passing most of the arguments to the linker.

Some tests were failing to account for this in their usage of *-NOT: lines
and would fail if compiled with
-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-unknown

llvm-svn: 228902

9 years agoFixed a bug where CFLAA would crash the compiler.
George Burgess IV [Thu, 12 Feb 2015 03:07:07 +0000 (03:07 +0000)]
Fixed a bug where CFLAA would crash the compiler.

We would crash if we couldn't locate a Function that either Location's
Value belonged to. Now we just print out a debug message and return
conservatively.

llvm-svn: 228901

9 years agoPECOFF: make dumpbin tool happy.
Rui Ueyama [Thu, 12 Feb 2015 02:50:05 +0000 (02:50 +0000)]
PECOFF: make dumpbin tool happy.

The dumpbin tool in the MSVC toolchain cannot handle an executable created
by LLD if the executable contains a long section name.

In PE/COFF, a section name is stored to a section table entry. Because the
section name field in the table is only 8 byte long, a name longer than
that is stored to the string table and the offset in the string table is
stored to the section table entry instead.

In order to look up a string from the string table, tools need to handle
the symbol table, because the string table is defined as it immediately
follows the symbol table.

And seems the dumpbin doesn't like zero-length symbol table.

This patch teaches LLD how to emit a dummy symbol table. The dummy table
has one dummy entry in it.

llvm-svn: 228900

9 years ago[slp] Fix a nasty bug in the SLP vectorizer that Joerg pointed out.
Chandler Carruth [Thu, 12 Feb 2015 02:30:56 +0000 (02:30 +0000)]
[slp] Fix a nasty bug in the SLP vectorizer that Joerg pointed out.
Apparently some code finally started to tickle this after my
canonicalization changes to instcombine.

The bug stems from trying to form a vector type out of scalars that
aren't compatible at all. In this example, from x86_mmx values. The code
in the vectorizer that checks for reasonable types whas checking for
aggregates or vectors, but there are lots of other types that should
just never reach the vectorizer.

Debugging this was made more confusing by the lie in an assert in
VectorType::get() -- it isn't that the types are *primitive*. The types
must be integer, pointer, or floating point types. No other types are
allowed.

I've improved the assert and added a helper to the vectorizer to handle
the element type validity checks. It now re-uses the VectorType static
function and then further excludes weird target-specific types that we
probably shouldn't be touching here (x86_fp80 and ppc_fp128). Neither of
these are really reachable anyways (neither 80-bit nor 128-bit things
will get vectorized) but it seems better to just eagerly exclude such
nonesense.

I've added a test case, but while it definitely covers two of the paths
through this code there may be more paths that would benefit from test
coverage. I'm not familiar enough with the SLP vectorizer to synthesize
test cases for all of these, but was able to update the code itself by
inspection.

llvm-svn: 228899

9 years agoAdd InlineAsmDiagnosticHandler for bitcode input
Steven Wu [Thu, 12 Feb 2015 02:06:55 +0000 (02:06 +0000)]
Add InlineAsmDiagnosticHandler for bitcode input

Summary:
This patch installs an InlineAsmDiagnosticsHandler to avoid the crash
report when the input is bitcode and the bitcode contains invalid inline
assembly. The handler will simply print the same error message that will
print from the backend.

Add CHECK in test-case

Reviewers: echristo, rafael

Reviewed By: rafael

Subscribers: rafael, cfe-commits

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

llvm-svn: 228898

9 years agoMore for DR1467: In C++, when initializing an element of an aggregate,
Richard Smith [Thu, 12 Feb 2015 01:55:09 +0000 (01:55 +0000)]
More for DR1467: In C++, when initializing an element of an aggregate,
always use the normal copy-initialization rules. Remove a special case that
tries to stay within the list initialization checker here; that makes us do the
wrong thing when list-initialization of an aggregate would not perform
aggregate initialization.

llvm-svn: 228897

9 years agoImprove the "braces around scalar init" warning to determine whether to warn
Richard Smith [Thu, 12 Feb 2015 01:50:05 +0000 (01:50 +0000)]
Improve the "braces around scalar init" warning to determine whether to warn
based on whether "redundant" braces are ever reasonable as part of the
initialization of the entity, rather than whether the initialization is
"top-level". In passing, add a warning flag for it.

llvm-svn: 228896

9 years ago[PowerPC] Mark jumps as expensive (using using CR bits)
Hal Finkel [Thu, 12 Feb 2015 01:02:52 +0000 (01:02 +0000)]
[PowerPC] Mark jumps as expensive (using using CR bits)

On PowerPC, which has a full set of logical operations on (its multiple sets
of) condition-register bits, it is not profitable to break of complex
conditions feeding a jump into multiple jumps. We can turn off this feature of
CGP/SDAGBuilder by marking jumps as "expensive".

P7 test-suite speedups (no regressions):
MultiSource/Benchmarks/FreeBench/pcompress2/pcompress2
-0.626647% +/- 0.323583%
MultiSource/Benchmarks/Olden/power/power
-18.2821% +/- 8.06481%

llvm-svn: 228895

9 years ago[Sanitizer] Change InitializeFlags() signatures. NFC.
Alexey Samsonov [Thu, 12 Feb 2015 00:36:42 +0000 (00:36 +0000)]
[Sanitizer] Change InitializeFlags() signatures. NFC.

These functions are always used to initialize singleton flags(), as
well as other global data (common_flags()).

llvm-svn: 228894

9 years ago[Sanitizer] Add "final" specifier to FlagHandlerBase::Parse overrides. NFC.
Alexey Samsonov [Thu, 12 Feb 2015 00:36:39 +0000 (00:36 +0000)]
[Sanitizer] Add "final" specifier to FlagHandlerBase::Parse overrides. NFC.

llvm-svn: 228893

9 years agoMake a more complete fix for always supplying an execution context when getting byte...
Greg Clayton [Thu, 12 Feb 2015 00:34:25 +0000 (00:34 +0000)]
Make a more complete fix for always supplying an execution context when getting byte sizes from types.

There was a test in the test suite that was triggering the backtrace logging output that requested that the client pass an execution context. Sometimes we need the process for Objective C types because our static notion of the type might not align with the reality when being run in a live runtime.

Switched from an "ExecutionContext *" to an "ExecutionContextScope *" for greater ease of use.

llvm-svn: 228892

9 years agoRevert "Change Path::filename_pos() to skip the drive letter."
Zachary Turner [Thu, 12 Feb 2015 00:05:49 +0000 (00:05 +0000)]
Revert "Change Path::filename_pos() to skip the drive letter."

This reverts commit 228874.  For some reason users reported
seeing Clang taking up 25+GB of memory and bringing down
machines with this change.  Reverting until we figure it out.

llvm-svn: 228890

9 years agoInvert the section relocation map.
Rafael Espindola [Wed, 11 Feb 2015 23:38:33 +0000 (23:38 +0000)]
Invert the section relocation map.

It now points from rel section to section. Use it to set sh_info, avoiding
a brittle name lookup.

llvm-svn: 228889

9 years agoUse the existing SymbolTableIndex instead of doing a lookup. NFC.
Rafael Espindola [Wed, 11 Feb 2015 23:33:46 +0000 (23:33 +0000)]
Use the existing SymbolTableIndex instead of doing a lookup. NFC.

llvm-svn: 228888

9 years agoRemove unused parameter.
Rui Ueyama [Wed, 11 Feb 2015 23:22:34 +0000 (23:22 +0000)]
Remove unused parameter.

llvm-svn: 228887

9 years agoCreate the Seciton -> Rel Section map when it is first needed. NFC.
Rafael Espindola [Wed, 11 Feb 2015 23:17:48 +0000 (23:17 +0000)]
Create the Seciton -> Rel Section map when it is first needed. NFC.

Saves a walk over every section.

llvm-svn: 228886

9 years agoDeadArgElim: aggregate Return assessment properly.
Tim Northover [Wed, 11 Feb 2015 23:13:11 +0000 (23:13 +0000)]
DeadArgElim: aggregate Return assessment properly.

I mistakenly thought the liveness of each "RetVal(F, i)" depended only on F. It
actually depends on the index too, which means we need to be careful about how
the results are combined before return. In particular if a single Use returns
Live, that counts for the entire object, at the granularity we're considering.

llvm-svn: 228885

9 years agoRemove unused argument. NFC.
Rafael Espindola [Wed, 11 Feb 2015 23:11:18 +0000 (23:11 +0000)]
Remove unused argument. NFC.

llvm-svn: 228884

9 years agoUnbreak buildbots
David Majnemer [Wed, 11 Feb 2015 22:51:55 +0000 (22:51 +0000)]
Unbreak buildbots

The next offset should be updated as well.

llvm-svn: 228883

9 years agoDon't recompute the entire section map just to add 3 entries. NFC.
Rafael Espindola [Wed, 11 Feb 2015 22:41:26 +0000 (22:41 +0000)]
Don't recompute the entire section map just to add 3 entries. NFC.

llvm-svn: 228881

9 years agoWrap to 80 columns. No behavior change.
Nico Weber [Wed, 11 Feb 2015 22:33:32 +0000 (22:33 +0000)]
Wrap to 80 columns. No behavior change.

llvm-svn: 228880

9 years agoMC, COFF: Align section contents to a four byte boundary
David Majnemer [Wed, 11 Feb 2015 22:22:30 +0000 (22:22 +0000)]
MC, COFF: Align section contents to a four byte boundary

llvm-svn: 228879

9 years agoOn second thought, a const ValueObject& has too many limitations on what it can do...
Enrico Granata [Wed, 11 Feb 2015 21:53:08 +0000 (21:53 +0000)]
On second thought, a const ValueObject& has too many limitations on what it can do. Strip the constness away

llvm-svn: 228878

9 years agoExcept only EIO errors of OSError exception in Base.deletePexpectChild() in lldbtest...
Ilia K [Wed, 11 Feb 2015 21:41:58 +0000 (21:41 +0000)]
Except only EIO errors of OSError exception in Base.deletePexpectChild() in lldbtest.py after r227086

llvm-svn: 228877

9 years agoAdd the 'noinline' attribute to call sites within __try bodies
Reid Kleckner [Wed, 11 Feb 2015 21:40:48 +0000 (21:40 +0000)]
Add the 'noinline' attribute to call sites within __try bodies

LLVM doesn't support non-call exceptions, so inlining makes it harder to
catch such asynchronous exceptions.

llvm-svn: 228876

9 years agoAdd clang-tidy check google-global-names-in-headers.
Samuel Benzaquen [Wed, 11 Feb 2015 21:21:05 +0000 (21:21 +0000)]
Add clang-tidy check google-global-names-in-headers.

Summary:
google-global-names-in-headers flags global namespace pollution in header files.
Right now it only triggers on using declarations and directives.

Reviewers: alexfh

Subscribers: curdeius

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

llvm-svn: 228875

9 years agoChange Path::filename_pos() to skip the drive letter.
Zachary Turner [Wed, 11 Feb 2015 21:16:35 +0000 (21:16 +0000)]
Change Path::filename_pos() to skip the drive letter.

For Windows, filename_pos() tries to find the filename by
searching for separators after the last :.  Instead, it should
really check for the only location that a : is valid, which is
in the second character, and search for separators after that.

llvm-svn: 228874

9 years agoRemove unused argument. NFC.
Rafael Espindola [Wed, 11 Feb 2015 21:08:00 +0000 (21:08 +0000)]
Remove unused argument. NFC.

llvm-svn: 228873

9 years agoReassociate: cannot negate a INT_MIN value
Mehdi Amini [Wed, 11 Feb 2015 19:54:44 +0000 (19:54 +0000)]
Reassociate: cannot negate a INT_MIN value

Summary:
When trying to canonicalize negative constants out of
multiplication expressions, we need to check that the
constant is not INT_MIN which cannot be negated.

Reviewers: mcrosier

Reviewed By: mcrosier

Subscribers: llvm-commits

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

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 228872

9 years ago[Sanitizers] The MAP_NORESERVE define has been removed in FreeBSD 11.x,
Dimitry Andric [Wed, 11 Feb 2015 19:48:27 +0000 (19:48 +0000)]
[Sanitizers] The MAP_NORESERVE define has been removed in FreeBSD 11.x,
and even before that, it was never implemented.  Just define it to zero
instead, so compiler-rt can compile on FreeBSD 11 and later.

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

llvm-svn: 228871

9 years agoFix REQUIRES lines on tests from r228735. Thanks Kristof for pointing out the missin...
Pete Cooper [Wed, 11 Feb 2015 19:45:13 +0000 (19:45 +0000)]
Fix REQUIRES lines on tests from r228735.  Thanks Kristof for pointing out the missing commas

llvm-svn: 228870

9 years ago[UBSan] Allow UBSan location to store frames returned by symbolizer.
Alexey Samsonov [Wed, 11 Feb 2015 19:45:07 +0000 (19:45 +0000)]
[UBSan] Allow UBSan location to store frames returned by symbolizer.

Summary:
__ubsan::getFunctionLocation() used to issue a call to symbolizer, and
convert the result (SymbolizedStack) to one of UBSan structures:
SourceLocation, ModuleLocation or MemoryLocation. This:
(1) is inefficient: we do an extra allocation/deallocation to copy data,
while we can instead can just pass SymbolizedStack around (which
contains all the necessary data).
(2) leaks memory: strings stored in SourceLocation/MemoryLocation are
never deallocated, and Filipe Cabecinhas suggests this causes crashes
of UBSan-ified programs in the wild.

Instead, let Location store a pointer to SymbolizedStack object, and
make sure it's properly deallocated when UBSan handler exits.

ModuleLocation is made obsolete by this change, and is deleted.

Test Plan: check-ubsan test suite

Reviewers: rsmith, filcab

Subscribers: llvm-commits

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

llvm-svn: 228869

9 years ago[FIX] Remove XFAIL again
Johannes Doerfert [Wed, 11 Feb 2015 19:28:39 +0000 (19:28 +0000)]
[FIX] Remove XFAIL again

llvm-svn: 228868

9 years agoFixed SBModule::GetUUIDString() to not use a static character buffer.
Greg Clayton [Wed, 11 Feb 2015 19:16:38 +0000 (19:16 +0000)]
Fixed SBModule::GetUUIDString() to not use a static character buffer.

Rules for returning "const char *" from functions in the public lldb::SB* API are that you must constify the string using "ConstString(cstr).GetCString()" and return that. This puts the string into a string pool that never goes away. This is only when there is nothing that can hold onto the string. It is OK to specify that a string value lives as long as its SB class counterpart, but this should be made clear in the API if this is done. Many classes already constify their strings (symbol mangled and demangled names, variable names, type names, etc), so be sure to verify you string isn't already constified before you re-constify it. It won't do any harm to re-constify it, it will just cause you a little performance by having to rehash the string.

llvm-svn: 228867

9 years ago[FIX] Correctly handle scalar dependences of branch instructions
Johannes Doerfert [Wed, 11 Feb 2015 19:12:19 +0000 (19:12 +0000)]
[FIX] Correctly handle scalar dependences of branch instructions

llvm-svn: 228866

9 years ago[FIX] Fix test case that was affected by the early exit patch
Johannes Doerfert [Wed, 11 Feb 2015 19:11:57 +0000 (19:11 +0000)]
[FIX] Fix test case that was affected by the early exit patch

llvm-svn: 228865

9 years agoCXXInheritance: Modernize removal of hidden virtual base class decls.
Benjamin Kramer [Wed, 11 Feb 2015 19:09:16 +0000 (19:09 +0000)]
CXXInheritance: Modernize removal of hidden virtual base class decls.

NFC.

llvm-svn: 228864

9 years agoAdd a comdat to __clang_call_terminate
Reid Kleckner [Wed, 11 Feb 2015 18:50:13 +0000 (18:50 +0000)]
Add a comdat to __clang_call_terminate

llvm-svn: 228863

9 years agoDrop an assert and XFAIL two test cases
Tobias Grosser [Wed, 11 Feb 2015 18:46:33 +0000 (18:46 +0000)]
Drop an assert and XFAIL two test cases

This gets the buildbot green to avoid further emails. Johannes will fix this
later in the evening.

llvm-svn: 228862

9 years agoR600/SI: Disable subreg liveness
Tom Stellard [Wed, 11 Feb 2015 18:24:53 +0000 (18:24 +0000)]
R600/SI: Disable subreg liveness

This is temporary while we try to fix a crash in the register coalescer.

llvm-svn: 228861

9 years agoUpdate the coding standard to reflect recent changes.
Zachary Turner [Wed, 11 Feb 2015 18:24:38 +0000 (18:24 +0000)]
Update the coding standard to reflect recent changes.

This removes the rule from the LLDB coding standard about putting
a space after function names and before parentheses.  We now
conform to the LLVM style guide.  If you previously wrote
pointer->func (args), it would now be written pointer->func(args).

Using clang-format will do this automatically.

llvm-svn: 228860

9 years agoMake PipeWindows::CreateWithUniqueName() use GUIDs on Windows.
Zachary Turner [Wed, 11 Feb 2015 18:21:28 +0000 (18:21 +0000)]
Make PipeWindows::CreateWithUniqueName() use GUIDs on Windows.

Patch by Adrian McCarthy
Differential Revision: http://reviews.llvm.org/D7509

llvm-svn: 228859

9 years agoUpdate TODO list.
Johannes Doerfert [Wed, 11 Feb 2015 18:18:19 +0000 (18:18 +0000)]
Update TODO list.

llvm-svn: 228858

9 years ago[X86][SSE] Added dual vector truncation tests.
Simon Pilgrim [Wed, 11 Feb 2015 18:14:35 +0000 (18:14 +0000)]
[X86][SSE] Added dual vector truncation tests.

llvm-svn: 228857

9 years agoAdd missing check for LLDB_DISABLE_PYTHON in FormatManager
Tamas Berghammer [Wed, 11 Feb 2015 17:51:49 +0000 (17:51 +0000)]
Add missing check for LLDB_DISABLE_PYTHON in FormatManager

llvm-svn: 228856

9 years agoFix PR19351. While building up a composite type it is important to use
Adrian Prantl [Wed, 11 Feb 2015 17:45:15 +0000 (17:45 +0000)]
Fix PR19351. While building up a composite type it is important to use
a non-uniqueable temporary node that is only turned into a permanent
unique or distinct node after it is finished.
Otherwise an intermediate node may get accidentally uniqued with another
node as illustrated by the testcase.

Paired commit with LLVM.

llvm-svn: 228855

9 years agoAllow DIBuilder::replaceVTableHolder() to work with temporary nodes,
Adrian Prantl [Wed, 11 Feb 2015 17:45:10 +0000 (17:45 +0000)]
Allow DIBuilder::replaceVTableHolder() to work with temporary nodes,
tested via the clang test CodeGenCXX/vtable-holder-self-reference.cpp .

llvm-svn: 228854

9 years agoAdd a trackIfUnresolved to DIBuilder::createInheritance(),
Adrian Prantl [Wed, 11 Feb 2015 17:45:08 +0000 (17:45 +0000)]
Add a trackIfUnresolved to DIBuilder::createInheritance(),
tested via the clang test CodeGenCXX/vtable-holder-self-reference.cpp .

llvm-svn: 228853

9 years agoGeneralize DIBuilder's createReplaceableForwardDecl() to a more flexible
Adrian Prantl [Wed, 11 Feb 2015 17:45:05 +0000 (17:45 +0000)]
Generalize DIBuilder's createReplaceableForwardDecl() to a more flexible
createReplaceableCompositeType() that allows to create non-forward-declared
temporary nodes.

Paired commit with CFE.

llvm-svn: 228852

9 years agoAdd early exits for SCoPs we did not optimize
Johannes Doerfert [Wed, 11 Feb 2015 17:25:09 +0000 (17:25 +0000)]
Add early exits for SCoPs we did not optimize

  This allows us to skip ast and code generation if we did not optimize
  a SCoP and will not generate parallel or alias annotations. The
  initial heuristic to exit is simple but allows improvements later on.

  All failing test cases have been modified to disable early exit, thus
  to keep their coverage.

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

llvm-svn: 228851

9 years agoR600: Split AMDGPUPassConfig into R600PassConfig and GCNPassConfig
Tom Stellard [Wed, 11 Feb 2015 17:11:51 +0000 (17:11 +0000)]
R600: Split AMDGPUPassConfig into R600PassConfig and GCNPassConfig

llvm-svn: 228850

9 years agoR600: Create an R600TargetMachine for pre-gcn GPUs
Tom Stellard [Wed, 11 Feb 2015 17:11:50 +0000 (17:11 +0000)]
R600: Create an R600TargetMachine for pre-gcn GPUs

No functinality change. R600TargetMachine inherits from
AMDGPUTargetMachine.

llvm-svn: 228849

9 years agoR600/SI: Fix -march in test
Tom Stellard [Wed, 11 Feb 2015 17:11:48 +0000 (17:11 +0000)]
R600/SI: Fix -march in test

llvm-svn: 228848

9 years agoModel scalar writes with uses outside the SCoP
Johannes Doerfert [Wed, 11 Feb 2015 17:02:52 +0000 (17:02 +0000)]
Model scalar writes with uses outside the SCoP

  These write are important as they will force the scheduling and code
  generation of an otherwise trivial statement and also impose an order of
  execution needed to guarantee the correct final value for a scalar in a loop.

  Added test case modeled after ClamAV/clamscan.

llvm-svn: 228847

9 years agoAdded -block-check-header-list-only option. This is a work-around for private includ...
John Thompson [Wed, 11 Feb 2015 16:58:36 +0000 (16:58 +0000)]
Added -block-check-header-list-only option.  This is a work-around for private includes that purposefully get included inside blocks.

llvm-svn: 228846

9 years agoCentralize canonical path conversion.
John Thompson [Wed, 11 Feb 2015 16:45:50 +0000 (16:45 +0000)]
Centralize canonical path conversion.

llvm-svn: 228845

9 years agoLock mutex in the same order.
Hafiz Abid Qadeer [Wed, 11 Feb 2015 16:37:17 +0000 (16:37 +0000)]
Lock mutex in the same order.
SBProcess uses 2 mutexex; RunLock and APILock. Apart from 2 places, RunLock
is locked before API lock. I have fixed the 2 places where order was different.
I observed a deadlock due to this different order in lldb-mi once. Although
lldb-mi command and event thread dont run at the same time now. So it can not deadlock
there but can still be problem for some other clients.

Pre-approved by Greg in http://lists.cs.uiuc.edu/pipermail/lldb-dev/2015-February/006509.html

llvm-svn: 228844

9 years agoChange some template parameter names from _C and _N to _Cont and _Sz. No functionalit...
Marshall Clow [Wed, 11 Feb 2015 16:14:01 +0000 (16:14 +0000)]
Change some template parameter names from _C and _N to _Cont and _Sz. No functionality change.

llvm-svn: 228843

9 years agoGold-plugin: Broaden scope of get/release_input_file to scope of Module.
Jan Wen Voung [Wed, 11 Feb 2015 16:12:50 +0000 (16:12 +0000)]
Gold-plugin: Broaden scope of get/release_input_file to scope of Module.

Summary:
Move calls to get_input_file and release_input_file out of
getModuleForFile(). Otherwise release_input_file may end up
unmapping a view of the file while the view is still being
used by the Module (on 32-bit hosts).

Fix for PR22482.

Test Plan: Add test using --no-map-whole-files.

Reviewers: rafael, nlewycky

Subscribers: llvm-commits

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

llvm-svn: 228842

9 years agoFix SelectionDAG compile time issue with alias analysis.
Jonas Paulsson [Wed, 11 Feb 2015 16:10:31 +0000 (16:10 +0000)]
Fix SelectionDAG compile time issue with alias analysis.

Add new token factor node and its users to worklist if alias analysis is
turned on, in DAGCombiner::visitTokenFactor(). Alias analysis may cause
a lot of new token factors to be inserted into the DAG, and they need to
be optimized to avoid significant slow-downs.

Reviewed by Hal Finkel.

llvm-svn: 228841

9 years agoNeed to wrap a bit in an ifdef, since there are no initializer_lists in C++03
Marshall Clow [Wed, 11 Feb 2015 15:48:21 +0000 (15:48 +0000)]
Need to wrap a bit in an ifdef, since there are no initializer_lists in C++03

llvm-svn: 228840

9 years agoFix PR 22541: When values are equal, minmax should return the rightmost one in the...
Marshall Clow [Wed, 11 Feb 2015 15:41:34 +0000 (15:41 +0000)]
Fix PR 22541: When values are equal, minmax should return the rightmost one in the initializer_list

llvm-svn: 228839

9 years ago[ASan] Print out a diagnostic when a global is unregistered
Timur Iskhodzhanov [Wed, 11 Feb 2015 15:21:09 +0000 (15:21 +0000)]
[ASan] Print out a diagnostic when a global is unregistered

llvm-svn: 228838

9 years ago[ELF][ARM] Fix veneer symbol names in Release build
Denis Protivensky [Wed, 11 Feb 2015 15:02:43 +0000 (15:02 +0000)]
[ELF][ARM] Fix veneer symbol names in Release build

The fix is for r228680.
This makes tests also work.

llvm-svn: 228837

9 years agofixed to test features, not CPUs
Sanjay Patel [Wed, 11 Feb 2015 15:00:41 +0000 (15:00 +0000)]
fixed to test features, not CPUs

llvm-svn: 228836

9 years agofixed to test features, not CPUs
Sanjay Patel [Wed, 11 Feb 2015 15:00:19 +0000 (15:00 +0000)]
fixed to test features, not CPUs

llvm-svn: 228835

9 years agofixed to test features, not CPUs
Sanjay Patel [Wed, 11 Feb 2015 14:58:25 +0000 (14:58 +0000)]
fixed to test features, not CPUs

llvm-svn: 228834

9 years agoAllow signed devision in access functions
Johannes Doerfert [Wed, 11 Feb 2015 14:54:50 +0000 (14:54 +0000)]
Allow signed devision in access functions

llvm-svn: 228833

9 years ago[FIX] Special case for branch users of scalar values
Johannes Doerfert [Wed, 11 Feb 2015 14:52:52 +0000 (14:52 +0000)]
[FIX] Special case for branch users of scalar values

llvm-svn: 228832

9 years agoDon't repeat name in comment and clang-format a function.
Rafael Espindola [Wed, 11 Feb 2015 14:44:17 +0000 (14:44 +0000)]
Don't repeat name in comment and clang-format a function.

llvm-svn: 228831

9 years agoR600/SI: Enable a lot of existing tests for VI (squashed commits)
Marek Olsak [Wed, 11 Feb 2015 14:26:46 +0000 (14:26 +0000)]
R600/SI: Enable a lot of existing tests for VI (squashed commits)

This is a union of these commits:

* R600/SI: Enable more tests for VI which need no changes

* R600/SI: Enable V_BCNT tests for VI
    Differences:
    - v_bcnt_..._e32 -> _e64
    - s_load_dword* inline offset is in bytes instead of dwords

* R600/SI: Enable all tests for VI which use S_LOAD_DWORD
    The inline offset is changed from dwords to bytes.

* R600/SI: Enable LDS tests for VI
    Differences:
    - the s_load_dword inline offset changed from dwords to bytes
    - the tests checked very little on CI, so they have been fixed to check all
      instructions that "SI" checked

* R600/SI: Enable lshr tests for VI

* R600/SI: Fix divrem64 tests
    - "v_lshl_64" was missing "b" before "64"
    - added VI-NOT checks

* R600/SI: Enable the SI.tid test for VI

* R600/SI: Enable the frem test for VI
    Also, the frem_f64 checking is added for CI-VI.

* R600/SI: Add VI tests for rsq.clamped

llvm-svn: 228830

9 years ago[TTI] Improved cost heuristic for cttz/ctlz calls.
Andrea Di Biagio [Wed, 11 Feb 2015 14:22:18 +0000 (14:22 +0000)]
[TTI] Improved cost heuristic for cttz/ctlz calls.

This patch is a follow-up of r228826 (see code-review: D7506).

Now that SimplifyCFG uses TargetTransformInfo for cost analysis, we
have to fix the cost heuristic for intrinsic calls to cttz/ctlz.

This patch defines method 'getIntrinsicCost' in BasicTTIImpl: now, BasicTTIImpl
queries TLI to check if a call to cttz/ctlz is cheap for the target.

Added test cases in Transforms/SimplifyCFG/X86 to verify that on x86,
SimplifyCFG only speculates a call to cttz/ctlz if it is cheap.

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

llvm-svn: 228829

9 years agoFix windows build (broken by r228823)
Tamas Berghammer [Wed, 11 Feb 2015 12:52:55 +0000 (12:52 +0000)]
Fix windows build (broken by r228823)

llvm-svn: 228828

9 years agoMake buildbots better.
James Molloy [Wed, 11 Feb 2015 12:24:09 +0000 (12:24 +0000)]
Make buildbots better.

This testcase change was associated incorrectly to a followup commit in my git tree, not the base commit. Sorry!

llvm-svn: 228827

9 years ago[SimplifyCFG] Swap to using TargetTransformInfo for cost
James Molloy [Wed, 11 Feb 2015 12:15:41 +0000 (12:15 +0000)]
[SimplifyCFG] Swap to using TargetTransformInfo for cost
 analysis.

We're already using TTI in SimplifyCFG, so remove the hard-baked "cheapness"
heuristic and use TTI directly. Generally NFC intended, but we're using a slightly
different heuristic now so there is a slight test churn.

Test changes:
  * combine-comparisons-by-cse.ll: Removed unneeded branch check.
  * 2014-08-04-muls-it.ll: Test now doesn't branch but emits muleq.
  * coalesce-subregs.ll: Superfluous block check.
  * 2008-01-02-hoist-fp-add.ll: fadd is safe to speculate. Change to udiv.
  * PhiBlockMerge.ll: Superfluous CFG checking code. Main checks still present.
  * select-gep.ll: A variable GEP is not expensive, just TCC_Basic, according to the TTI.

llvm-svn: 228826

9 years ago[mips] Merge disassemblers into a single implementation.
Daniel Sanders [Wed, 11 Feb 2015 11:28:56 +0000 (11:28 +0000)]
[mips] Merge disassemblers into a single implementation.

Summary:
Currently we have Mips32 and Mips64 disassemblers and this causes the target
triple to affect the disassembly despite all the relevant information being in
the ELF header. These implementations do not need to be separate.

This patch merges them together such that the appropriate tables are checked
for the subtarget (e.g. Mips64 is checked when GP64 is enabled).

Reviewers: vmedic

Reviewed By: vmedic

Subscribers: llvm-commits

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

llvm-svn: 228825

9 years agoAdd extra check that target was stopped before the *stopped is sent.
Ilia K [Wed, 11 Feb 2015 11:24:20 +0000 (11:24 +0000)]
Add extra check that target was stopped before the *stopped is sent.

This patch fixes r228417. It's required because eStateCrushed case wasn't investigated.

llvm-svn: 228824

9 years agoSeparate monolithic GDBRemoteCommunicationServer class into 4 part
Tamas Berghammer [Wed, 11 Feb 2015 10:29:30 +0000 (10:29 +0000)]
Separate monolithic GDBRemoteCommunicationServer class into 4 part

GDBRemoteCommunicationServer: Basic packet handling, handler registration
LLDBCommonPacketHandler: Common packet handling for lldb-platform and lldb-gdbserver
LLDBPlatformPacketHandler: lldb-platform specific packet handling
LLGSPacketHandler: lldb-gdbserver specific packet handling

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

llvm-svn: 228823

9 years agoFix Mingw build.
Hafiz Abid Qadeer [Wed, 11 Feb 2015 10:14:13 +0000 (10:14 +0000)]
Fix Mingw build.

Following changes are done.

Add missing headers.
Replace _snprintf with snprintf. It is already changed to _snprintf for MSVC.
Add a file in the build for autoconf.
Call DynamicLoaderWindows::Terminate and DynamicLoaderWindows::Initialize only for MSVC build.

Reviewed in http://reviews.llvm.org/D7536.

llvm-svn: 228822

9 years ago[LoopReroll] Introduce the concept of DAGRootSets.
James Molloy [Wed, 11 Feb 2015 09:19:47 +0000 (09:19 +0000)]
[LoopReroll] Introduce the concept of DAGRootSets.

A DAGRootSet models an induction variable being used in a rerollable
loop. For example:

   x[i*3+0] = y1
   x[i*3+1] = y2
   x[i*3+2] = y3

   Base instruction -> i*3
                    +---+----+
                   /    |     \
               ST[y1]  +1     +2  <-- Roots
                        |      |
                      ST[y2] ST[y3]

There may be multiple DAGRootSets, for example:

   x[i*2+0] = ...   (1)
   x[i*2+1] = ...   (1)
   x[i*2+4] = ...   (2)
   x[i*2+5] = ...   (2)
   x[(i+1234)*2+5678] = ... (3)
   x[(i+1234)*2+5679] = ... (3)

This concept is similar to the "Scale" member used previously, but allows
multiple independent sets of roots based off the same induction variable.

llvm-svn: 228821

9 years agoAsmParser: Validate alloca's type
David Majnemer [Wed, 11 Feb 2015 09:13:11 +0000 (09:13 +0000)]
AsmParser: Validate alloca's type

An alloca's type should be weird things like metadata.

llvm-svn: 228820

9 years agoDataLayout: Report when the preferred alignment is less than the ABI
David Majnemer [Wed, 11 Feb 2015 09:13:09 +0000 (09:13 +0000)]
DataLayout: Report when the preferred alignment is less than the ABI

llvm-svn: 228819

9 years agoVerifier: Check for null operands in !llvm.module.flags
David Majnemer [Wed, 11 Feb 2015 09:13:06 +0000 (09:13 +0000)]
Verifier: Check for null operands in !llvm.module.flags

llvm-svn: 228818

9 years ago[X86] Split information collection from actual transformation in call frame optimization
Michael Kuperstein [Wed, 11 Feb 2015 08:53:55 +0000 (08:53 +0000)]
[X86] Split information collection from actual transformation in call frame optimization

This splits collecting information from actually performing the transformation, so that we can add a heuristic in between the two.
NFC.

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

llvm-svn: 228817

9 years ago[PBQP] Cautiously update edge costs in the solver
Arnaud A. de Grandmaison [Wed, 11 Feb 2015 08:25:36 +0000 (08:25 +0000)]
[PBQP] Cautiously update edge costs in the solver

The NodeMetadata are maintained in an incremental way. When an edge between
2 nodes has its cost updated, in the course of graph reduction for example,
the NodeMetadata need first to have the old edge cost removed, then the new
edge cost added. Only once the NodeMetadata have been fully updated, it
becomes safe to consider promoting the nodes to the
ConservativelyAllocatable or OptimallyReducible sets. Previously, this
promotion was occuring right after the removing the old cost, and this was
breaking the assumption that a ConservativelyAllocatable should not be
spilled.

This patch also adds asserts to:
 - enforces the invariant that a node's reduction can not be downgraded,
 - only not provably allocatable or optimally reducible nodes can be spilled.

llvm-svn: 228816

9 years agoVerifier: Make sure !llvm.ident's operand isn't null
David Majnemer [Wed, 11 Feb 2015 08:23:20 +0000 (08:23 +0000)]
Verifier: Make sure !llvm.ident's operand isn't null

llvm-svn: 228815

9 years agoFix amount of diagnostic classes
Alex Denisov [Wed, 11 Feb 2015 07:56:16 +0000 (07:56 +0000)]
Fix amount of diagnostic classes

llvm-svn: 228814

9 years agoAsmParser: Don't crash when insertvalue has bad operands
David Majnemer [Wed, 11 Feb 2015 07:43:58 +0000 (07:43 +0000)]
AsmParser: Don't crash when insertvalue has bad operands

llvm-svn: 228813

9 years agoAsmParser: Switch some vectors to maps
David Majnemer [Wed, 11 Feb 2015 07:43:56 +0000 (07:43 +0000)]
AsmParser: Switch some vectors to maps

This speeds up parsing .ll files with metadata nodes with large IDs.

llvm-svn: 228812

9 years agoFix build for CMake < 2.8.12.
Peter Collingbourne [Wed, 11 Feb 2015 05:58:57 +0000 (05:58 +0000)]
Fix build for CMake < 2.8.12.

llvm-svn: 228810

9 years agounwind: tweak inclusion ordering to work around GCC
Saleem Abdulrasool [Wed, 11 Feb 2015 05:20:53 +0000 (05:20 +0000)]
unwind: tweak inclusion ordering to work around GCC

This is a slightly convoluted workaround.  GCC does not support the
__has_feature extension of clang, and this results in some issues with
static_asserts.  config.h defines static_assert as a macro with a C-specific
trickery.  This then propagates into the C++ headers included after config.h,
which are used with C++11 mode, enabling constexpr constructors.  The macro'ed
static_assert does not get treated as the static_assert builtin, and will cause
an error due to a non-empty constexpr constructor.  Tweaking the include order
permits the use of libc++ headers to build libunwind with GCC on Linux.

llvm-svn: 228809

9 years agounwind: clean up some -Werror=return-type warnings
Saleem Abdulrasool [Wed, 11 Feb 2015 05:20:50 +0000 (05:20 +0000)]
unwind: clean up some -Werror=return-type warnings

Mark that the functions always return or abort if the register class is
unhandled.  Avoid placing the abort in the switch to permit -Wswitch-cover to
catch missing values.

llvm-svn: 228808