platform/upstream/llvm.git
10 years agoPR11306 - Variadic template fix-it suggestion. Recover from misplaced or redundant...
Nikola Smiljanic [Fri, 6 Jun 2014 02:58:59 +0000 (02:58 +0000)]
PR11306 - Variadic template fix-it suggestion. Recover from misplaced or redundant ellipsis in parameter pack.

llvm-svn: 210304

10 years agoUpdate for llvm api change.
Rafael Espindola [Fri, 6 Jun 2014 01:20:47 +0000 (01:20 +0000)]
Update for llvm api change.

llvm-svn: 210303

10 years agoAllow aliases to be unnamed_addr.
Rafael Espindola [Fri, 6 Jun 2014 01:20:28 +0000 (01:20 +0000)]
Allow aliases to be unnamed_addr.

Alias with unnamed_addr were in a strange state. It is stored in GlobalValue,
the language reference talks about "unnamed_addr aliases" but the verifier
was rejecting them.

It seems natural to allow unnamed_addr in aliases:

* It is a property of how it is accessed, not of the data itself.
* It is perfectly possible to write code that depends on the address
of an alias.

This patch then makes unname_addr legal for aliases. One side effect is that
the syntax changes for a corner case: In globals, unnamed_addr is now printed
before the address space.

llvm-svn: 210302

10 years ago[TSan] Reduce the stack frame size of ReportDeadlock
Alexey Samsonov [Thu, 5 Jun 2014 23:24:46 +0000 (23:24 +0000)]
[TSan] Reduce the stack frame size of ReportDeadlock

llvm-svn: 210301

10 years agoFix markup for -debug-only option
Alexey Samsonov [Thu, 5 Jun 2014 23:12:43 +0000 (23:12 +0000)]
Fix markup for -debug-only option

llvm-svn: 210300

10 years agoFix null dereference with -debug-only=dwarfdebug
Alexey Samsonov [Thu, 5 Jun 2014 23:10:19 +0000 (23:10 +0000)]
Fix null dereference with -debug-only=dwarfdebug

llvm-svn: 210299

10 years agoCorrectly set the comdat symbol on COFF.
Rafael Espindola [Thu, 5 Jun 2014 23:09:25 +0000 (23:09 +0000)]
Correctly set the comdat symbol on COFF.

We extended the .section syntax to allow multiple sections with the
same name but different comdats, but currently we don't make sure that
the output section has that comdat symbol.

That happens to work with the code llc produces currently because it looks like

.section secName, "dr", one_only, "COMDATSym"
.globl COMDATSym
COMDATSym:
....

but that is not very friendly to anyone coding in assembly or even to
llc once we get comdat support in the IR.

This patch changes the coff object writer to make sure the comdat symbol is
output just after the section symbol, as required by the coff spec.

llvm-svn: 210298

10 years ago[PPC64LE] Add test case for r210282 commit
Bill Schmidt [Thu, 5 Jun 2014 22:57:38 +0000 (22:57 +0000)]
[PPC64LE] Add test case for r210282 commit

Chandler correctly pointed out that I need an LLVM IR test for
r210282, which modified the vperm -> shuffle transform for little
endian PowerPC.  This patch provides that test.

llvm-svn: 210297

10 years agoPR19936: Fix a really dumb bug where we would profile dependent operator* expressions...
Richard Smith [Thu, 5 Jun 2014 22:43:40 +0000 (22:43 +0000)]
PR19936: Fix a really dumb bug where we would profile dependent operator* expressions incorrectly.

llvm-svn: 210296

10 years agoRemove old proposal notices
Alp Toker [Thu, 5 Jun 2014 22:11:20 +0000 (22:11 +0000)]
Remove old proposal notices

Let's just go ahead and assume the answer was 'I do'

llvm-svn: 210295

10 years agoProvide fallback locations for backend remarks
Alp Toker [Thu, 5 Jun 2014 22:11:12 +0000 (22:11 +0000)]
Provide fallback locations for backend remarks

Instead of disembodied diagnostics when debug info is disabled it's now
possible to identify the associated function's location in order to provide
some amount of of context.

We use the definition's body right brace location to differentiate the fallback
from diagnostics that genuinely relate to the function declaration itself (a
convention also used by gcc).

llvm-svn: 210294

10 years agoImplement -Wframe-larger-than backend diagnostic
Alp Toker [Thu, 5 Jun 2014 22:10:59 +0000 (22:10 +0000)]
Implement -Wframe-larger-than backend diagnostic

Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning.
This is the first GCC-compatible backend diagnostic built around LLVM's
reporting feature.

This commit adds infrastructure to perform reverse lookup from mangled names
emitted after LLVM IR generation. We use that to resolve precise locations and
originating AST functions, lambdas or block declarations to produce seamless
codegen-guided diagnostics.

An associated change, StringMap now maintains unique mangled name strings
instead of allocating copies. This is a net memory saving in C++ and a small
hit for C where we no longer reuse IdentifierInfo storage, pending further
optimisation.

llvm-svn: 210293

10 years agoRemove X86Subtarget from the X86FrameLowering constructor since
Eric Christopher [Thu, 5 Jun 2014 22:10:58 +0000 (22:10 +0000)]
Remove X86Subtarget from the X86FrameLowering constructor since
we can just pass in the values we already know and we're not
caching the subtarget anymore.

llvm-svn: 210292

10 years agoFixed several correctness issues in SeparateConstOffsetFromGEP
Jingyue Wu [Thu, 5 Jun 2014 22:07:33 +0000 (22:07 +0000)]
Fixed several correctness issues in SeparateConstOffsetFromGEP

Most issues are on mishandling s/zext.

Fixes:

1. When rebuilding new indices, s/zext should be distributed to
sub-expressions. e.g., sext(a +nsw (b +nsw 5)) = sext(a) + sext(b) + 5 but not
sext(a + b) + 5. This also affects the logic of recursively looking for a
constant offset, we need to include s/zext into the context of the searching.

2. Function find should return the bitwidth of the constant offset instead of
always sign-extending it to i64.

3. Stop shortcutting zext'ed GEP indices. LLVM conceptually sign-extends GEP
indices to pointer-size before computing the address. Therefore, gep base,
zext(a + b) != gep base, a + b

Improvements:

1. Add an optimization for splitting sext(a + b): if a + b is proven
non-negative (e.g., used as an index of an inbound GEP) and one of a, b is
non-negative, sext(a + b) = sext(a) + sext(b)

2. Function Distributable checks whether both sext and zext can be distributed
to operands of a binary operator. This helps us split zext(sext(a + b)) to
zext(sext(a) + zext(sext(b)) when a + b does not signed or unsigned overflow.

Refactoring:

Merge some common logic of handling add/sub/or in find.

Testing:

Add many tests in split-gep.ll and split-gep-and-gvn.ll to verify the changes
we made.

llvm-svn: 210291

10 years agoRemove caching of the subtarget for X86FrameLowering.
Eric Christopher [Thu, 5 Jun 2014 22:00:31 +0000 (22:00 +0000)]
Remove caching of the subtarget for X86FrameLowering.

llvm-svn: 210290

10 years agoRemove duplicate copy of InstrItineraryData from the TargetMachine,
Eric Christopher [Thu, 5 Jun 2014 21:42:54 +0000 (21:42 +0000)]
Remove duplicate copy of InstrItineraryData from the TargetMachine,
it's already on the subtarget.

llvm-svn: 210289

10 years agoAdding explicit triples to the ARM jumptable tests
Tom Roeder [Thu, 5 Jun 2014 21:40:13 +0000 (21:40 +0000)]
Adding explicit triples to the ARM jumptable tests

llvm-svn: 210288

10 years agoAdd a testcase where there is an overflow when combining two constants.
Rafael Espindola [Thu, 5 Jun 2014 21:29:49 +0000 (21:29 +0000)]
Add a testcase where there is an overflow when combining two constants.

I noticed that a proposed optimization would have prevented this.

llvm-svn: 210287

10 years agoWhen an inline-asm diagnostic is reported by the backend, report it with the
Joey Gouly [Thu, 5 Jun 2014 21:23:42 +0000 (21:23 +0000)]
When an inline-asm diagnostic is reported by the backend, report it with the
correct severity.

Previously all inline-asm diagnostics were reported as errors.

llvm-svn: 210286

10 years agoAdd "-format darwin" to llvm-nm to be like darwin's nm(1) -m output.
Kevin Enderby [Thu, 5 Jun 2014 21:21:57 +0000 (21:21 +0000)]
Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output.

This is a first step in seeing if it is possible to make llvm-nm produce
the same output as darwin's nm(1).  Darwin's default format is bsd but its
-m output prints the longer Mach-O specific details.  For now I added the
"-format darwin" to do this (whos name may need to change in the future).
As there are other Mach-O specific flags to nm(1) which I'm hoping to add some
how in the future.  But I wanted to see if I could get the correct output for
-m flag using llvm-nm and the libObject interfaces.

I got this working but would love to hear what others think about this approach
to getting object/format specific details printed with llvm-nm.

llvm-svn: 210285

10 years agoMangle predefined string constants names to merge them at link-time
Alexey Samsonov [Thu, 5 Jun 2014 20:53:34 +0000 (20:53 +0000)]
Mangle predefined string constants names to merge them at link-time

Summary:
This change generalizes the code used to create global LLVM
variables referencing predefined strings (e.g. __FUNCTION__): now it
just calls GetAddrOfConstantStringFromLiteral method. As a result,
global variables for these predefined strings may get mangled names
and linkonce_odr linkage. Fix the test accordingly.

Test Plan: clang regression tests

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: cfe-commits

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

llvm-svn: 210284

10 years agoCleanup, and always create a DecltypeType for a decltype expression, rather
Richard Smith [Thu, 5 Jun 2014 20:13:13 +0000 (20:13 +0000)]
Cleanup, and always create a DecltypeType for a decltype expression, rather
than omitting it the first time we see a decltype type with a particular
expression.

llvm-svn: 210283

10 years ago[PPC64LE] Correct vperm -> shuffle transform for little endian
Bill Schmidt [Thu, 5 Jun 2014 19:46:04 +0000 (19:46 +0000)]
[PPC64LE] Correct vperm -> shuffle transform for little endian

As discussed in cfe commit r210279, the correct little-endian
semantics for the vec_perm Altivec interfaces are implemented by
reversing the order of the input vectors and complementing the permute
control vector.  This converts the desired permute from little endian
element order into the big endian element order that the underlying
PowerPC vperm instruction uses.  This is represented with a
ppc_altivec_vperm intrinsic function.

The instruction combining pass contains code to convert a
ppc_altivec_vperm intrinsic into a vector shuffle operation when the
intrinsic has a permute control vector (mask) that is a constant.
However, the vector shuffle operation assumes that vector elements are
in natural order for their endianness, so for little endian code we
will get the wrong result with the existing transformation.

This patch reverses the semantic change to vec_perm that was performed
in altivec.h by once again swapping the input operands and
complementing the permute control vector, returning the element
ordering to little endian.

The correctness of this code is tested by the new perm.c test added in
a previous patch, and by other tests in the test suite that fail
without this patch.

llvm-svn: 210282

10 years agoRemoving spurious dependency of IPO on JumpInstrTables
Tom Roeder [Thu, 5 Jun 2014 19:43:57 +0000 (19:43 +0000)]
Removing spurious dependency of IPO on JumpInstrTables

llvm-svn: 210281

10 years agoAdd a new attribute called 'jumptable' that creates jump-instruction tables for funct...
Tom Roeder [Thu, 5 Jun 2014 19:29:43 +0000 (19:29 +0000)]
Add a new attribute called 'jumptable' that creates jump-instruction tables for functions marked with this attribute.
It includes a pass that rewrites all indirect calls to jumptable functions to pass through these tables.

This also adds backend support for generating the jump-instruction tables on ARM and X86.
Note that since the jumptable attribute creates a second function pointer for a
function, any function marked with jumptable must also be marked with unnamed_addr.

llvm-svn: 210280

10 years ago[PPC64LE] Implement little-endian semantics for vec_perm
Bill Schmidt [Thu, 5 Jun 2014 19:07:40 +0000 (19:07 +0000)]
[PPC64LE] Implement little-endian semantics for vec_perm

The PowerPC vperm (vector permute) instruction is defined
architecturally with a big-endian bias, in that the two input vectors
are assumed to be concatenated "left to right" and the elements of the
combined input vector are assumed to be numbered from "left to right"
(i.e., with element 0 referencing the high-order element).  This
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_perm interface is designed to
use natural element ordering, so that elements are numbered according
to little-endian design principles when code is generated for a
little-endian target.  The desired semantics can be achieved with the
vperm instruction provided that the two input vector registers are
reversed, and the permute control vector is complemented.  The
complementing is performed using an xor with a vector containing all
one bits.

Only the rightmost 5 bits of each element of the permute control
vector are relevant, so it would be possible to complement the vector
with respect to a <16xi8> vector containing all 31s.  However, when
the permute control vector is not a constant, using 255 instead has
the advantage that the vec_xor can be recognized during code
generation as a vnor instruction.  (Power8 introduces a vnand
instruction which could alternatively be generated.)

The correctness of this code is tested by the new perm.c test added in
a previous patch.  I plan to later make the existing ppc32 Altivec
compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210279

10 years agoAdd hasLocalStorage/hasGlobalStorage matchers.
Samuel Benzaquen [Thu, 5 Jun 2014 18:22:14 +0000 (18:22 +0000)]
Add hasLocalStorage/hasGlobalStorage matchers.

Summary:
Add hasLocalStorage/hasGlobalStorage matchers for VarDecl nodes.
Update the doc. Also add them to the dynamic registry.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210278

10 years agoFix bot for named register test
Renato Golin [Thu, 5 Jun 2014 16:52:20 +0000 (16:52 +0000)]
Fix bot for named register test

llvm-svn: 210275

10 years agoAdd pointer types to global named register
Renato Golin [Thu, 5 Jun 2014 16:45:22 +0000 (16:45 +0000)]
Add pointer types to global named register

This patch adds support for pointer types in global named registers variables.
It'll be lowered as a pair of read/write_register and inttoptr/ptrtoint calls.
Also adds some early checks on types on SemaDecl to avoid the assert.

Tests changed accordingly. (PR19837)

llvm-svn: 210274

10 years agoDocument how to select build configuration with Visual C++ IDE or command line.
Yaron Keren [Thu, 5 Jun 2014 16:42:26 +0000 (16:42 +0000)]
Document how to select build configuration with Visual C++ IDE or command line.

llvm-svn: 210273

10 years agoAdded gdb-remote test for software breakpoints.
Todd Fiala [Thu, 5 Jun 2014 16:34:13 +0000 (16:34 +0000)]
Added gdb-remote test for software breakpoints.

Tests $Z0 and $z0.  Extends test exe get-code-address-hex:
to take a function name.

Enabled for debugserver, disabled for llgs.  Implementing
in llgs branch next.

llvm-svn: 210272

10 years ago[PPC64LE] Temporarily disable VSX support in little-endian mode
Bill Schmidt [Thu, 5 Jun 2014 16:21:13 +0000 (16:21 +0000)]
[PPC64LE] Temporarily disable VSX support in little-endian mode

This is a preliminary patch for the PowerPC64LE support.  In stage 1
of the vector support, we will support the VMX (Altivec) instruction
set, but will not yet support the VSX instructions.  This is merely a
staging issue to provide functional vector support as soon as
possible.

llvm-svn: 210271

10 years ago[mips] Add macros _MIPS_ISA and __mips_isa_rev (same expansion as defined by GCC).
Matheus Almeida [Thu, 5 Jun 2014 14:59:18 +0000 (14:59 +0000)]
[mips] Add macros _MIPS_ISA and __mips_isa_rev (same expansion as defined by GCC).

Summary: The Linux Kernel is one example of a piece of software that relies on them.

Reviewers: atanasyan

Reviewed By: atanasyan

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

llvm-svn: 210270

10 years agoFix equalsNode() to accept pointers to derived types.
Samuel Benzaquen [Thu, 5 Jun 2014 14:47:08 +0000 (14:47 +0000)]
Fix equalsNode() to accept pointers to derived types.

Summary:
Move the 'const' in the AST_*MATCHER_P* macros to the right of ParamType to
avoiad applying the constness on the wrong level when ParamType is a pointer.
Change equalsNode() to explicitly accept 'const Decl*' or 'const Stmt*'.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210269

10 years agoRemove unused defines from lldb driver.
Todd Fiala [Thu, 5 Jun 2014 14:46:04 +0000 (14:46 +0000)]
Remove unused defines from lldb driver.

See http://reviews.llvm.org/D3965 for details.

Change by Thiago Farina.

llvm-svn: 210268

10 years ago[asancov] Faster coverage in memory-mapped mode.
Evgeniy Stepanov [Thu, 5 Jun 2014 14:38:53 +0000 (14:38 +0000)]
[asancov] Faster coverage in memory-mapped mode.

Use caller pc of __sanitizer_cov_module_init to figure out
when 2 sequential calls are from the same module; skip
.sancov.map file update in this case.

llvm-svn: 210267

10 years ago[asancov] Fix coverage line info some more.
Evgeniy Stepanov [Thu, 5 Jun 2014 14:34:45 +0000 (14:34 +0000)]
[asancov] Fix coverage line info some more.

Now it should always point to the opening brace of the function (in
-asan-coverage=1 mode).

llvm-svn: 210266

10 years agoAdd missing const specifier to a const method.
Evgeniy Stepanov [Thu, 5 Jun 2014 14:32:15 +0000 (14:32 +0000)]
Add missing const specifier to a const method.

llvm-svn: 210265

10 years agoXFAIL: test/DebugInfo/missing-abstract-variable.ll on s390x as well
Ulrich Weigand [Thu, 5 Jun 2014 14:20:54 +0000 (14:20 +0000)]
XFAIL: test/DebugInfo/missing-abstract-variable.ll on s390x as well

llvm-svn: 210264

10 years ago[SystemZ] Do not install IfConverter pass at -O0
Ulrich Weigand [Thu, 5 Jun 2014 14:20:10 +0000 (14:20 +0000)]
[SystemZ] Do not install IfConverter pass at -O0

When not optimizing, do not run the IfConverter pass, this makes
debugging more difficult (and causes a testsuite failure in
DebugInfo/unconditional-branch.ll).

llvm-svn: 210263

10 years ago[mips] Modify long branch for NaCl:
Sasa Stankovic [Thu, 5 Jun 2014 13:52:08 +0000 (13:52 +0000)]
[mips] Modify long branch for NaCl:

  * Move the instruction that changes sp outside of the branch delay slot.
  * Bundle-align the target of indirect branch.

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

llvm-svn: 210262

10 years agoPrevent hoisting the instruction whose def might be clobbered by the terminator.
Sasa Stankovic [Thu, 5 Jun 2014 13:42:48 +0000 (13:42 +0000)]
Prevent hoisting the instruction whose def might be clobbered by the terminator.

llvm-svn: 210261

10 years agoAllow per-file clang-tidy options.
Alexander Kornienko [Thu, 5 Jun 2014 13:31:45 +0000 (13:31 +0000)]
Allow per-file clang-tidy options.

Summary:
This patch makes it possible for clang-tidy clients to provide
different options for different translation units. The option, which doesn't
make sense to be file-dependent, was moved to a separate ClangTidyGlobalOptions
struct. Added parsing of ClangTidyOptions.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

llvm-svn: 210260

10 years ago[asan] asan_device_setup: extend search path
Evgeniy Stepanov [Thu, 5 Jun 2014 12:49:35 +0000 (12:49 +0000)]
[asan] asan_device_setup: extend search path

In standalone build asan-rt is stored in yet another path.

llvm-svn: 210259

10 years ago[Mips] Make dynlib-dynsym.test self contained.
Simon Atanasyan [Thu, 5 Jun 2014 12:39:12 +0000 (12:39 +0000)]
[Mips] Make dynlib-dynsym.test self contained.

llvm-svn: 210258

10 years ago[asan] Add 'asan' to asan test deps.
Evgeniy Stepanov [Thu, 5 Jun 2014 12:31:22 +0000 (12:31 +0000)]
[asan] Add 'asan' to asan test deps.

This sound like a good idea in general.
Also, without this on Android we get add_lit_testsuite() with empty DEPENDS
list, and it does not work well.

llvm-svn: 210257

10 years ago[asan] Fix lit tests setup on Android.
Evgeniy Stepanov [Thu, 5 Jun 2014 12:29:47 +0000 (12:29 +0000)]
[asan] Fix lit tests setup on Android.

Pass cflags in a way that's compatible with standalone compiler-rt build.

llvm-svn: 210256

10 years ago[asan] Use -pthread instead of -lpthread in tests.
Evgeniy Stepanov [Thu, 5 Jun 2014 12:22:37 +0000 (12:22 +0000)]
[asan] Use -pthread instead of -lpthread in tests.

llvm-svn: 210255

10 years ago[mips] Fix triple.
Matheus Almeida [Thu, 5 Jun 2014 12:07:14 +0000 (12:07 +0000)]
[mips] Fix triple.

Mips2 is a 32-bit architecture.

llvm-svn: 210254

10 years agoFix driver warning about -pthread on Android.
Evgeniy Stepanov [Thu, 5 Jun 2014 11:41:39 +0000 (11:41 +0000)]
Fix driver warning about -pthread on Android.

-pthread is no-op on Android. Suppress the unused argument warning.

llvm-svn: 210253

10 years agoFix driver warning about -shared-libasan on Android.
Evgeniy Stepanov [Thu, 5 Jun 2014 11:14:00 +0000 (11:14 +0000)]
Fix driver warning about -shared-libasan on Android.

Asan runtime library is always shared on Android, and -shared-libasan is no-op.
Suppress the unused argument warning.

llvm-svn: 210252

10 years agoXCore target: Fix 'typestring' binding qualifier to the array and not the type
Robert Lytton [Thu, 5 Jun 2014 09:06:21 +0000 (09:06 +0000)]
XCore target: Fix 'typestring' binding qualifier to the array and not the type

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

llvm-svn: 210250

10 years agolld (build with configur and make) Enable build
Iain Sandoe [Thu, 5 Jun 2014 08:49:55 +0000 (08:49 +0000)]
lld (build with configur and make) Enable build

r210177 added Makefiles to the lld project.
This revision enables the automatic build of lld when the sources are found in tools/lld.

llvm-svn: 210245

10 years agoR600: Fix test. Using wrong check prefix.
Matt Arsenault [Thu, 5 Jun 2014 08:00:36 +0000 (08:00 +0000)]
R600: Fix test. Using wrong check prefix.

llvm-svn: 210244

10 years agoRevert "[PECOFF] Support COMDAT associative sections."
Rui Ueyama [Thu, 5 Jun 2014 07:40:59 +0000 (07:40 +0000)]
Revert "[PECOFF] Support COMDAT associative sections."

This reverts accidental commit r210240.

llvm-svn: 210243

10 years agoAdd SymbolTable::isCoalescedAway
Rui Ueyama [Thu, 5 Jun 2014 07:37:29 +0000 (07:37 +0000)]
Add SymbolTable::isCoalescedAway

isCoalescedAway(x) is faster than replacement(x) != x as the former
does not follow the replacement atom chain. Also it's easier to use.

llvm-svn: 210242

10 years agoPrint error message in LinkOnce handler.
Rui Ueyama [Thu, 5 Jun 2014 07:37:25 +0000 (07:37 +0000)]
Print error message in LinkOnce handler.

Rather than outside of the handler function to make the code simple.

llvm-svn: 210241

10 years ago[PECOFF] Support COMDAT associative sections.
Rui Ueyama [Thu, 5 Jun 2014 07:37:20 +0000 (07:37 +0000)]
[PECOFF] Support COMDAT associative sections.

COFF supports a feature similar to ELF's section groups. This
patch implements it.

In ELF, section groups are identified by their names, and they are
treated somewhat differently from regular symbols. In COFF, the
feature is realized in a more straightforward way. A section can
have an annotation saying "if Nth section is linked, link this
section too."

Implementing such feature is easy. We can add a reference from a
target atom to an original atom, so that if the target is linked,
the original atom is also linked. If not linked, both will be
dead-stripped. So they are treated as a group.

I added a new reference type, kindAssociate. It does nothing except
preventing referenced atoms from being dead-stripped.

No change to the Resolver is needed.

Reviewers: Bigcheese, shankarke, atanasyan

Subscribers: llvm-commits

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

llvm-svn: 210240

10 years agoFix coverage for files with global constructors again. Adds a testcase to the commit...
Nick Lewycky [Thu, 5 Jun 2014 04:31:43 +0000 (04:31 +0000)]
Fix coverage for files with global constructors again. Adds a testcase to the commit from r206671, as requested by David Blaikie.

llvm-svn: 210239

10 years agoChanging this line of code back to the way it was before Alp's config.h clean up...
Puyan Lotfi [Thu, 5 Jun 2014 04:29:21 +0000 (04:29 +0000)]
Changing this line of code back to the way it was before Alp's config.h clean up changes.
I've already spoken to Alp and he signed off on making this one change, so that our buildbots
go green in the short term.

llvm-svn: 210238

10 years agoRevert r210221 again, due to a crash Richard Smith has provided involving self-hostin...
David Blaikie [Thu, 5 Jun 2014 02:04:59 +0000 (02:04 +0000)]
Revert r210221 again, due to a crash Richard Smith has provided involving self-hosting LLVM with libc++.

Test case coming, once I reduce it.

llvm-svn: 210236

10 years agoRemove's uses of sys/timeb.h for Android.
Dan Albert [Thu, 5 Jun 2014 02:00:24 +0000 (02:00 +0000)]
Remove's uses of sys/timeb.h for Android.

Android is removing sys/timeb.h because it was removed in POSIX 2008.

llvm-svn: 210235

10 years agoDebugInfo: Reuse existing LexicalScope to retrieve the scope's MDNode, rather than...
David Blaikie [Thu, 5 Jun 2014 01:30:50 +0000 (01:30 +0000)]
DebugInfo: Reuse existing LexicalScope to retrieve the scope's MDNode, rather than looking it up through the DebugLoc.

No functional change intended, just streamlines the abstract variable
lookup/construction to use a common entry point.

llvm-svn: 210234

10 years agoDebugInfo: Roll argument insertion into variable insertion to ensure arguments are...
David Blaikie [Thu, 5 Jun 2014 01:04:20 +0000 (01:04 +0000)]
DebugInfo: Roll argument insertion into variable insertion to ensure arguments are correctly handled in all cases.

No functional change intended.

llvm-svn: 210233

10 years ago[Deadlock detector] Fix CMake build rules for shared runtime
Alexey Samsonov [Thu, 5 Jun 2014 00:58:28 +0000 (00:58 +0000)]
[Deadlock detector] Fix CMake build rules for shared runtime

llvm-svn: 210232

10 years agoPR19388: DebugInfo: Emit dead arguments in their originally declared order.
David Blaikie [Thu, 5 Jun 2014 00:51:35 +0000 (00:51 +0000)]
PR19388: DebugInfo: Emit dead arguments in their originally declared order.

Unused arguments were not being added to the argument list, but instead
treated as arbitrary scope variables. This meant they weren't carefully
added in the original argument order.

In this particular example, though, it turns out the argument is only
/mostly/ unused (well, actually it's entirely used, but in a specific
way). It's a struct that, due to ABI reasons, is decomposed into chunks
(exactly one chunk, since it has one member) and then passed. Since only
one of those chunks is used (SROA, etc, kill the original reconstitution
code) we don't have a location to describe the whole variable.

In this particular case, since the struct consists of just the one int,
once we have partial location information, this should have a location
that describes the entire variable (since the piece is the entirety of
the object).

And at some point we'll need to describe the location of even /entirely/
unused arguments so that they can at least be printed on function entry.

llvm-svn: 210231

10 years agoBugfix: don't assert if someone manages to declare an operator new/delete template...
Richard Smith [Thu, 5 Jun 2014 00:43:02 +0000 (00:43 +0000)]
Bugfix: don't assert if someone manages to declare an operator new/delete template before the builtin operator new/delete.

llvm-svn: 210230

10 years agoUse AArch64 instead of now removed ARM64 in test configs
Alexey Samsonov [Thu, 5 Jun 2014 00:25:30 +0000 (00:25 +0000)]
Use AArch64 instead of now removed ARM64 in test configs

llvm-svn: 210229

10 years agoDebugInfo: Add comments/assert description to r209674 based on Eric Christopher's...
David Blaikie [Thu, 5 Jun 2014 00:25:26 +0000 (00:25 +0000)]
DebugInfo: Add comments/assert description to r209674 based on Eric Christopher's post-commit review feedback.

llvm-svn: 210228

10 years agoWe've got a getSlotSize call already that we use everywhere else,
Eric Christopher [Thu, 5 Jun 2014 00:22:13 +0000 (00:22 +0000)]
We've got a getSlotSize call already that we use everywhere else,
use it here too.

llvm-svn: 210227

10 years agoR600/SI: Match rsq instructions
Matt Arsenault [Thu, 5 Jun 2014 00:15:55 +0000 (00:15 +0000)]
R600/SI: Match rsq instructions

llvm-svn: 210226

10 years agoFlush C stdio streams upon process termination
Reid Kleckner [Thu, 5 Jun 2014 00:13:43 +0000 (00:13 +0000)]
Flush C stdio streams upon process termination

Due to what can only be described as a CRT bug, stdout and amazingly
even stderr are not always flushed upon process termination, especially
when the system is under high threading pressure.  I have found two
repros for this:

1) In lib\Support\Threading.cpp, change sys::Mutex to an
std::recursive_mutex and run check-clang.  Usually between 30 and 40
tests will fail.

2) Add OutputDebugStrings in code that runs during static initialization
and static shutdown.  This will sometimes generate similar failures.

After a substantial amount of troubleshooting and debugging, I found
that I could reproduce this from the command line without running
check-clang.  Simply make the mutex change described in #1, then
manually run the following command many times by running it once, then
pressing Up -> Enter very quickly:

D:\src\llvm\build\vs2013\Debug\bin\c-index-test.EXE -cursor-at=D:\src\llvm\tools\clang\test\Index\targeted-preamble.h:2:15 D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -include D:\src\llvm\build\vs2013\tools\clang\test\Index\Output\targeted-cursor.c.tmp.h -Xclang -error-on-deserialized-decl=NestedVar1      -Xclang -error-on-deserialized-decl=TopVar    | D:\src\llvm\build\vs2013\Debug\bin\FileCheck.EXE D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -check-prefix=PREAMBLE-CURSOR1

Sporadically they will fail, and attaching a debugger to a failed
instance indicates that stdin of FileCheck.exe is empty.

Note that due to the repro in #2, we can rule out a bug in the STL's
mutex implementation, and instead conclude that this is a real flake in
the windows test harness.

Test Plan:
Without patch: Ran check-clang 10 times and saw over 30 Unexpected failures on every run.
With patch: Ran check-clang 10 times and saw 0 unexpected failures across all runs.

Reviewers: rnk

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

Patch by Zachary Turner!

llvm-svn: 210225

10 years ago80-columns.
Eric Christopher [Thu, 5 Jun 2014 00:09:08 +0000 (00:09 +0000)]
80-columns.

llvm-svn: 210224

10 years agoRemove uses of the TargetMachine from X86FrameLowering.
Eric Christopher [Thu, 5 Jun 2014 00:09:05 +0000 (00:09 +0000)]
Remove uses of the TargetMachine from X86FrameLowering.

llvm-svn: 210223

10 years agoUse nullptr
Matt Arsenault [Thu, 5 Jun 2014 00:01:12 +0000 (00:01 +0000)]
Use nullptr

llvm-svn: 210222

10 years agoDebugInfo: Reapply r209984 (reverted in r210143), asserting that abstract DbgVariable...
David Blaikie [Wed, 4 Jun 2014 23:50:52 +0000 (23:50 +0000)]
DebugInfo: Reapply r209984 (reverted in r210143), asserting that abstract DbgVariables have DIEs.

Abstract variables within abstract scopes that are entirely optimized
away in their first inlining are omitted because their scope is not
present so the variable is never created. Instead, we should ensure the
scope is created so the variable can be added, even if it's been
optimized away in its first inlining.

This fixes the incorrect debug info in missing-abstract-variable.ll
(added in r210143) and passes an asserts self-hosting build, so
hopefully there's not more of these issues left behind... *fingers
crossed*.

llvm-svn: 210221

10 years ago[ubsan] Don't add a --dynamic-list for ubsan symbols when building a shared
Richard Smith [Wed, 4 Jun 2014 23:28:46 +0000 (23:28 +0000)]
[ubsan] Don't add a --dynamic-list for ubsan symbols when building a shared
library. That results in the linker resolving all references to weak symbols in
the DSO to the definition from within that DSO. Ironically, this rarely causes
observable problems, except that it causes ubsan's own dynamic type check to
spuriously fail (because we fail to properly merge type_info object names).

llvm-svn: 210220

10 years agoFormatting cleanup.
Richard Smith [Wed, 4 Jun 2014 23:26:06 +0000 (23:26 +0000)]
Formatting cleanup.

llvm-svn: 210219

10 years agoExplain why we skip DbgInfoIntrinsics when looking at line numbers in .gcno file...
Nick Lewycky [Wed, 4 Jun 2014 21:47:19 +0000 (21:47 +0000)]
Explain why we skip DbgInfoIntrinsics when looking at line numbers in .gcno file emission.

llvm-svn: 210218

10 years agoDon't dynamically initialize dllimport vars (PR19933)
Hans Wennborg [Wed, 4 Jun 2014 21:09:46 +0000 (21:09 +0000)]
Don't dynamically initialize dllimport vars (PR19933)

They should be initialized when they're exported.

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

llvm-svn: 210217

10 years ago[asan] Add install rule for Android runtime
Greg Fitzgerald [Wed, 4 Jun 2014 21:05:01 +0000 (21:05 +0000)]
[asan] Add install rule for Android runtime

llvm-svn: 210216

10 years agoDon't emit structors for available_externally globals (PR19933)
Hans Wennborg [Wed, 4 Jun 2014 21:04:54 +0000 (21:04 +0000)]
Don't emit structors for available_externally globals (PR19933)

We would previously assert here when trying to figure out the section
for the global.

This makes us handle the situation more gracefully since the IR isn't
malformed.

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

llvm-svn: 210215

10 years agoRemove the overload of GetAddrOfConstantString method
Alexey Samsonov [Wed, 4 Jun 2014 20:25:57 +0000 (20:25 +0000)]
Remove the overload of GetAddrOfConstantString method

llvm-svn: 210214

10 years agoMove MemoryRegionInfo out of Target/Process.h into its own header.
Todd Fiala [Wed, 4 Jun 2014 20:13:37 +0000 (20:13 +0000)]
Move MemoryRegionInfo out of Target/Process.h into its own header.

lldb-gdbserver and NativeProcessProtocol will use MemoryRegionInfo
but don't want to pull in Process.h.  Pull this declaration and
definition out into its own header.

llvm-svn: 210213

10 years agoRefactor and generalize GetAddrOfConstantString and GetAddrOfConstantStringFromLiteral.
Alexey Samsonov [Wed, 4 Jun 2014 19:56:57 +0000 (19:56 +0000)]
Refactor and generalize GetAddrOfConstantString and GetAddrOfConstantStringFromLiteral.

Share mode code between these functions and re-structure them in a way
which shows how similar they actually are. The latter function works well
with literals of multi-byte chars and does a GlobalVariable name mangling
(if global strings are non-writable).

No functionality change.

llvm-svn: 210212

10 years agoUse __builtin_operator_new/__builtin_operator_delete when available. This
Richard Smith [Wed, 4 Jun 2014 19:54:15 +0000 (19:54 +0000)]
Use __builtin_operator_new/__builtin_operator_delete when available. This
allows allocations and deallocations to be optimized out.

llvm-svn: 210211

10 years agoHandle partial nanosleeps in this_thread::sleep_for
David Majnemer [Wed, 4 Jun 2014 19:43:20 +0000 (19:43 +0000)]
Handle partial nanosleeps in this_thread::sleep_for

Signals may result in nanosleep returning with only some of the
requested sleeping performed.

Utilize nanosleep's "time-remaining" out parameter to continue sleeping
when this occurs.

llvm-svn: 210210

10 years agoAdjust another test case to not access out of bounds
Tobias Grosser [Wed, 4 Jun 2014 19:41:47 +0000 (19:41 +0000)]
Adjust another test case to not access out of bounds

llvm-svn: 210208

10 years agoThis cast is not necessary any more (llvm api change).
Rafael Espindola [Wed, 4 Jun 2014 19:03:20 +0000 (19:03 +0000)]
This cast is not necessary any more (llvm api change).

llvm-svn: 210206

10 years agoAdd a Constant version of stripPointerCasts.
Rafael Espindola [Wed, 4 Jun 2014 19:01:48 +0000 (19:01 +0000)]
Add a Constant version of stripPointerCasts.

Thanks to rnk for the suggestion.

llvm-svn: 210205

10 years agoUpdate for llvm api change.
Rafael Espindola [Wed, 4 Jun 2014 18:51:46 +0000 (18:51 +0000)]
Update for llvm api change.

llvm-svn: 210204

10 years agoClauses in a landingpad are always Constant. Use a stricter type.
Rafael Espindola [Wed, 4 Jun 2014 18:51:31 +0000 (18:51 +0000)]
Clauses in a landingpad are always Constant. Use a stricter type.

llvm-svn: 210203

10 years ago[dfsan] Fix the declaration of dfsan_add_label.
Peter Collingbourne [Wed, 4 Jun 2014 17:54:51 +0000 (17:54 +0000)]
[dfsan] Fix the declaration of dfsan_add_label.

llvm-svn: 210202

10 years agoTwo small enhancements for the JIT.
Yaron Keren [Wed, 4 Jun 2014 17:35:28 +0000 (17:35 +0000)]
Two small enhancements for the JIT.

When JITting a large project such as Boost it's quite hard to figure out the problematic inline asm without debug location. This patch provides debug location printout before the JIT aborts due to inline asm. printDebugLoc() was exposed from MachineInstr.cpp and reused here.

If the JIT run with debug info, don't bomb on DBG_VALUE but ignore them.

http://reviews.llvm.org/D3416

llvm-svn: 210201

10 years agoXFAIL: test/DebugInfo/missing-abstract-variable.ll on mips and ppc64 due to an inline...
David Blaikie [Wed, 4 Jun 2014 17:05:23 +0000 (17:05 +0000)]
XFAIL: test/DebugInfo/missing-abstract-variable.ll on mips and ppc64 due to an inlined parameter that goes missing.

llvm-svn: 210200

10 years ago[sanitizer] Make LSan/MSan/TSan honor the "color" flag.
Sergey Matveev [Wed, 4 Jun 2014 16:57:03 +0000 (16:57 +0000)]
[sanitizer] Make LSan/MSan/TSan honor the "color" flag.

Based on a patch by Stephan Bergmann.

llvm-svn: 210199

10 years agoMS-ABI: Mangle empty template parameter packs correctly
David Majnemer [Wed, 4 Jun 2014 16:46:32 +0000 (16:46 +0000)]
MS-ABI: Mangle empty template parameter packs correctly

Tested for compatibility with VS2013.

llvm-svn: 210198

10 years agoMS-ABI: Implement user defined literals
David Majnemer [Wed, 4 Jun 2014 16:46:26 +0000 (16:46 +0000)]
MS-ABI: Implement user defined literals

Straightforward implementation of UDLs, it's compatible with VS "14".

This nearly completes our implementation of C++ name mangling for the
MS-ABI.

llvm-svn: 210197

10 years agoAdded gdb-remote $qMemoryRegionInfo tests for heap and stack.
Todd Fiala [Wed, 4 Jun 2014 16:42:12 +0000 (16:42 +0000)]
Added gdb-remote $qMemoryRegionInfo tests for heap and stack.

Added two new tests: one to verify that a test exe heap address
returned is readable and writeable, and a similar one to verify
a test exe stack address is readable and writeable.

Ran the main.cpp test exe code through the Xcode re-indenter.
I was using TextMate to edit the test's C++ code alongside the
Python code but last check-in found that it was not handling
tabs/indentation the way I am intending it.

Modified test exe to require C++11.

Refactored gdb remote python code's handling of memory region
info into more re-usable methods.

llvm-svn: 210196

10 years agoMake meta.trans.other/aligned_storage.pass.cpp pass on arm.
Nico Weber [Wed, 4 Jun 2014 16:25:58 +0000 (16:25 +0000)]
Make meta.trans.other/aligned_storage.pass.cpp pass on arm.

The maximum alignment on arm is 8, not 16 like on x86. Use alignof(max_align_t)
to make the test work in both cases.

llvm-svn: 210195