platform/upstream/llvm.git
9 years ago[Sparc] Rearrange SparcInstrInfo, no change.
James Y Knight [Wed, 1 Jul 2015 14:38:07 +0000 (14:38 +0000)]
[Sparc] Rearrange SparcInstrInfo, no change.

Move some instructions into order of sections in the spec, as the rest
already were.

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

llvm-svn: 241163

9 years agoTest committed in r241153 is more target-specific than I thought.
Michael Kuperstein [Wed, 1 Jul 2015 13:45:25 +0000 (13:45 +0000)]
Test committed in r241153 is more target-specific than I thought.
Moving the (original, x86-only) test to the X86 directory.

llvm-svn: 241162

9 years agoExpand Phabricator docs slightly
Scott Douglass [Wed, 1 Jul 2015 13:41:18 +0000 (13:41 +0000)]
Expand Phabricator docs slightly

llvm-svn: 241161

9 years ago[clang-tidy] minor coding style tweak. make functions static.
Daniel Marjamaki [Wed, 1 Jul 2015 13:29:27 +0000 (13:29 +0000)]
[clang-tidy] minor coding style tweak. make functions static.

llvm-svn: 241160

9 years agoAVX-512: Implemented missing encoding for FMA scalar instructions
Igor Breger [Wed, 1 Jul 2015 13:24:28 +0000 (13:24 +0000)]
AVX-512: Implemented missing encoding for FMA scalar instructions
Added tests for encoding

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

llvm-svn: 241159

9 years agoFix non-target-specific test not to use the x86 triple.
Michael Kuperstein [Wed, 1 Jul 2015 13:05:57 +0000 (13:05 +0000)]
Fix non-target-specific test not to use the x86 triple.

llvm-svn: 241158

9 years agoUpdate for llvm api change.
Rafael Espindola [Wed, 1 Jul 2015 12:56:33 +0000 (12:56 +0000)]
Update for llvm api change.

llvm-svn: 241157

9 years agoReturn ErrorOr from getSection.
Rafael Espindola [Wed, 1 Jul 2015 12:56:27 +0000 (12:56 +0000)]
Return ErrorOr from getSection.

This also improves the logic of what is an error:

* getSection(uint_32): only return an error if the index is out of bounds. The
  index 0 corresponds to a perfectly valid entry.
* getSection(Elf_Sym): Returns null for symbols that normally don't have
  sections and error for out of bound indexes.

In many places this just moves the report_fatal_error up the stack, but those
can then be fixed in smaller patches.

llvm-svn: 241156

9 years ago[clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr...
Alexander Kornienko [Wed, 1 Jul 2015 12:39:40 +0000 (12:39 +0000)]
[clang-tidy] Enhance clang-tidy readability-simplify-boolean-expr...

Enhance clang-tidy readability-simplify-boolean-expr to handle 'if (e) return
true; return false;' and improve replacement expressions.

This changeset extends the simplify boolean expression check in clang-tidy to
simplify if (e) return true; return false; to return e; (note the lack of an
else clause on the if statement.) By default, chained conditional assignment is
left unchanged, unless a configuration parameter is set to non-zero to override
this behavior.

It also improves the handling of replacement expressions to apply
static_cast<bool>(expr) when expr is not of type bool.

http://reviews.llvm.org/D9810

Patch by Richard Thomson!

llvm-svn: 241155

9 years ago[DebugInfo] Fix debug info generation for function static variables, typedefs, and...
Michael Kuperstein [Wed, 1 Jul 2015 12:34:39 +0000 (12:34 +0000)]
[DebugInfo] Fix debug info generation for function static variables, typedefs, and records

Function static variables, typedefs and records (class, struct or union) declared inside
a lexical scope were associated with the function as their parent scope, rather than the
lexical scope they are defined or declared in.

This fixes PR19238

Patch by: amjad.aboud@intel.com
Differential Revision: http://reviews.llvm.org/D9760

llvm-svn: 241154

9 years ago[DWARF] Fix debug info generation for function static variables, typedefs, and records
Michael Kuperstein [Wed, 1 Jul 2015 12:33:11 +0000 (12:33 +0000)]
[DWARF] Fix debug info generation for function static variables, typedefs, and records

Function static variables, typedefs and records (class, struct or union) declared inside
a lexical scope were associated with the function as their parent scope, rather than the
lexical scope they are defined or declared in.

This fixes PR19238

Patch by: amjad.aboud@intel.com
Differential Revision: http://reviews.llvm.org/D9758

llvm-svn: 241153

9 years ago[X86] Avoid over-relaxation of 8-bit immediates in integer arithmetic instructions.
Michael Kuperstein [Wed, 1 Jul 2015 10:54:42 +0000 (10:54 +0000)]
[X86] Avoid over-relaxation of 8-bit immediates in integer arithmetic instructions.

Only consider an instruction a candidate for relaxation if the last operand of the
instruction is an expression. We previously checked whether any operand is an expression,
which is useless, since for all instructions concerned, the only operand that may be
affected by relaxation is the last one.
In addition, this removes the check for having RIP as an argument, since it was
plain wrong - even when one of the arguments is RIP, relaxation may still be needed.

This fixes PR9807.

Patch by: david.l.kreitzer@intel.com
Differential Revision: http://reviews.llvm.org/D10766

llvm-svn: 241152

9 years agoRevert part of r241149, "Fix PR23872: Integrated assembler error message when using...
NAKAMURA Takumi [Wed, 1 Jul 2015 10:28:09 +0000 (10:28 +0000)]
Revert part of r241149, "Fix PR23872: Integrated assembler error message when using .type directive with @ in AArch32 assembly."

The test should be split among targets. llvm/test/MC/ELF/ is assumed as X86.

llvm-svn: 241151

9 years ago[mips][microMIPS] Implement SLL and NOP instructions
Zoran Jovanovic [Wed, 1 Jul 2015 09:54:51 +0000 (09:54 +0000)]
[mips][microMIPS] Implement SLL and NOP instructions
http://reviews.llvm.org/D10474

llvm-svn: 241150

9 years agoFix PR23872: Integrated assembler error message when using .type directive with ...
Gabor Ballabas [Wed, 1 Jul 2015 08:58:49 +0000 (08:58 +0000)]
Fix PR23872: Integrated assembler error message when using .type directive with @ in AArch32 assembly.

The AArch32 assembler parses the '@' as a comment symbol, so the error message shouldn't suggest
that '@<type>' is a valid replacement when assembling for AArch32 target.

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

llvm-svn: 241149

9 years ago[modules] Don't require the 'inline' specifier when merging an inline function;
Richard Smith [Wed, 1 Jul 2015 07:24:18 +0000 (07:24 +0000)]
[modules] Don't require the 'inline' specifier when merging an inline function;
any source of the inline nature is sufficient.

llvm-svn: 241146

9 years ago[OPENMP 4.0] Initial support for 'omp cancellation point' construct.
Alexey Bataev [Wed, 1 Jul 2015 06:57:41 +0000 (06:57 +0000)]
[OPENMP 4.0] Initial support for 'omp cancellation point' construct.

Add parsing and sema analysis for 'omp cancellation point' directive.

llvm-svn: 241145

9 years agoFix a couple of unused variables in no-asserts
Justin Bogner [Wed, 1 Jul 2015 05:41:50 +0000 (05:41 +0000)]
Fix a couple of unused variables in no-asserts

llvm-svn: 241144

9 years ago[LoopUnroll] Use undef for phis with no value live
David Majnemer [Wed, 1 Jul 2015 05:38:07 +0000 (05:38 +0000)]
[LoopUnroll] Use undef for phis with no value live

We would create a phi node with a zero initialized operand instead of
undef in the case where no value was originally available.  This was
problematic for x86_mmx which has no null value.

llvm-svn: 241143

9 years ago[SCCP] Turn loads of null into undef instead of zero initialized values
David Majnemer [Wed, 1 Jul 2015 05:37:57 +0000 (05:37 +0000)]
[SCCP] Turn loads of null into undef instead of zero initialized values

Surprisingly, this is a correctness issue: the mmx type exists for
calling convention purposes, LLVM doesn't have a zero representation for
them.

This partially fixes PR23999.

llvm-svn: 241142

9 years ago-frewrite-includes: Prefer insert to emplace
Justin Bogner [Wed, 1 Jul 2015 04:53:19 +0000 (04:53 +0000)]
-frewrite-includes: Prefer insert to emplace

Some bots didn't like r241140.

llvm-svn: 241141

9 years ago-frewrite-includes: Rework how includes and modules are differentiated
Justin Bogner [Wed, 1 Jul 2015 04:40:10 +0000 (04:40 +0000)]
-frewrite-includes: Rework how includes and modules are differentiated

The map of FileChange structs here was storing two disjoint types of
information:

1. A pointer to the Module that an #include directive implicitly
   imported

2. A FileID and FileType for an included file. These would be left
   uninitialized in the Module case.

This change splits these two kinds of information into their own maps,
which both simplifies how we access either and avoids the undefined
behaviour we were hitting due to the uninitialized fields in the
included file case.

Mostly NFC, but fixes some errors found by self-host with ubsan.

llvm-svn: 241140

9 years ago[NaryReassociate] enhances nsw by leveraging @llvm.assume
Jingyue Wu [Wed, 1 Jul 2015 03:38:49 +0000 (03:38 +0000)]
[NaryReassociate] enhances nsw by leveraging @llvm.assume

Summary:
nsw are flaky and can often be removed by optimizations. This patch enhances
nsw by leveraging @llvm.assume in the IR. Specifically, NaryReassociate now
understands that

    assume(a + b >= 0) && assume(a >= 0) ==> a +nsw b

As a result, it can split more sext(a + b) into sext(a) + sext(b) for CSE.

Test Plan: nary-gep.ll

Reviewers: broune, meheff

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 241139

9 years agoGetting started docs: https, and check signature
JF Bastien [Wed, 1 Jul 2015 03:32:08 +0000 (03:32 +0000)]
Getting started docs: https, and check signature

Summary: Download should be over https, not insecure ftp at least for the signature and key files. The signature should also get verified.

Test Plan: None

Reviewers: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 241138

9 years ago[modules] Before checking whether the controlling macro of a header is defined,
Richard Smith [Wed, 1 Jul 2015 02:29:35 +0000 (02:29 +0000)]
[modules] Before checking whether the controlling macro of a header is defined,
update the identifier in case we've imported a definition of the macro (and
thus the contents of the header) from a module.

Also fold ExternalIdentifierLookup into ExternalPreprocessorSource; it no longer
makes sense to keep these separate now that the only user of the former also
needs the latter.

llvm-svn: 241137

9 years agoCodeGen: Do not give local-linkage functions externally available linkage, even tempo...
Peter Collingbourne [Wed, 1 Jul 2015 02:10:26 +0000 (02:10 +0000)]
CodeGen: Do not give local-linkage functions externally available linkage, even temporarily.

When an internal-linkage thunk is code gen'd, CodeGenVTables::emitThunk
will first be called with ForVTable=true (which incorrectly set the
thunk's linkage to available_externally under the Itanium ABI) and later
with ForVTable=false (which reset it to internal). Because we will always
see a call with ForVTable=false, this incorrect linkage never ended up in
the final IR. However, the temporary presence of this linkage caused us
to give such functions a comdat as a result of code introduced in r241102.
To avoid this, check that the thunk is externally visible before giving it
available_externally linkage.

llvm-svn: 241136

9 years ago[modules] Make the include guard optimization fire a bit more when considering
Richard Smith [Wed, 1 Jul 2015 01:51:38 +0000 (01:51 +0000)]
[modules] Make the include guard optimization fire a bit more when considering
re-entering a modular header.

When we do the include guard check, we're in the visibility state for the file
with the #include; the include guard may not be visible there, but we don't
actually need it to be: if we've already parsed the submodule we're considering
entering, it's always safe to skip it.

llvm-svn: 241135

9 years agoUse a stable sort to guarantee target feature ordering in the IR
Eric Christopher [Wed, 1 Jul 2015 01:07:12 +0000 (01:07 +0000)]
Use a stable sort to guarantee target feature ordering in the IR
in order to make testing somewhat more feasible. Has the advantage
of making it easier to find target features as well.

llvm-svn: 241134

9 years agoCodeGen: Resize LifetimeExtendedCleanupHeader to avoid alignment issues
Justin Bogner [Wed, 1 Jul 2015 00:59:27 +0000 (00:59 +0000)]
CodeGen: Resize LifetimeExtendedCleanupHeader to avoid alignment issues

The LifetimeExtendedCleanupHeader is carefully fit into 32 bytes,
meaning that cleanups on the LifetimeExtendedCleanupStack are *always*
allocated at a misaligned address and cause undefined behaviour.

There are two ways to solve this - add padding after the header when
we allocated our cleanups, or just simplify the header and let it use
64 bits in the first place. I've opted for the latter, and added a
static assert to avoid the issue in the future.

llvm-svn: 241133

9 years agoRename ClangUserExpression members to avoid confusion with language.
Dawn Perchik [Wed, 1 Jul 2015 00:54:02 +0000 (00:54 +0000)]
Rename ClangUserExpression members to avoid confusion with language.

The new names clarify that the members have to do with the execution
context and not the language.  For example, m_cplusplus was renamed to
m_in_cplusplus_method.

llvm-svn: 241132

9 years ago[Sema] Don't crash when deduction fails for decltype(auto)
David Majnemer [Wed, 1 Jul 2015 00:29:28 +0000 (00:29 +0000)]
[Sema] Don't crash when deduction fails for decltype(auto)

We didn't check the return result of BuildDecltypeType, resulting in us
crashing when we tried to grab the canonical version of the type.

This fixes PR23995.

llvm-svn: 241131

9 years agoFix sse4 for target attribute feature additions.
Eric Christopher [Wed, 1 Jul 2015 00:08:32 +0000 (00:08 +0000)]
Fix sse4 for target attribute feature additions.
This reinstates part of the hack removed in r233223, by special
casing sse4 as part of the feature additions. The notable change
here is that we consider it only as part of setting the SSE level
and not as part of the actual target features set which handles
setting the rest of the masks.

llvm-svn: 241130

9 years agoFix a TODO dealing with canonicalizing attributes on functions by
Eric Christopher [Wed, 1 Jul 2015 00:08:29 +0000 (00:08 +0000)]
Fix a TODO dealing with canonicalizing attributes on functions by
using a string map to canonicalize. Fix up a couple of testcases
that needed changing since we are no longer simply appending features
to the list, but all of their mask dependencies as well.

llvm-svn: 241129

9 years agoCOFF: Simplify SymbolTable::findLazy. NFC.
Rui Ueyama [Tue, 30 Jun 2015 23:46:52 +0000 (23:46 +0000)]
COFF: Simplify SymbolTable::findLazy. NFC.

llvm-svn: 241128

9 years ago[SanitizerCoverage] Don't add instrumentation to unreachable blocks.
Alexey Samsonov [Tue, 30 Jun 2015 23:11:45 +0000 (23:11 +0000)]
[SanitizerCoverage] Don't add instrumentation to unreachable blocks.

llvm-svn: 241127

9 years agoFix several typos in LangRef.rst related to loop unrolling metadata.
Mark Heffernan [Tue, 30 Jun 2015 22:48:51 +0000 (22:48 +0000)]
Fix several typos in LangRef.rst related to loop unrolling metadata.

llvm-svn: 241126

9 years ago[SEH] Add new intrinsics for recovering and restoring parent frames
Reid Kleckner [Tue, 30 Jun 2015 22:46:59 +0000 (22:46 +0000)]
[SEH] Add new intrinsics for recovering and restoring parent frames

The incoming EBP value established by the runtime is actually a pointer
to the end of the EH registration object, and not the true parent
function frame pointer. Clang doesn't need llvm.x86.seh.exceptioninfo
anymore because we know that the exception info pointer is at a fixed
offset from this incoming EBP.

The llvm.x86.seh.recoverfp intrinsic takes an EBP value provided by the
EH runtime and returns a pointer that is usable with llvm.framerecover.

The llvm.x86.seh.restoreframe intrinsic is inserted by the 32-bit
specific preparation pass in blocks targetted by the EH runtime. It
re-establishes any physical registers used by the parent function to
address the stack, such as the frame, base, and stack pointers.

Neither of these intrinsics correctly handle stack realignment prologues
yet, but it's possible to add that later.

Reviewers: majnemer

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

llvm-svn: 241125

9 years ago[IRBuilder] Delete unused constructor and SetInsertPoint overload.
Alexey Samsonov [Tue, 30 Jun 2015 22:38:22 +0000 (22:38 +0000)]
[IRBuilder] Delete unused constructor and SetInsertPoint overload.

llvm-svn: 241124

9 years agoFix memory leak in unittest added in r241101.
Alexey Samsonov [Tue, 30 Jun 2015 22:17:29 +0000 (22:17 +0000)]
Fix memory leak in unittest added in r241101.

llvm-svn: 241123

9 years ago[Cloning] Teach CloneModule about personality functions
David Majnemer [Tue, 30 Jun 2015 22:14:01 +0000 (22:14 +0000)]
[Cloning] Teach CloneModule about personality functions

CloneModule didn't take into account that it needed to remap the value
using values in the module.

This fixes PR23992.

llvm-svn: 241122

9 years agoFix use-after-free.
Peter Collingbourne [Tue, 30 Jun 2015 22:08:44 +0000 (22:08 +0000)]
Fix use-after-free.

llvm-svn: 241121

9 years ago[modules] Make sure macros get made visible in the top-level file if we've got
Richard Smith [Tue, 30 Jun 2015 21:29:55 +0000 (21:29 +0000)]
[modules] Make sure macros get made visible in the top-level file if we've got
local submodule visibility enabled; that top-level file might not actually be
the module includes buffer if use of prebuilt modules is disabled.

llvm-svn: 241120

9 years ago[asan] Suppress read_binary_name_regtest.c test failure on unsupported hosts.
Evgeniy Stepanov [Tue, 30 Jun 2015 21:28:55 +0000 (21:28 +0000)]
[asan] Suppress read_binary_name_regtest.c test failure on unsupported hosts.

read_binary_name_regtest.c requires seccomp kernel headers.
Make the test pass if <linux/seccomp.h> is missing.

llvm-svn: 241119

9 years ago[NVPTX] cleanups and refacotring in NVPTXFrameLowering.cpp
Jingyue Wu [Tue, 30 Jun 2015 21:28:31 +0000 (21:28 +0000)]
[NVPTX] cleanups and refacotring in NVPTXFrameLowering.cpp

Summary: NFC

Test Plan: no regression

Reviewers: wengxt

Reviewed By: wengxt

Subscribers: jholewinski, llvm-commits

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

llvm-svn: 241118

9 years ago[MS ABI] Stick constructor closures in an IR COMDAT group
David Majnemer [Tue, 30 Jun 2015 21:23:51 +0000 (21:23 +0000)]
[MS ABI] Stick constructor closures in an IR COMDAT group

We no-longer stick linkonce_odr entities in COMDATs in the backend.
Instead, we rely on the IR COMDAT mechanism.

llvm-svn: 241117

9 years ago[FaultMaps] Let the frontend pre-select implicit null check candidates.
Sanjoy Das [Tue, 30 Jun 2015 21:22:32 +0000 (21:22 +0000)]
[FaultMaps] Let the frontend pre-select implicit null check candidates.

Summary:
This change introduces a !make.implicit metadata that allows the
frontend to pre-select the set of explicit null checks that will be
considered for transformation into implicit null checks.

The reason for not using profiling data instead of !make.implicit is
explained in the change to `FaultMaps.rst`.

Reviewers: atrick, reames, pgavlin, JosephTremoulet

Subscribers: llvm-commits

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

llvm-svn: 241116

9 years agoPack MCSymbol::HasName in to a spare bit in the section/fragment union.
Pete Cooper [Tue, 30 Jun 2015 20:54:21 +0000 (20:54 +0000)]
Pack MCSymbol::HasName in to a spare bit in the section/fragment union.

This is part of an effort to pack the average MCSymbol down to 24 bytes.

The HasName bit was pushing the size of the bitfield over to another word,
so this change uses a PointerIntPair to fit in it to unused bits of a
PointerUnion.

Reviewed by Rafael Espíndola

llvm-svn: 241115

9 years agoUse ErrorOr in getRelocationAdress.
Rafael Espindola [Tue, 30 Jun 2015 20:32:26 +0000 (20:32 +0000)]
Use ErrorOr in getRelocationAdress.

We can probably do better in this method, but this is an improvement and
enables further ErrorOr cleanups.

llvm-svn: 241114

9 years agoRevert part of r240623 (Enable memory sanitizer for PPC64) because the
Jay Foad [Tue, 30 Jun 2015 20:30:19 +0000 (20:30 +0000)]
Revert part of r240623 (Enable memory sanitizer for PPC64) because the
buildbots are still failing in check-ubsan.

llvm-svn: 241113

9 years agoImplement containsSymbol with other lower level methods.
Rafael Espindola [Tue, 30 Jun 2015 20:18:49 +0000 (20:18 +0000)]
Implement containsSymbol with other lower level methods.

llvm-svn: 241112

9 years agoMark N4508, LWG#2407, and LWG#2470 as complete. I don't see that 2470 requires any...
Marshall Clow [Tue, 30 Jun 2015 20:06:00 +0000 (20:06 +0000)]
Mark N4508, LWG#2407, and LWG#2470 as complete. I don't see that 2470 requires any changes to the library.

llvm-svn: 241111

9 years agoModified a comment about the reason for the patch (removed commented code).
Nemanja Ivanovic [Tue, 30 Jun 2015 20:01:16 +0000 (20:01 +0000)]
Modified a comment about the reason for the patch (removed commented code).

llvm-svn: 241110

9 years agoRemove Elf_Shdr_Iter. Diagnose files with invalid section header sizes.
Rafael Espindola [Tue, 30 Jun 2015 19:58:10 +0000 (19:58 +0000)]
Remove Elf_Shdr_Iter. Diagnose files with invalid section header sizes.

llvm-svn: 241109

9 years agoFixes a bug with __builtin_vsx_lxvdw4x on Little Endian systems
Nemanja Ivanovic [Tue, 30 Jun 2015 19:45:45 +0000 (19:45 +0000)]
Fixes a bug with __builtin_vsx_lxvdw4x on Little Endian systems

llvm-svn: 241108

9 years agoCOFF: Change the order of adding symbols to the symbol table.
Rui Ueyama [Tue, 30 Jun 2015 19:35:21 +0000 (19:35 +0000)]
COFF: Change the order of adding symbols to the symbol table.

Previously, the order of adding symbols to the symbol table was simple.
We have a list of all input files. We read each file from beginning of
the list and add all symbols in it to the symbol table.

This patch changes that order. Now all archive files are added to the
symbol table first, and then all the other object files are added.
This shouldn't change the behavior in single-threading, and make room
to parallelize in multi-threading.

In the first step, only lazy symbols are added to the symbol table
because archives contain only Lazy symbols. Member object files
found to be necessary are queued. In the second step, defined and
undefined symbols are added from object files. Adding an undefined
symbol to the symbol table may cause more member files to be added
to the queue. We simply continue reading all object files until the
queue is empty.

Finally, new archive or object files may be added to the queues by
object files' directive sections (which contain new command line
options).

The above process is repeated until we get no new files.

Symbols defined both in object files and in archives can make results
undeterministic. If an archive is read before an object, a new member
file gets linked, while in the other way, no new file would be added.
That is the most popular cause of an undeterministic result or linking
failure as I observed. Separating phases of adding lazy symbols and
undefined symbols makes that deterministic. Adding symbols in each
phase should be parallelizable.

llvm-svn: 241107

9 years agoMore range-based-for-loopification. NFC
Douglas Katzman [Tue, 30 Jun 2015 19:32:57 +0000 (19:32 +0000)]
More range-based-for-loopification. NFC

llvm-svn: 241106

9 years agoUse range loops. NFC.
Rafael Espindola [Tue, 30 Jun 2015 19:24:51 +0000 (19:24 +0000)]
Use range loops. NFC.

llvm-svn: 241105

9 years agoUse range loop.
Rafael Espindola [Tue, 30 Jun 2015 19:13:25 +0000 (19:13 +0000)]
Use range loop.

llvm-svn: 241104

9 years agoCOFF: Do not assign linker-weak symbols to selectany comdat sections.
Peter Collingbourne [Tue, 30 Jun 2015 19:10:31 +0000 (19:10 +0000)]
COFF: Do not assign linker-weak symbols to selectany comdat sections.

It is mandatory to specify a comdat in order to receive comdat semantics
for a symbol. We were previously getting this wrong in -function-sections
mode; linker-weak symbols were being emitted in a selectany comdat. This
change causes such symbols to use a noduplicates comdat instead, fixing
the inconsistency.

Also correct an inaccuracy in the docs.

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

llvm-svn: 241103

9 years agoCodeGen: Assign an appropriate comdat to thunks.
Peter Collingbourne [Tue, 30 Jun 2015 19:07:26 +0000 (19:07 +0000)]
CodeGen: Assign an appropriate comdat to thunks.

Previously we were not assigning a comdat to thunks in the Microsoft ABI,
which would have required us to emit these functions outside of a comdat.
(Due to an inconsistency in how we were emitting objects, we were getting this
right most of the time, but only when compiling with function sections.) This
code generator change causes us to create a comdat for each thunk.

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

llvm-svn: 241102

9 years ago[DebugInfo] Let IRBuilder::SetInsertPoint(BB::iterator) update current debug location.
Alexey Samsonov [Tue, 30 Jun 2015 19:07:20 +0000 (19:07 +0000)]
[DebugInfo] Let IRBuilder::SetInsertPoint(BB::iterator) update current debug location.

IRBuilder::SetInsertPoint(BB, BB::iterator) is an older version of
IRBuilder::SetInsertPoint(Instruction). However, the latter updates
the current debug location of emitted instruction, while the former
doesn't, which is confusing.

Unify the behavior of these methods: now they both set current debug
location to the debug location of instruction at insertion point.

The callers of IRBuilder::SetInsertPoint(BB, BB::iterator) doesn't
seem to depend on the old behavior (keeping the original debug info
location). On the contrary, sometimes they (e.g. SCEV) *should* be
updating debug info location, but don't. I'll look at gdb bots after
the commit to check that we don't regress on debug info somewhere.

This change may make line table more fine-grained, thus increasing
debug info size. I haven't observed significant increase, though:
it varies from negligible to 0.3% on several binaries and self-hosted
Clang.

This is yet another change targeted at resolving PR23837.

llvm-svn: 241101

9 years agoUse range loop.
Rafael Espindola [Tue, 30 Jun 2015 19:02:00 +0000 (19:02 +0000)]
Use range loop.

llvm-svn: 241100

9 years ago[NVPTX] Fix issue introduced in D10321
Jingyue Wu [Tue, 30 Jun 2015 18:59:19 +0000 (18:59 +0000)]
[NVPTX] Fix issue introduced in D10321

Summary:
Really check if %SP is not used in other places, instead of checking only exact
one non-dbg use.

Patched by Xuetian Weng.

Test Plan:
@foo4 in test/CodeGen/NVPTX/local-stack-frame.ll, create a case that
SP will appear twice.

Reviewers: jholewinski, jingyue

Reviewed By: jingyue

Subscribers: llvm-commits, sfantao, jholewinski

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

llvm-svn: 241099

9 years agoUpdate testcases: DICompileUnits are now created distinct by DIBuilder.
Adrian Prantl [Tue, 30 Jun 2015 18:32:50 +0000 (18:32 +0000)]
Update testcases: DICompileUnits are now created distinct by DIBuilder.

llvm-svn: 241098

9 years agoFix a fixme and make DICompileUnit a distinct node. Tested via clang.
Adrian Prantl [Tue, 30 Jun 2015 18:32:18 +0000 (18:32 +0000)]
Fix a fixme and make DICompileUnit a distinct node. Tested via clang.

llvm-svn: 241097

9 years agoFix compilation failure introduced in r241093.
Alex Lorenz [Tue, 30 Jun 2015 18:32:02 +0000 (18:32 +0000)]
Fix compilation failure introduced in r241093.

llvm-svn: 241096

9 years agoK-ballo pointed out that I missed one of the specializations of packaged_task when...
Marshall Clow [Tue, 30 Jun 2015 18:28:35 +0000 (18:28 +0000)]
K-ballo pointed out that I missed one of the specializations of packaged_task when I committed r241068. Thanks for the catch.

llvm-svn: 241095

9 years agoAdd a test of an elf file with an invalid section index.
Rafael Espindola [Tue, 30 Jun 2015 18:23:07 +0000 (18:23 +0000)]
Add a test of an elf file with an invalid section index.

We were already checking, but were missing a test.

llvm-svn: 241094

9 years agoMIR Serialization: Serialize MBB successors.
Alex Lorenz [Tue, 30 Jun 2015 18:16:42 +0000 (18:16 +0000)]
MIR Serialization: Serialize MBB successors.

This commit implements serialization of the machine basic block successors. It
uses a YAML flow sequence that contains strings that have the MBB references.
The MBB references in those strings use the same syntax as the MBB machine
operands in the machine instruction strings.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 241093

9 years agoForgot the support include file in r241091
Marshall Clow [Tue, 30 Jun 2015 18:16:12 +0000 (18:16 +0000)]
Forgot the support include file in r241091

llvm-svn: 241092

9 years agoAdd tests for LWG#2299. While doing so, I noticed that the tests we have for the...
Marshall Clow [Tue, 30 Jun 2015 18:15:41 +0000 (18:15 +0000)]
Add tests for LWG#2299. While doing so, I noticed that the tests we have for the transparent comparators don't actually call them. Fix those tests, too. Now one of them is failing, due to a missing const in <map>. Add that (twice). Next step is to do the same for <unordered_map>

llvm-svn: 241091

9 years agoRelax this test so it also works on platforms that use characters other
Adrian Prantl [Tue, 30 Jun 2015 18:05:46 +0000 (18:05 +0000)]
Relax this test so it also works on platforms that use characters other
than forward slashes as path separators.

llvm-svn: 241090

9 years agoUse copy init instead of direct init.
Rafael Espindola [Tue, 30 Jun 2015 18:04:46 +0000 (18:04 +0000)]
Use copy init instead of direct init.

llvm-svn: 241089

9 years agoUse an early exit to improve readability. (NFC)
Adrian Prantl [Tue, 30 Jun 2015 18:01:05 +0000 (18:01 +0000)]
Use an early exit to improve readability. (NFC)

llvm-svn: 241088

9 years agoMIR Printer: extract the code that prints MBB references into a new method. NFC.
Alex Lorenz [Tue, 30 Jun 2015 18:00:16 +0000 (18:00 +0000)]
MIR Printer: extract the code that prints MBB references into a new method. NFC.

This commit enables the MIR printer to reuse the code that prints MBB
references.

llvm-svn: 241087

9 years agoMIR Parser: refactor error reporting for machine instruction parser errors. NFC.
Alex Lorenz [Tue, 30 Jun 2015 17:55:00 +0000 (17:55 +0000)]
MIR Parser: refactor error reporting for machine instruction parser errors. NFC.

This commit extracts the code that reports an error that's produced by the
machine instruction parser into a new method that can be reused in other places.

llvm-svn: 241086

9 years agoMIR Parser: make the machine instruction parsing interface more consistent. NFC.
Alex Lorenz [Tue, 30 Jun 2015 17:47:50 +0000 (17:47 +0000)]
MIR Parser: make the machine instruction parsing interface more consistent. NFC.

This commit refactors the interface for machine instruction parser. It adopts
the pattern of returning a bool and passing in the result in the first argument
that is used by the other parsing methods for the the method 'parse' and the
function 'parseMachineInstr'.

llvm-svn: 241085

9 years agoDebug Info: Emit debug info for @import declarations.
Adrian Prantl [Tue, 30 Jun 2015 17:39:51 +0000 (17:39 +0000)]
Debug Info: Emit debug info for @import declarations.

This allows a module-aware debugger such as LLDB to import the currently
visible modules before dropping into the expression evaluator.

rdar://problem/20965932

llvm-svn: 241084

9 years agoAdd a function to ExternalASTSource that returns a descriptor that
Adrian Prantl [Tue, 30 Jun 2015 17:39:43 +0000 (17:39 +0000)]
Add a function to ExternalASTSource that returns a descriptor that
abstracts the commonalities between modules and PCH files that are
needed to emit debug info for a module or precompiled header.

llvm-svn: 241083

9 years agotsan: fix handling of condition variable destruction
Dmitry Vyukov [Tue, 30 Jun 2015 17:23:29 +0000 (17:23 +0000)]
tsan: fix handling of condition variable destruction

POSIX states that "It shall be safe to destroy an initialized condition
variable upon which no threads are currently blocked", and later clarifies
"A condition variable can be destroyed immediately after all the threads
that are blocked on it are awakened) (in examples section). Tsan reported
such destruction as a data race.
Fixes https://llvm.org/bugs/show_bug.cgi?id=23616
Reviewed in http://reviews.llvm.org/D10693

llvm-svn: 241082

9 years agoForce relocation mode to be default, regardless of what is passed to the backend.
Samuel Antao [Tue, 30 Jun 2015 17:18:00 +0000 (17:18 +0000)]
Force relocation mode to be default, regardless of what is passed to the backend.

llvm-svn: 241081

9 years ago[CMake] Make the CMake files (LLVMConfig.cmake and LLVMExports.cmake)
Dan Liew [Tue, 30 Jun 2015 17:16:39 +0000 (17:16 +0000)]
[CMake] Make the CMake files (LLVMConfig.cmake and LLVMExports.cmake)
generated by the Autoconf/Makefile build system relocatable.

Previously the generated CMake files contained hardcoded paths which
prevented a binary installation from being relocated to a different
place in the file system. This problem was most noticeable in LLVM's
official binary releases which were completely unusable by a downstream
project trying to import the CMake targets.

Package maintainers who choose to modify the install location of the
CMake directory without using the ``PROJ_cmake`` Makefile variable
override will need to patch the generated``LLVMConfig.cmake`` so that
``LLVM_INSTALL_PREFIX`` and ``_LLVM_CMAKE_DIR`` variables are set
correctly.

llvm-svn: 241080

9 years ago[NativeProcessLinux] Refactor PtraceWrapper
Pavel Labath [Tue, 30 Jun 2015 17:04:49 +0000 (17:04 +0000)]
[NativeProcessLinux] Refactor PtraceWrapper

Summary:
This changes PtraceWrapper to return an Error, while the actual result is in an pointer parameter
(instead of the other way around). Also made a couple of PtraceWrapper arguments default to zero.
This arrangement makes a lot of the code much simpler.

Test Plan: Tests pass on linux. It compiles on android arm64/mips64.

Reviewers: chaoren, mohit.bhakkad

Subscribers: tberghammer, aemerson, lldb-commits

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

llvm-svn: 241079

9 years agoMIR Parser: adopt the 'maybeLex...' pattern. NFC.
Alex Lorenz [Tue, 30 Jun 2015 16:51:29 +0000 (16:51 +0000)]
MIR Parser: adopt the 'maybeLex...' pattern. NFC.

This commit refactors the machine instruction lexer so that the lexing
functions use the 'maybeLex...' pattern, where they determine if they
can lex the current token by themselves.

Reviewers: Sean Silva

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

llvm-svn: 241078

9 years ago[clang-cl] Use /arch: to set the base target CPU
Reid Kleckner [Tue, 30 Jun 2015 16:32:04 +0000 (16:32 +0000)]
[clang-cl] Use /arch: to set the base target CPU

The main effect of this change is that /arch:IA32 will use i386 as the
CPU, while clang-cl will continue to default to pentium4 (aka SSE2 plus
the usual other features).

/arch:AVX and /arch:AVX2 will also now enable the other features
available in sandybridge and haswell respectively, which is consistent
with MSDN.

llvm-svn: 241077

9 years agouse range-based for loops; NFCI
Sanjay Patel [Tue, 30 Jun 2015 16:30:22 +0000 (16:30 +0000)]
use range-based for loops; NFCI

llvm-svn: 241076

9 years agoUpdate for llvm change.
Rafael Espindola [Tue, 30 Jun 2015 15:34:00 +0000 (15:34 +0000)]
Update for llvm change.

llvm-svn: 241075

9 years agoFix the name of the iterator functions to match the coding standards.
Rafael Espindola [Tue, 30 Jun 2015 15:33:44 +0000 (15:33 +0000)]
Fix the name of the iterator functions to match the coding standards.

llvm-svn: 241074

9 years ago[Static Analyzer] Minor improvements to SATest.
Gabor Horvath [Tue, 30 Jun 2015 15:31:17 +0000 (15:31 +0000)]
[Static Analyzer] Minor improvements to SATest.

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

llvm-svn: 241073

9 years ago[ASan] Add a regression test for r240960 (https://crbug.com/502974)
Alexander Potapenko [Tue, 30 Jun 2015 15:18:03 +0000 (15:18 +0000)]
[ASan] Add a regression test for r240960 (https://crbug.com/502974)

The test simulates a sandbox that prevents the program from calling readlink().
ASan is supposed to still be able to print the executable name regardless of that.

llvm-svn: 241072

9 years agoFix windows build.
Ewan Crawford [Tue, 30 Jun 2015 15:03:31 +0000 (15:03 +0000)]
Fix windows build.

Windows build was broken in either r240983 or r240978 in the changes to FileSpec.cpp

llvm-svn: 241071

9 years agoReport an error on invalid sh_entsize.
Rafael Espindola [Tue, 30 Jun 2015 14:59:20 +0000 (14:59 +0000)]
Report an error on invalid sh_entsize.

llvm-svn: 241070

9 years ago[X86] Fix a bug in WIN_FTOL_32/64 handling.
Michael Kuperstein [Tue, 30 Jun 2015 14:38:57 +0000 (14:38 +0000)]
[X86] Fix a bug in WIN_FTOL_32/64 handling.

Duplicating an FP register "as itself" is a bad idea, since it violates the
invariant that every FP register is mapped to at most one FPU stack slot.
Use the scratch FP register instead.

This fixes PR23957.

llvm-svn: 241069

9 years agoImplement LWG#2407: 'packaged_task(allocator_arg_t, const Allocator&, F&&) should...
Marshall Clow [Tue, 30 Jun 2015 14:16:49 +0000 (14:16 +0000)]
Implement LWG#2407: 'packaged_task(allocator_arg_t, const Allocator&, F&&) should neither be constrained nor explicit'

llvm-svn: 241068

9 years agoImplement N4508: shared_mutex. Reviewed as http://reviews.llvm.org/D10480
Marshall Clow [Tue, 30 Jun 2015 14:04:14 +0000 (14:04 +0000)]
Implement N4508: shared_mutex. Reviewed as reviews.llvm.org/D10480

llvm-svn: 241067

9 years ago[mips] [IAS] Add support for the .module softfloat/hardfloat directives.
Toma Tabacu [Tue, 30 Jun 2015 13:46:03 +0000 (13:46 +0000)]
[mips] [IAS] Add support for the .module softfloat/hardfloat directives.

These directives are used to set the default value of the SoftFloat feature.
They have the same effect as setting -m{soft, hard}-float from the command line.

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

llvm-svn: 241066

9 years ago[X86] Rename DEFAULT_FN_ATTR macro to __DEFAULT_FN_ATTR
Michael Kuperstein [Tue, 30 Jun 2015 13:36:19 +0000 (13:36 +0000)]
[X86] Rename DEFAULT_FN_ATTR macro to __DEFAULT_FN_ATTR

llvm-svn: 241065

9 years agoMark LWG#2266 as complete. This is a tightening up the wording; no code changes required.
Marshall Clow [Tue, 30 Jun 2015 13:32:08 +0000 (13:32 +0000)]
Mark LWG#2266 as complete. This is a tightening up the wording; no code changes required.

llvm-svn: 241064

9 years agoChange search order of target definition files.
Ewan Crawford [Tue, 30 Jun 2015 13:08:44 +0000 (13:08 +0000)]
Change search order of target definition files.

Make the python target definition file have highest priority so that we can set
the remote stub breakpoint pc offset using it.

Reviewers: clayborg
Subscribers: ted, deepak2427, lldb-commits

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

llvm-svn: 241063

9 years ago[mips] [IAS] Make .module directives change AssemblerOptions->front().
Toma Tabacu [Tue, 30 Jun 2015 12:41:33 +0000 (12:41 +0000)]
[mips] [IAS] Make .module directives change AssemblerOptions->front().

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

llvm-svn: 241062