platform/upstream/llvm.git
11 years agoDebug Info: use module flag to set up Dwarf version.
Manman Ren [Tue, 2 Jul 2013 23:40:10 +0000 (23:40 +0000)]
Debug Info: use module flag to set up Dwarf version.

Correctly handles ref_addr depending on the Dwarf version. Emit Dwarf with
version from module flag.

TODO: turn on/off features depending on the Dwarf version.
llvm-svn: 185484

11 years agoDebug Info: set default to gdwarf-2 for Darwin.
Manman Ren [Tue, 2 Jul 2013 23:15:25 +0000 (23:15 +0000)]
Debug Info: set default to gdwarf-2 for Darwin.

Darwin systems currently do not support dwarf version 3 or above. When we are
ready, we can bump the default to gdwarf-4 for Darwin.

For other systems, the default is dwarf version 3, if everything goes smoothly,
we can bump the version to 4.

rdar://13591116

llvm-svn: 185483

11 years agoFix comment.
Eric Christopher [Tue, 2 Jul 2013 21:36:07 +0000 (21:36 +0000)]
Fix comment.

llvm-svn: 185480

11 years agoFixed typo in LangRef where we were using _'' to quote instead of the correct _.
Michael Gottesman [Tue, 2 Jul 2013 21:32:56 +0000 (21:32 +0000)]
Fixed typo in LangRef where we were using _'' to quote instead of the correct _.

llvm-svn: 185479

11 years ago[PowerPC] PR16512 - Support TLS call sequences in the asm parser
Ulrich Weigand [Tue, 2 Jul 2013 21:31:59 +0000 (21:31 +0000)]
[PowerPC] PR16512 - Support TLS call sequences in the asm parser

This patch now adds support for recognizing TLS call sequences in
the asm parser.  This needs a new pattern BL8_TLS, which is like
BL8_NOP_TLS except without nop.  That pattern is used for the
asm parser only.

llvm-svn: 185478

11 years ago[PowerPC] Rework TLS call operand processing
Ulrich Weigand [Tue, 2 Jul 2013 21:31:04 +0000 (21:31 +0000)]
[PowerPC] Rework TLS call operand processing

As part of the global-dynamic and local-dynamic TLS sequences, we need
to use a special form of the call instruction:

 bl __tls_get_addr(sym@tlsld)
 bl __tls_get_addr(sym@tlsgd)

which generates two fixups.  The current implementation of this causes
problems with recognizing this form in the asm parser.  To fix this,
this patch reworks operand processing for this special form by using
a single operand to hold both __tls_get_addr and sym@tlsld and defining
a print method to output the above form, and an encoding method to
generate the two fixups.

As a side simplification, the patch replaces the two instruction
patterns BL8_NOP_TLSGD and BL8_NOP_TLSLD by a single BL8_NOP_TLS,
since the patterns already operate in an identical fashion (whether
we have a local-dynamic or global-dynamic symbol is already encoded
in the symbol modifier).

No change in code generation intended.

llvm-svn: 185477

11 years ago[PowerPC] Remove VK_PPC_TLSGD and VK_PPC_TLSLD
Ulrich Weigand [Tue, 2 Jul 2013 21:29:06 +0000 (21:29 +0000)]
[PowerPC] Remove VK_PPC_TLSGD and VK_PPC_TLSLD

The PowerPC-specific modifiers VK_PPC_TLSGD and VK_PPC_TLSLD
correspond exactly to the generic modifiers VK_TLSGD and VK_TLSLD.
This causes some confusion with the asm parser, since VK_PPC_TLSGD
is output as @tlsgd, which is then read back in as VK_TLSGD.

To avoid this confusion, this patch removes the PowerPC-specific
modifiers and uses the generic modifiers throughout.  (The only
drawback is that the generic modifiers are printed in upper case
while the usual convention on PowerPC is to use lower-case modifiers.
But this is just a cosmetic issue.)

llvm-svn: 185476

11 years agoSystemZ: Fold variable into assertion.
Benjamin Kramer [Tue, 2 Jul 2013 21:17:31 +0000 (21:17 +0000)]
SystemZ: Fold variable into assertion.

llvm-svn: 185475

11 years agoMark the "step over single instruction" plan private in the StopInfoWatchpoint::Perfo...
Jim Ingham [Tue, 2 Jul 2013 21:12:44 +0000 (21:12 +0000)]
Mark the "step over single instruction" plan private in the StopInfoWatchpoint::PerformAction to
ensure that the watchpoint not the step is reported as the stop reason.  Also, stash away & restore
the current stop reason just so it can't go away on us.

llvm-svn: 185474

11 years agoRedirect the output of a test to a temporary file to prevent messing up
Richard Trieu [Tue, 2 Jul 2013 20:49:10 +0000 (20:49 +0000)]
Redirect the output of a test to a temporary file to prevent messing up
the test environment.

llvm-svn: 185470

11 years agoDocumentation: Update docs for C++ lambdas to more accurately reflect
James Dennett [Tue, 2 Jul 2013 20:28:47 +0000 (20:28 +0000)]
Documentation: Update docs for C++ lambdas to more accurately reflect
C++1y init-capture support, and to improve some Doxygen markup.

llvm-svn: 185469

11 years agoAdorn make_unique with visibility and inline attributes
Marshall Clow [Tue, 2 Jul 2013 20:06:09 +0000 (20:06 +0000)]
Adorn make_unique with visibility and inline attributes

llvm-svn: 185468

11 years agoDon't free the C locale on NetBSD.
Joerg Sonnenberger [Tue, 2 Jul 2013 19:46:18 +0000 (19:46 +0000)]
Don't free the C locale on NetBSD.

llvm-svn: 185467

11 years agoFix build with LLVM_DISABLE_PYTHON
Ed Maste [Tue, 2 Jul 2013 19:30:52 +0000 (19:30 +0000)]
Fix build with LLVM_DISABLE_PYTHON

llvm-svn: 185466

11 years agoAdd 'REQUIRES: object-emission' to DebugInfo/inlined-arguments.ll.
Jyotsna Verma [Tue, 2 Jul 2013 19:21:43 +0000 (19:21 +0000)]
Add 'REQUIRES: object-emission' to DebugInfo/inlined-arguments.ll.

llvm-svn: 185465

11 years agoUpdated CREDITS.TXT
Howard Hinnant [Tue, 2 Jul 2013 19:01:59 +0000 (19:01 +0000)]
Updated CREDITS.TXT

llvm-svn: 185464

11 years agoDebug Info: clean up usage of Verify.
Manman Ren [Tue, 2 Jul 2013 19:01:53 +0000 (19:01 +0000)]
Debug Info: clean up usage of Verify.

No functionality change. It should suffice to check the type of a debug info
metadata, instead of calling Verify.

llvm-svn: 185463

11 years agoUpdated CREDITS.TXT
Howard Hinnant [Tue, 2 Jul 2013 19:00:29 +0000 (19:00 +0000)]
Updated CREDITS.TXT

llvm-svn: 185462

11 years ago[PowerPC] Support TLS variables in debug info
Ulrich Weigand [Tue, 2 Jul 2013 18:47:35 +0000 (18:47 +0000)]
[PowerPC] Support TLS variables in debug info

This adds an implementation of getDebugThreadLocalSymbol for
(64-bit) PowerPC.  This needs to return a generic MCExpr
since on ppc64, we need to add a bias of 0x8000 to the
value returned by the R_PPC64_DTPREL64 relocation.

llvm-svn: 185461

11 years ago[DebugInfo] Allow getDebugThreadLocalSymbol to return MCExpr
Ulrich Weigand [Tue, 2 Jul 2013 18:47:09 +0000 (18:47 +0000)]
[DebugInfo] Allow getDebugThreadLocalSymbol to return MCExpr

This allows getDebugThreadLocalSymbol to return a generic MCExpr
instead of just a MCSymbolRefExpr.

This is in preparation for supporting debug info for TLS variables
on PowerPC, where we need to describe the variable location using
a more complex expression than just MCSymbolRefExpr.

llvm-svn: 185460

11 years ago[DebugInfo] Hold generic MCExpr in AddrPool
Ulrich Weigand [Tue, 2 Jul 2013 18:46:46 +0000 (18:46 +0000)]
[DebugInfo] Hold generic MCExpr in AddrPool

This changes the AddrPool infrastructure to enable it to hold
generic MCExpr expressions, not just MCSymbolRefExpr.

This is in preparation for supporting debug info for TLS variables
on PowerPC, where we need to describe the variable location using
a more complex expression than just MCSymbolRefExpr.

llvm-svn: 185459

11 years ago[DebugInfo] Introduce DIEExpr variant of DIEValue to hold MCExpr values
Ulrich Weigand [Tue, 2 Jul 2013 18:46:26 +0000 (18:46 +0000)]
[DebugInfo] Introduce DIEExpr variant of DIEValue to hold MCExpr values

This partially reverts r185202 and restores DIELabel to hold plain
MCSymbol references.  Instead, we add a new subclass DIEExpr of
DIEValue that can hold generic MCExpr references.

This is in preparation for supporting debug info for TLS variables
on PowerPC, where we need to describe the variable location using
a more complex expression than just MCSymbolRefExpr.

llvm-svn: 185458

11 years agoMatthew Dempsky: In libc++'s <locale>, there's already dependence on an snprintf_l
Howard Hinnant [Tue, 2 Jul 2013 18:42:28 +0000 (18:42 +0000)]
Matthew Dempsky:  In libc++'s <locale>, there's already dependence on an snprintf_l
implementation and all of the char buffers readily have their
allocated size available, so we can easily use snprintf_l instead of
sprintf_l.

This avoids OpenBSD's linker warnings against using sprintf and
vsprintf.
Howard:  Please consider a patch for CREDITS.TXT

llvm-svn: 185457

11 years agoDebug Info: cleanup
Manman Ren [Tue, 2 Jul 2013 18:37:35 +0000 (18:37 +0000)]
Debug Info: cleanup

llvm-svn: 185456

11 years agoAdd split symbol support to test makefile & add linux split symbol test case.
Michael Sartain [Tue, 2 Jul 2013 18:13:13 +0000 (18:13 +0000)]
Add split symbol support to test makefile & add linux split symbol test case.

llvm-svn: 185455

11 years ago[ms-cxxabi] Mangle variadic template parameter packs
Reid Kleckner [Tue, 2 Jul 2013 18:10:07 +0000 (18:10 +0000)]
[ms-cxxabi] Mangle variadic template parameter packs

Unlike Itanium, there is no code to indicate the beginning of a
parameter pack.  I tested this with MSVC 2013, which is the only version
that implements variadic templates so far.

This is needed to compile APInt.cpp for the MS C++ ABI.

Reviewers: timurrrr

Differential Revision: http://llvm-reviews.chandlerc.com/D1077

llvm-svn: 185454

11 years agoAdd regression test for PR12331.
Richard Smith [Tue, 2 Jul 2013 18:08:50 +0000 (18:08 +0000)]
Add regression test for PR12331.

llvm-svn: 185453

11 years agoConstrain launch ~ operator to defined bits.
Howard Hinnant [Tue, 2 Jul 2013 18:01:41 +0000 (18:01 +0000)]
Constrain launch ~ operator to defined bits.

llvm-svn: 185452

11 years agoWindows support in thread::hardware_concurrency.
Howard Hinnant [Tue, 2 Jul 2013 17:53:48 +0000 (17:53 +0000)]
Windows support in thread::hardware_concurrency.

llvm-svn: 185451

11 years agoMore fixes for block mangling.
Eli Friedman [Tue, 2 Jul 2013 17:52:28 +0000 (17:52 +0000)]
More fixes for block mangling.

Make sure we properly treat names defined inside a block as local
names.  There are basically three fixes here.  One, correctly
treat blocks as a context where we need to use local-name mangling using
the new isLocalContainerContext helper. Two, make
CXXNameMangler::manglePrefix handle local names in a consistent way.
Three, extend CXXNameMangler::mangleLocalName so it can mangle a block
correctly.

llvm-svn: 185450

11 years agoBill Fisher: This patch fixes a bug where the regex parser doesn't advance the pointe...
Howard Hinnant [Tue, 2 Jul 2013 17:43:31 +0000 (17:43 +0000)]
Bill Fisher: This patch fixes a bug where the regex parser doesn't advance the pointer after reading the third character of an octal escape (in awk mode).

That is, regex{"\141", awk} results in the regular expression /a1/ instead of just /a/.

llvm-svn: 185449

11 years agoAdd SymbolVenderELF to autotools build (for Linux + FreeBSD)
Daniel Malea [Tue, 2 Jul 2013 17:36:01 +0000 (17:36 +0000)]
Add SymbolVenderELF to autotools build (for Linux + FreeBSD)
- should resolve the build failures on the linux clang buildbot

llvm-svn: 185448

11 years agoRevert (most of) r185393 and r185395.
Jakob Stoklund Olesen [Tue, 2 Jul 2013 17:31:58 +0000 (17:31 +0000)]
Revert (most of) r185393 and r185395.

"Remove floating point computations form SpillPlacement.cpp."

These commits caused test failures in lencod on clang-native-arm-lnt.

I suspect these changes are only exposing an existing issue, but
reverting anyway to keep the bots passing while we investigate.

llvm-svn: 185447

11 years agoFix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout.
Serge Pavlov [Tue, 2 Jul 2013 17:31:56 +0000 (17:31 +0000)]
Fix to PR15826 - clang hits assert in clang::ASTContext::getASTRecordLayout.

llvm-svn: 185446

11 years agoHexagon: Avoid unused variable warnings in Release builds.
Benjamin Kramer [Tue, 2 Jul 2013 17:24:00 +0000 (17:24 +0000)]
Hexagon: Avoid unused variable warnings in Release builds.

llvm-svn: 185445

11 years ago[analyzer] Pointers-to-members are (currently) Locs, not NonLocs.
Jordan Rose [Tue, 2 Jul 2013 16:50:24 +0000 (16:50 +0000)]
[analyzer] Pointers-to-members are (currently) Locs, not NonLocs.

While we don't model pointers-to-members besides "null" and "non-null",
we were using Loc symbols for valid pointers and NonLoc integers for the
null case. This hit the assert committed in r185401.

Fixed by using a true (Loc) null for null member pointers.

llvm-svn: 185444

11 years agoFix -Wsign-compare warning and remove windows-style line endings introduced by r185421
David Blaikie [Tue, 2 Jul 2013 16:48:10 +0000 (16:48 +0000)]
Fix -Wsign-compare warning and remove windows-style line endings introduced by r185421

llvm-svn: 185443

11 years agoSync parts of FreeBSD Process plugin with Linux
Ed Maste [Tue, 2 Jul 2013 16:45:16 +0000 (16:45 +0000)]
Sync parts of FreeBSD Process plugin with Linux

* Use PseudoTerminal to fix stdio handling / passthrough to the inferior
  process.
* Add log messages equivalent to the Linux ones.
* Port changes relating to process creation / termination.

This revision contains changes equivalent to (parts of) SVN revisions
109318 142384 166055 168503 169645 177116 182809.

llvm-svn: 185442

11 years agoRemove obsolete comment
Ed Maste [Tue, 2 Jul 2013 16:35:47 +0000 (16:35 +0000)]
Remove obsolete comment

llvm-svn: 185441

11 years agoclang-format latest changes
Tobias Grosser [Tue, 2 Jul 2013 16:13:07 +0000 (16:13 +0000)]
clang-format latest changes

llvm-svn: 185440

11 years agoSuppress "control reaches end of non-void function" warning when compiling with gcc.
Andy Gibbs [Tue, 2 Jul 2013 16:01:56 +0000 (16:01 +0000)]
Suppress "control reaches end of non-void function" warning when compiling with gcc.

llvm-svn: 185439

11 years agoSimplify getting CXXRecordDecl from a base iterator
Timur Iskhodzhanov [Tue, 2 Jul 2013 16:00:40 +0000 (16:00 +0000)]
Simplify getting CXXRecordDecl from a base iterator

llvm-svn: 185438

11 years ago[APFloat] Swap an early out check so we do not dereference str.end().
Michael Gottesman [Tue, 2 Jul 2013 15:50:05 +0000 (15:50 +0000)]
[APFloat] Swap an early out check so we do not dereference str.end().

Originally if D.firstSigDigit == str.end(), we will have already dereferenced
D.firstSigDigit in the first predicate.

llvm-svn: 185437

11 years agoRemove address spaces from MC.
Rafael Espindola [Tue, 2 Jul 2013 15:49:13 +0000 (15:49 +0000)]
Remove address spaces from MC.

This is dead code since PIC16 was removed in 2010. The result was an odd mix,
where some parts would carefully pass it along and others would assert it was
zero (most of the object streamer for example).

llvm-svn: 185436

11 years ago[SystemZ] Use DSGFR over DSGR in more cases
Richard Sandiford [Tue, 2 Jul 2013 15:40:22 +0000 (15:40 +0000)]
[SystemZ] Use DSGFR over DSGR in more cases

Fixes some cases where we were using full 64-bit division for (sdiv i32, i32)
and (sdiv i64, i32).

The "32" in "SDIVREM32" just refers to the second operand.  The first operand
of all *DIVREM*s is a GR128.

llvm-svn: 185435

11 years ago[SystemZ] Use MVC to spill loads and stores
Richard Sandiford [Tue, 2 Jul 2013 15:28:56 +0000 (15:28 +0000)]
[SystemZ] Use MVC to spill loads and stores

Try to use MVC when spilling the destination of a simple load or the source
of a simple store.  As explained in the comment, this doesn't yet handle
the case where the load or store location is also a frame index, since
that could lead to two simultaneous scavenger spills, something the
backend can't handle yet.  spill-02.py tests that this restriction kicks in,
but unfortunately I've not yet found a case that would fail without it.
The volatile trick I used for other scavenger tests doesn't work here
because we can't use MVC for volatile accesses anyway.

I'm planning on relaxing the restriction later, hopefully with a test
that does trigger the problem...

Tests @f8 and @f9 also showed that L(G)RL and ST(G)RL were wrongly
classified as SimpleBDX{Load,Store}.  It wouldn't be easy to test for
that bug separately, which is why I didn't split out the fix as a
separate patch.

llvm-svn: 185434

11 years ago[SystemZ] Add the MVC instruction
Richard Sandiford [Tue, 2 Jul 2013 14:56:45 +0000 (14:56 +0000)]
[SystemZ] Add the MVC instruction

This is the first use of D(L,B) addressing, which required a fair bit
of surgery.  For that reason, the patch just adds the instruction
definition and the associated assembler and disassembler support.
A later patch will actually make use of it for codegen.

llvm-svn: 185433

11 years ago[sanitizer] Fix Android build.
Evgeniy Stepanov [Tue, 2 Jul 2013 14:51:31 +0000 (14:51 +0000)]
[sanitizer] Fix Android build.

llvm-svn: 185432

11 years ago[msan] Intercept mempcpy, wmempcpy.
Evgeniy Stepanov [Tue, 2 Jul 2013 14:49:24 +0000 (14:49 +0000)]
[msan] Intercept mempcpy, wmempcpy.

llvm-svn: 185431

11 years ago[XCore] Fix instruction selection for zext, mkmsk instructions.
Richard Osborne [Tue, 2 Jul 2013 14:46:34 +0000 (14:46 +0000)]
[XCore] Fix instruction selection for zext, mkmsk instructions.

r182680 replaced CountLeadingZeros_32 with a template function
countLeadingZeros that relies on using the correct argument type to give
the right result. The type passed in the XCore backend after this
revision was incorrect in a couple of places.

Patch by Robert Lytton.

llvm-svn: 185430

11 years ago[autoconf/cmake] Make sure we detect the latest version of isl.
Tobias Grosser [Tue, 2 Jul 2013 14:11:32 +0000 (14:11 +0000)]
[autoconf/cmake] Make sure we detect the latest version of isl.

llvm-svn: 185429

11 years ago[sanitizer] Fix GLOB_NOMATCH behaviour and refactor the interceptor a bit.
Evgeniy Stepanov [Tue, 2 Jul 2013 14:08:52 +0000 (14:08 +0000)]
[sanitizer] Fix GLOB_NOMATCH behaviour and refactor the interceptor a bit.

llvm-svn: 185428

11 years agoBuild standalone debug symbol file support on FreeBSD too
Ed Maste [Tue, 2 Jul 2013 13:52:38 +0000 (13:52 +0000)]
Build standalone debug symbol file support on FreeBSD too

llvm-svn: 185425

11 years ago[sanitizer] Intercept mbtowc, mbrtowc, get_current_dir_name.
Evgeniy Stepanov [Tue, 2 Jul 2013 13:34:44 +0000 (13:34 +0000)]
[sanitizer] Intercept mbtowc, mbrtowc, get_current_dir_name.

Move getcwd to common interceptors.

llvm-svn: 185424

11 years agoFix ranges computed by git clang-format.
Daniel Jasper [Tue, 2 Jul 2013 13:20:35 +0000 (13:20 +0000)]
Fix ranges computed by git clang-format.

Before, the computed byte range would include the trailing newline.
clang-format on the other hand counts whitespace as belonging to the
following token, so that git-clang-format inadvertendly reformats the
first unmodified line as well.

It is not entirely clear whether clang-format's behavior itself should
be modified, but for now this seems to be a safe change.

llvm-svn: 185423

11 years agoFix ARM EHABI compact model 1 and 2 without handlerdata.
Logan Chien [Tue, 2 Jul 2013 12:43:27 +0000 (12:43 +0000)]
Fix ARM EHABI compact model 1 and 2 without handlerdata.

According to ARM EHABI section 9.2, if the
__aeabi_unwind_cpp_pr1() or __aeabi_unwind_cpp_pr2() is
used, then the handler data must be emitted after the unwind
opcodes.  The handler data consists of several words, and
should be terminated by zero.

In case that the .handlerdata directive is not specified by
the programmer, we should emit zero to terminate the handler
data.

llvm-svn: 185422

11 years agoFixed alignment of code sections in the JIT mode. Added a test to the JITMemoryManager.
Elena Demikhovsky [Tue, 2 Jul 2013 12:24:22 +0000 (12:24 +0000)]
Fixed alignment of code sections in the JIT mode. Added a test to the JITMemoryManager.

llvm-svn: 185421

11 years agoRemoved unused friend declaration.
Rui Ueyama [Tue, 2 Jul 2013 11:13:43 +0000 (11:13 +0000)]
Removed unused friend declaration.

llvm-svn: 185420

11 years agoDAGCombiner: fix use-counting issue when forming zextload
Tim Northover [Tue, 2 Jul 2013 09:58:53 +0000 (09:58 +0000)]
DAGCombiner: fix use-counting issue when forming zextload

DAGCombiner was counting all uses of a load node  when considering whether it's
worth combining into a zextload. Really, it wants to ignore the chain and just
count real uses.

rdar://problem/13896307

llvm-svn: 185419

11 years agoFix formatting of long declarations with const type.
Daniel Jasper [Tue, 2 Jul 2013 09:47:29 +0000 (09:47 +0000)]
Fix formatting of long declarations with const type.

Before (exceeding the column limit):
LoooooooooooooooooooooooooooooooooooooooongType const LoooooooooooooooooooooooooooooooooooooooongVariable;

After:
LoooooooooooooooooooooooooooooooooooooooongType const
LoooooooooooooooooooooooooooooooooooooooongVariable;

llvm-svn: 185418

11 years agoTeach static analyzer about AttributedStmts
Pavel Labath [Tue, 2 Jul 2013 09:38:48 +0000 (09:38 +0000)]
Teach static analyzer about AttributedStmts

Summary:
Static analyzer used to abort when encountering AttributedStmts, because it
asserted that the statements should not appear in the CFG. This is however not
the case, since at least the clang::fallthrough annotation makes it through.

This commit simply makes the analyzer ignore the statement attributes.

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1030

llvm-svn: 185417

11 years ago[sanitizer] Intercept setlocale.
Evgeniy Stepanov [Tue, 2 Jul 2013 09:23:45 +0000 (09:23 +0000)]
[sanitizer] Intercept setlocale.

llvm-svn: 185416

11 years agoRevert r185257 (InstCombine: Be more agressive optimizing 'udiv' instrs with 'select...
Hal Finkel [Tue, 2 Jul 2013 05:21:11 +0000 (05:21 +0000)]
Revert r185257 (InstCombine: Be more agressive optimizing 'udiv' instrs with 'select' denoms)

I'm reverting this commit because:

 1. As discussed during review, it needs to be rewritten (to avoid creating and
then deleting instructions).

 2. This is causing optimizer crashes. Specifically, I'm seeing things like
this:

    While deleting: i1 %
    Use still stuck around after Def is destroyed:  <badref> = select i1 <badref>, i32 0, i32 1
    opt: /src/llvm-trunk/lib/IR/Value.cpp:79: virtual llvm::Value::~Value(): Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed.

   I'd guess that these will go away once we're no longer creating/deleting
instructions here, but just in case, I'm adding a regression test.

Because the code is bring rewritten, I've just XFAIL'd the original regression test. Original commit message:

InstCombine: Be more agressive optimizing 'udiv' instrs with 'select' denoms

Real world code sometimes has the denominator of a 'udiv' be a
'select'.  LLVM can handle such cases but only when the 'select'
operands are symmetric in structure (both select operands are a constant
power of two or a left shift, etc.).  This falls apart if we are dealt a
'udiv' where the code is not symetric or if the select operands lead us
to more select instructions.

Instead, we should treat the LHS and each select operand as a distinct
divide operation and try to optimize them independently.  If we can
to simplify each operation, then we can replace the 'udiv' with, say, a
'lshr' that has a new select with a bunch of new operands for the
select.

llvm-svn: 185415

11 years agoAdd missing break statements. Noticed by inspection.
Nick Lewycky [Tue, 2 Jul 2013 05:02:56 +0000 (05:02 +0000)]
Add missing break statements. Noticed by inspection.

llvm-svn: 185414

11 years agoFix typo in comment
Tobias Grosser [Tue, 2 Jul 2013 04:15:28 +0000 (04:15 +0000)]
Fix typo in comment

llvm-svn: 185413

11 years agoCleanup PPC Altivec registers in CSR lists and improve VRSAVE handling
Hal Finkel [Tue, 2 Jul 2013 03:39:34 +0000 (03:39 +0000)]
Cleanup PPC Altivec registers in CSR lists and improve VRSAVE handling

There are a couple of (small) related changes here:

1. The printed name of the VRSAVE register has been changed from VRsave to
vrsave in order to match the name accepted by GNU binutils.

2. Support for parsing vrsave has been added to the asm parser (it seems that
there was no test case specifically covering this code, so I've added one).

3. The list of Altivec registers, which was common to all calling conventions,
has been separated out. This allows us to define the base CSR lists, and then
lists for each ABI with Altivec included. This allows SjLj, for example, to
work correctly on non-Altivec targets without using unnatural definitions of
the NoRegs CSR list.

4. VRSAVE is now always reserved on non-Darwin targets and all Altivec
registers are reserved when Altivec is disabled.

With these changes, it is now possible to compile a function containing
__builtin_unwind_init() on Linux/PPC64 with debugging information. This did not
work previously because GNU binutils assumes that all .cfi_offset offsets will
be 8-byte aligned on PPC64 (and errors out if you provide a non-8-byte-aligned
offset). This is not true for the vrsave register, however, because this
register is used only on Darwin, GCC does not bother printing a .cfi_offset
entry for it (even though there is a slot in the stack frame for it as
specified by the ABI). This change allows us to do the same: we will also not
print .cfi_offset directives for vrsave.

llvm-svn: 185409

11 years agoIRVerifier: Correctly check attribute types
Tobias Grosser [Tue, 2 Jul 2013 03:28:10 +0000 (03:28 +0000)]
IRVerifier: Correctly check attribute types

Add missing parenthesis such that all and not only the very first attribute
is checked.

Testing this piece of code is not possible with an LLVM-IR test file, as the
LLVM-IR parser has a similar check such that the wrong IR does not even arrive
at the verifier.

llvm-svn: 185408

11 years agoUse the "last created watchpoint" rather than asserting on watchpoint commands passin...
Jim Ingham [Tue, 2 Jul 2013 02:09:46 +0000 (02:09 +0000)]
Use the "last created watchpoint" rather than asserting on watchpoint commands passing no watchpoint ID.

<rdar://problem/14327560>

llvm-svn: 185406

11 years agoDon't skip lambdas when mangling local vars.
Eli Friedman [Tue, 2 Jul 2013 02:01:18 +0000 (02:01 +0000)]
Don't skip lambdas when mangling local vars.

This commit rearranges the logic in CXXNameMangler::mangleLocalName and
GetLocalClassDecl so that it doesn't accidentally skip over lambdas.  It
also reduces code duplication a bit.

llvm-svn: 185402

11 years ago[analyzer] Explicitly disallow mixed Loc-NonLoc comparisons.
Jordan Rose [Tue, 2 Jul 2013 01:37:40 +0000 (01:37 +0000)]
[analyzer] Explicitly disallow mixed Loc-NonLoc comparisons.

The one bit of code that was using this is gone, and neither C nor C++
actually allows this. Add an assertion and remove dead code.

Found by Matthew Dempsky!

llvm-svn: 185401

11 years agoChange the default timeout for KDP communications to be 5 seconds.
Jason Molenda [Tue, 2 Jul 2013 01:29:59 +0000 (01:29 +0000)]
Change the default timeout for KDP communications to be 5 seconds.
<rdar://problem/13793059>

llvm-svn: 185400

11 years ago[mips] Add new InstrItinClasses for move from/to coprocessor instructions and
Akira Hatanaka [Tue, 2 Jul 2013 00:00:02 +0000 (00:00 +0000)]
[mips] Add new InstrItinClasses for move from/to coprocessor instructions and
floating point loads and stores.

No changes in functionality.

llvm-svn: 185399

11 years agoPR14728: DebugInfo: TLS variables with -gsplit-dwarf
David Blaikie [Mon, 1 Jul 2013 23:55:52 +0000 (23:55 +0000)]
PR14728: DebugInfo: TLS variables with -gsplit-dwarf

llvm-svn: 185398

11 years ago[APFloat] Ensure that we can properly parse strings that do not have null terminators.
Michael Gottesman [Mon, 1 Jul 2013 23:54:08 +0000 (23:54 +0000)]
[APFloat] Ensure that we can properly parse strings that do not have null terminators.

rdar://14323230

llvm-svn: 185397

11 years agoFix up some asserts that are within an if statement. This removes the need
Richard Trieu [Mon, 1 Jul 2013 23:42:53 +0000 (23:42 +0000)]
Fix up some asserts that are within an if statement.  This removes the need
for assert(0 && "text").

llvm-svn: 185396

11 years agoTweak some comments that referred to the old bias computations.
Jakob Stoklund Olesen [Mon, 1 Jul 2013 23:36:37 +0000 (23:36 +0000)]
Tweak some comments that referred to the old bias computations.

llvm-svn: 185395

11 years ago[PowerPC] Add support for TLS data relocations
Ulrich Weigand [Mon, 1 Jul 2013 23:33:29 +0000 (23:33 +0000)]
[PowerPC] Add support for TLS data relocations

This adds support for TLS data relocations and modifiers:
       .quad target@dtpmod
       .quad target@tprel
       .quad target@dtprel
Currently exploited by the asm parser only.

llvm-svn: 185394

11 years agoRemove floating point computations form SpillPlacement.cpp.
Jakob Stoklund Olesen [Mon, 1 Jul 2013 23:19:39 +0000 (23:19 +0000)]
Remove floating point computations form SpillPlacement.cpp.

Patch by Benjamin Kramer!

Use the BlockFrequency class instead of floats in the Hopfield network
computations. This rescales the node Bias field from a [-2;2] float
range to two block frequencies BiasN and BiasP pulling in opposite
directions. This construct has a more predictable behavior when block
frequencies saturate.

The per-node scaling factors are no longer necessary, assuming the block
frequencies around a bundle are consistent.

This patch can cause the register allocator to make different spilling
decisions. The differences should be small.

llvm-svn: 185393

11 years agoChange if (cond) ... else llvm_unreachable("text") to assert(cond && "text") ...
Richard Trieu [Mon, 1 Jul 2013 23:06:23 +0000 (23:06 +0000)]
Change if (cond) ... else llvm_unreachable("text") to assert(cond && "text") ...

llvm-svn: 185392

11 years agoXFAIL this test on 10.7 and 10.8
Howard Hinnant [Mon, 1 Jul 2013 22:59:14 +0000 (22:59 +0000)]
XFAIL this test on 10.7 and 10.8

llvm-svn: 185391

11 years ago[PowerPC] Fix 32-bit PowerPC TLS relocs
Ulrich Weigand [Mon, 1 Jul 2013 22:27:57 +0000 (22:27 +0000)]
[PowerPC] Fix 32-bit PowerPC TLS relocs

Some TLS relocs were copied incorrectly from ppc64 to ppc32,
and some were missing completely.

llvm-svn: 185390

11 years agoPR16493: DebugInfo with TLS on PPC crashing due to invalid relocation
David Blaikie [Mon, 1 Jul 2013 21:45:25 +0000 (21:45 +0000)]
PR16493: DebugInfo with TLS on PPC crashing due to invalid relocation

Restrict the current TLS support to X86 ELF for now. Test that we don't
produce it on PPC & we can flesh that test case out with the right thing
once someone implements it.

llvm-svn: 185389

11 years agoAdded SymbolVendorELF to the wrong target (lldb-tool), now it is correctly added...
Greg Clayton [Mon, 1 Jul 2013 21:44:02 +0000 (21:44 +0000)]
Added SymbolVendorELF to the wrong target (lldb-tool), now it is correctly added to lldb-core.

llvm-svn: 185388

11 years ago[PowerPC] Support all condition register logical instructions
Ulrich Weigand [Mon, 1 Jul 2013 21:40:54 +0000 (21:40 +0000)]
[PowerPC] Support all condition register logical instructions

This adds support for all missing condition register logical
instructions and extended mnemonics to the asm parser.

llvm-svn: 185387

11 years agoFixed Xcode project to include SymbolVendorELF.
Greg Clayton [Mon, 1 Jul 2013 21:37:51 +0000 (21:37 +0000)]
Fixed Xcode project to include SymbolVendorELF.

llvm-svn: 185386

11 years agoAdd a newline.
Chad Rosier [Mon, 1 Jul 2013 21:31:10 +0000 (21:31 +0000)]
Add a newline.

llvm-svn: 185385

11 years agoSimplify code in mangler.
Eli Friedman [Mon, 1 Jul 2013 21:29:48 +0000 (21:29 +0000)]
Simplify code in mangler.

llvm-svn: 185384

11 years agoDebug Info: clean up usage of Verify.
Manman Ren [Mon, 1 Jul 2013 21:02:01 +0000 (21:02 +0000)]
Debug Info: clean up usage of Verify.

No functionality change. It should suffice to check the type of a debug info
metadata, instead of calling Verify.

llvm-svn: 185383

11 years agoRecognize "decltype(nullptr)" as a valid DW_AT_name for DW_TAG_unspecified_type tags...
Greg Clayton [Mon, 1 Jul 2013 21:01:52 +0000 (21:01 +0000)]
Recognize "decltype(nullptr)" as a valid DW_AT_name for DW_TAG_unspecified_type tags as meaning the C++11 null pointer type.

llvm-svn: 185382

11 years agoSimplify linkage code for static local vars.
Eli Friedman [Mon, 1 Jul 2013 20:53:07 +0000 (20:53 +0000)]
Simplify linkage code for static local vars.

The key insight here is that weak linkage for a static local variable
should always mean linkonce_odr, because every file that needs it will
generate a definition.  We don't actually care about the precise linkage
of the parent context.  I feel a bit silly that I didn't realize this before.

llvm-svn: 185381

11 years agoIndex: test/CodeGen/PowerPC/reloc-align.ll
Bill Schmidt [Mon, 1 Jul 2013 20:52:27 +0000 (20:52 +0000)]
Index: test/CodeGen/PowerPC/reloc-align.ll
===================================================================
--- test/CodeGen/PowerPC/reloc-align.ll (revision 0)
+++ test/CodeGen/PowerPC/reloc-align.ll (revision 0)
@@ -0,0 +1,34 @@
+; RUN: llc -mcpu=pwr7 -O1 < %s | FileCheck %s
+
+; This test verifies that the peephole optimization of address accesses
+; does not produce a load or store with a relocation that can't be
+; satisfied for a given instruction encoding.  Reduced from a test supplied
+; by Hal Finkel.
+
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+%struct.S1 = type { [8 x i8] }
+
+@main.l_1554 = internal global { i8, i8, i8, i8, i8, i8, i8, i8 } { i8 -1, i8 -6, i8 57, i8 62, i8 -48, i8 0, i8 58, i8 80 }, align 1
+
+; Function Attrs: nounwind readonly
+define signext i32 @main() #0 {
+entry:
+  %call = tail call fastcc signext i32 @func_90(%struct.S1* byval bitcast ({ i8, i8, i8, i8, i8, i8, i8, i8 }* @main.l_1554 to %struct.S1*))
+; CHECK-NOT: ld {{[0-9]+}}, main.l_1554@toc@l
+  ret i32 %call
+}
+
+; Function Attrs: nounwind readonly
+define internal fastcc signext i32 @func_90(%struct.S1* byval nocapture %p_91) #0 {
+entry:
+  %0 = bitcast %struct.S1* %p_91 to i64*
+  %bf.load = load i64* %0, align 1
+  %bf.shl = shl i64 %bf.load, 26
+  %bf.ashr = ashr i64 %bf.shl, 54
+  %bf.cast = trunc i64 %bf.ashr to i32
+  ret i32 %bf.cast
+}
+
+attributes #0 = { nounwind readonly "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
Index: lib/Target/PowerPC/PPCAsmPrinter.cpp
===================================================================
--- lib/Target/PowerPC/PPCAsmPrinter.cpp (revision 185327)
+++ lib/Target/PowerPC/PPCAsmPrinter.cpp (working copy)
@@ -679,7 +679,26 @@ void PPCAsmPrinter::EmitInstruction(const MachineI
       OutStreamer.EmitRawText(StringRef("\tmsync"));
       return;
     }
+    break;
+  case PPC::LD:
+  case PPC::STD:
+  case PPC::LWA: {
+    // Verify alignment is legal, so we don't create relocations
+    // that can't be supported.
+    // FIXME:  This test is currently disabled for Darwin.  The test
+    // suite shows a handful of test cases that fail this check for
+    // Darwin.  Those need to be investigated before this sanity test
+    // can be enabled for those subtargets.
+    if (!Subtarget.isDarwin()) {
+      unsigned OpNum = (MI->getOpcode() == PPC::STD) ? 2 : 1;
+      const MachineOperand &MO = MI->getOperand(OpNum);
+      if (MO.isGlobal() && MO.getGlobal()->getAlignment() < 4)
+        llvm_unreachable("Global must be word-aligned for LD, STD, LWA!");
+    }
+    // Now process the instruction normally.
+    break;
   }
+  }

   LowerPPCMachineInstrToMCInst(MI, TmpInst, *this);
   OutStreamer.EmitInstruction(TmpInst);
Index: lib/Target/PowerPC/PPCISelDAGToDAG.cpp
===================================================================
--- lib/Target/PowerPC/PPCISelDAGToDAG.cpp (revision 185327)
+++ lib/Target/PowerPC/PPCISelDAGToDAG.cpp (working copy)
@@ -1530,6 +1530,14 @@ void PPCDAGToDAGISel::PostprocessISelDAG() {
       if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(ImmOpnd)) {
         SDLoc dl(GA);
         const GlobalValue *GV = GA->getGlobal();
+        // We can't perform this optimization for data whose alignment
+        // is insufficient for the instruction encoding.
+        if (GV->getAlignment() < 4 &&
+            (StorageOpcode == PPC::LD || StorageOpcode == PPC::STD ||
+             StorageOpcode == PPC::LWA)) {
+          DEBUG(dbgs() << "Rejected this candidate for alignment.\n\n");
+          continue;
+        }
         ImmOpnd = CurDAG->getTargetGlobalAddress(GV, dl, MVT::i64, 0, Flags);
       } else if (ConstantPoolSDNode *CP =
                  dyn_cast<ConstantPoolSDNode>(ImmOpnd)) {

llvm-svn: 185380

11 years ago[ARMAsmParser] Sort the ARM register lists based on the encoding value, not the
Chad Rosier [Mon, 1 Jul 2013 20:49:23 +0000 (20:49 +0000)]
[ARMAsmParser] Sort the ARM register lists based on the encoding value, not the
tablegen enum values.  This should be the last fix due to fallout from r185094.

llvm-svn: 185379

11 years agoMake PBQP require/preserve MachineLoopInfo - the spiller requires it.
Lang Hames [Mon, 1 Jul 2013 20:47:47 +0000 (20:47 +0000)]
Make PBQP require/preserve MachineLoopInfo - the spiller requires it.

llvm-svn: 185378

11 years ago[docs] Amend confusing title
Sean Silva [Mon, 1 Jul 2013 20:45:12 +0000 (20:45 +0000)]
[docs] Amend confusing title

"Writing an LLVM Compiler Backend" can be misinterpreted as meaning
"backend" in the sense of "using LLVM as a backend for your compiler for
your new language". This new name is less ambiguous.

As a bonus, this brings the title in line with the file name.

llvm-svn: 185377

11 years ago[mips] Reverse the order of source operands of shift and rotate instructions that
Akira Hatanaka [Mon, 1 Jul 2013 20:39:53 +0000 (20:39 +0000)]
[mips] Reverse the order of source operands of shift and rotate instructions that
have three register operands.

No intended functionality changes.

llvm-svn: 185376

11 years ago[PowerPC] Also add "msync" alias
Ulrich Weigand [Mon, 1 Jul 2013 20:39:50 +0000 (20:39 +0000)]
[PowerPC] Also add "msync" alias

This adds an alias for "msync" (which is used on Book E
systems instead of "sync").

llvm-svn: 185375

11 years agoFix CMakeLists.txt.
Eli Friedman [Mon, 1 Jul 2013 20:34:51 +0000 (20:34 +0000)]
Fix CMakeLists.txt.

Sorry about that.

llvm-svn: 185374

11 years ago[mips] Increase the number of floating point control registers available to 32.
Akira Hatanaka [Mon, 1 Jul 2013 20:31:44 +0000 (20:31 +0000)]
[mips] Increase the number of floating point control registers available to 32.
Create a dedicated register class for floating point condition code registers and
move FCC0 from register class CCR to the new register class.

llvm-svn: 185373

11 years agoFix mangling for block literals.
Eli Friedman [Mon, 1 Jul 2013 20:22:57 +0000 (20:22 +0000)]
Fix mangling for block literals.

Blocks, like lambdas, can be written in contexts which are required to be
treated as the same under ODR.  Unlike lambdas, it isn't possible to actually
take the address of a block, so the mangling of the block itself doesn't
matter. However, objects like static variables inside a block do need to
be mangled in a consistent way.

There are basically three components here. One, block literals need a
consistent numbering.  Two, objects/types inside a block literal need
to be mangled using it.  Three, objects/types inside a block literal need
to have their linkage computed correctly.

llvm-svn: 185372

11 years ago[mips] Fix test case to check that mips64 instructions are generated.
Akira Hatanaka [Mon, 1 Jul 2013 20:18:58 +0000 (20:18 +0000)]
[mips] Fix test case to check that mips64 instructions are generated.

llvm-svn: 185371