platform/upstream/llvm.git
9 years agoDelete dead code. NFC.
Rafael Espindola [Fri, 26 Jun 2015 18:32:53 +0000 (18:32 +0000)]
Delete dead code. NFC.

llvm-svn: 240807

9 years agoCOFF: Align DLL import thunks on 16-byte boundaries.
Rui Ueyama [Fri, 26 Jun 2015 18:28:56 +0000 (18:28 +0000)]
COFF: Align DLL import thunks on 16-byte boundaries.

llvm-svn: 240806

9 years agoAdd op_values() to iterate over the SDValue operands of an SDNode.
Pete Cooper [Fri, 26 Jun 2015 18:17:36 +0000 (18:17 +0000)]
Add op_values() to iterate over the SDValue operands of an SDNode.

SDNode already had ops() which would iterate over the operands and return
SDUse*.  This version instead gets the SDValue's out of the SDUse's so that
we can use foreach in more places.

Reviewed by David Blaikie.

llvm-svn: 240805

9 years agoMove VectorUtils from Transforms to Analysis to correct layering violation
David Blaikie [Fri, 26 Jun 2015 18:02:52 +0000 (18:02 +0000)]
Move VectorUtils from Transforms to Analysis to correct layering violation

llvm-svn: 240804

9 years agoFixed incorrect application of expectedFlakey
Vince Harron [Fri, 26 Jun 2015 18:01:15 +0000 (18:01 +0000)]
Fixed incorrect application of expectedFlakey

llvm-svn: 240803

9 years agoCOFF: Fix README.
Rui Ueyama [Fri, 26 Jun 2015 17:59:12 +0000 (17:59 +0000)]
COFF: Fix README.

llvm-svn: 240802

9 years agoAvoid false positive/negative test results from line directive interference.NFC.
Chad Rosier [Fri, 26 Jun 2015 17:49:10 +0000 (17:49 +0000)]
Avoid false positive/negative test results from line directive interference.NFC.

http://reviews.llvm.org/D10443
Patch by Geoff Berry.

llvm-svn: 240801

9 years ago[static analyzer] Analyzer is skipping forward declared C/C++ functions
Anna Zaks [Fri, 26 Jun 2015 17:42:58 +0000 (17:42 +0000)]
[static analyzer] Analyzer is skipping forward declared C/C++ functions

A patch by Karthik Bhat!

This patch fixes a regression introduced by r224398. Prior to r224398
we were able to analyze the following code in test-include.c and report
a null deref in this case. But post r224398 this analysis is being skipped.

E.g.
  // test-include.c
  #include "test-include.h"
  void test(int * data) {
    data = 0;
    *data = 1;
  }

   // test-include.h
  void test(int * data);

This patch uses the function body (instead of its declaration) as the location
of the function when deciding if the Decl should be analyzed with path-sensitive
analysis. (Prior to r224398, the call graph was guaranteed to have a definition
when available.)

llvm-svn: 240800

9 years ago[ARM] Cortex-R5 is not VFPOnlySP
Javed Absar [Fri, 26 Jun 2015 17:42:37 +0000 (17:42 +0000)]
[ARM] Cortex-R5 is not VFPOnlySP

This patch fixes the error in ARM.td which stated that Cortex-R5
floating point unit can do only single precision, when it can do double as well.

Reviewers: rengolin

Subscribers: llvm-commits

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

llvm-svn: 240799

9 years ago[LAA] Try to prove non-wrapping of pointers if SCEV cannot
Adam Nemet [Fri, 26 Jun 2015 17:25:43 +0000 (17:25 +0000)]
[LAA] Try to prove non-wrapping of pointers if SCEV cannot

Summary:
Scalar evolution does not propagate the non-wrapping flags to values
that are derived from a non-wrapping induction variable because
the non-wrapping property could be flow-sensitive.

This change is a first attempt to establish the non-wrapping property in
some simple cases.  The main idea is to look through the operations
defining the pointer.  As long as we arrive to a non-wrapping AddRec via
a small chain of non-wrapping instruction, the pointer should not wrap
either.

I believe that this essentially is what Andy described in
http://article.gmane.org/gmane.comp.compilers.llvm.cvs/220731 as the way
forward.

Reviewers: aschwaighofer, nadav, sanjoy, atrick

Reviewed By: atrick

Subscribers: llvm-commits

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

llvm-svn: 240798

9 years agoFix unused variable from r240792.
Alex Lorenz [Fri, 26 Jun 2015 17:07:27 +0000 (17:07 +0000)]
Fix unused variable from r240792.

The variable 'I' wasn't used when assertions were disabled.
This commit ensures that 'I' is used outside of an assert.

llvm-svn: 240797

9 years ago[DAGCombine] Fix demanded bits computation for exact shifts.
Benjamin Kramer [Fri, 26 Jun 2015 16:59:31 +0000 (16:59 +0000)]
[DAGCombine] Fix demanded bits computation for exact shifts.

Fixes a miscompilation of MultiSource/Benchmarks/MallocBench/gs

llvm-svn: 240796

9 years ago[X86]: Correctly sign-extend 16-bit immediate in CALL instruction.
Douglas Katzman [Fri, 26 Jun 2015 16:58:59 +0000 (16:58 +0000)]
[X86]: Correctly sign-extend 16-bit immediate in CALL instruction.

Patch by Matthew Barney. Thanks!

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

llvm-svn: 240795

9 years agoFix ODR violation waiting to happen by making static function definitions in VectorUt...
David Blaikie [Fri, 26 Jun 2015 16:57:30 +0000 (16:57 +0000)]
Fix ODR violation waiting to happen by making static function definitions in VectorUtils.h non-static and defined out of line

Patch by Ashutosh Nema

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

llvm-svn: 240794

9 years agoRevert r240762 "[X86] Cleanup X86WindowsTargetObjectFile::getSectionForConstant"
Hans Wennborg [Fri, 26 Jun 2015 16:48:02 +0000 (16:48 +0000)]
Revert r240762 "[X86] Cleanup X86WindowsTargetObjectFile::getSectionForConstant"

It seems to have caused PR23966: "UNREACHABLE executed at ..\lib\Target\X86\X86TargetObjectFile.cpp:148"

llvm-svn: 240793

9 years agoMIR Serialization: Serialize machine basic block operands.
Alex Lorenz [Fri, 26 Jun 2015 16:46:11 +0000 (16:46 +0000)]
MIR Serialization: Serialize machine basic block operands.

This commit serializes machine basic block operands. The
machine basic block operands use the following syntax:

  %bb.<id>[.<name>]

This commit also modifies the YAML representation for the
machine basic blocks - a new, required field 'id' is added
to the MBB YAML mapping.

The id is used to resolve the MBB references to the
actual MBBs. And while the name of the MBB can be
included in a MBB reference, this name isn't used to
resolve MBB references - as it's possible that multiple
MBBs will reference the same BB and thus they will have the
same name. If the name is specified, the parser will verify
that it is equal to the name of the MBB with the specified id.

Reviewers: Duncan P. N. Exon Smith

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

llvm-svn: 240792

9 years agoclang-format some of the files in lib/Driver. NFC
Douglas Katzman [Fri, 26 Jun 2015 15:47:46 +0000 (15:47 +0000)]
clang-format some of the files in lib/Driver. NFC

Nothing was hand edited afterward except a few literal strings
and comments that were poorly broken.

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

llvm-svn: 240791

9 years agoELF: Simplify the rel/rela implementation.
Rafael Espindola [Fri, 26 Jun 2015 15:27:04 +0000 (15:27 +0000)]
ELF: Simplify the rel/rela implementation.

Now the rela class inherits from rel and just adds the addend.

llvm-svn: 240790

9 years agoAdded expectedFlakey test decorator
Vince Harron [Fri, 26 Jun 2015 15:13:21 +0000 (15:13 +0000)]
Added expectedFlakey test decorator

SUMMARY
Flakey tests get two chances to pass

Also, switched a bunch of tests to use new decorator.

TEST PLAN
Add one of these decorators to a test
Edit a test to pass on the first invocation, confirm test appears as pass
Edit a test to pass on the first invocation, pass on the second, confirm test appears as xfail
Edit a test to fail on two consecutive runs, confirm test appears in results as fail/error

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

llvm-svn: 240789

9 years ago[DAGCombiner] Preserve the exact bit when simplifying SRA to SRL.
Benjamin Kramer [Fri, 26 Jun 2015 14:51:49 +0000 (14:51 +0000)]
[DAGCombiner] Preserve the exact bit when simplifying SRA to SRL.

Allows more aggressive folding of ashr/shl pairs.

llvm-svn: 240788

9 years ago[DAGCombine] fold (X >>?,exact C1) << C2 --> X << (C2-C1)
Benjamin Kramer [Fri, 26 Jun 2015 14:51:36 +0000 (14:51 +0000)]
[DAGCombine] fold (X >>?,exact C1) << C2 --> X << (C2-C1)

Instcombine also does this but many opportunities only become visible
after GEPs are lowered.

llvm-svn: 240787

9 years agoSilencing spurious MSVC C4189 warnings regarding local variables that are initialized...
Aaron Ballman [Fri, 26 Jun 2015 14:51:22 +0000 (14:51 +0000)]
Silencing spurious MSVC C4189 warnings regarding local variables that are initialized but not used; NFC. This bug has been reported to Microsoft (https://connect.microsoft.com/VisualStudio/feedback/details/1475983).

llvm-svn: 240786

9 years agoRename getObjectFile to getObject for consistency.
Rafael Espindola [Fri, 26 Jun 2015 14:51:16 +0000 (14:51 +0000)]
Rename getObjectFile to getObject for consistency.

llvm-svn: 240785

9 years agoSimplify isSymbolList64Bit. NFC.
Rafael Espindola [Fri, 26 Jun 2015 14:11:54 +0000 (14:11 +0000)]
Simplify isSymbolList64Bit. NFC.

llvm-svn: 240784

9 years agoSimplify isObject. NFC.
Rafael Espindola [Fri, 26 Jun 2015 13:24:23 +0000 (13:24 +0000)]
Simplify isObject. NFC.

llvm-svn: 240783

9 years ago[mips] [IAS] Add partial support for the ULW pseudo-instruction.
Toma Tabacu [Fri, 26 Jun 2015 13:20:17 +0000 (13:20 +0000)]
[mips] [IAS] Add partial support for the ULW pseudo-instruction.

Summary:
This only adds support for ULW of an immediate address with/without a source register.
It does not include support for ULW of the address of a symbol.

Reviewers: dsanders

Reviewed By: dsanders

Subscribers: llvm-commits

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

llvm-svn: 240782

9 years agoUpdate for llvm changes.
Rafael Espindola [Fri, 26 Jun 2015 13:19:38 +0000 (13:19 +0000)]
Update for llvm changes.

llvm-svn: 240781

9 years agoImplement elf_section_iterator and getELFType().
Rafael Espindola [Fri, 26 Jun 2015 13:11:15 +0000 (13:11 +0000)]
Implement elf_section_iterator and getELFType().

And with those, simplify getSymbolNMTypeChar.

llvm-svn: 240780

9 years agoExpose getFlags via ELFSectionRef.
Rafael Espindola [Fri, 26 Jun 2015 12:44:10 +0000 (12:44 +0000)]
Expose getFlags via ELFSectionRef.

llvm-svn: 240779

9 years agoAdd a ELFSectionRef class and use it to expose getSectionType.
Rafael Espindola [Fri, 26 Jun 2015 12:33:37 +0000 (12:33 +0000)]
Add a ELFSectionRef class and use it to expose getSectionType.

llvm-svn: 240778

9 years agoSimplify getSymbolType.
Rafael Espindola [Fri, 26 Jun 2015 12:18:49 +0000 (12:18 +0000)]
Simplify getSymbolType.

This is still a really odd function. Most calls are in object format specific
contexts and should probably be replaced with a more direct query, but at least
now this is not too obnoxious to use.

llvm-svn: 240777

9 years ago[ARM] Cortex-R4F is not VFPOnlySP
Javed Absar [Fri, 26 Jun 2015 12:14:56 +0000 (12:14 +0000)]
[ARM] Cortex-R4F is not VFPOnlySP

Cortex-R4F TRM states that fpu supports both single and double precision.
This patch corrects the information in ARM.td file and corresponding test.

Reviewers: rengolin

Subscribers: llvm-commits

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

llvm-svn: 240776

9 years agoDrop divs before adding array-out-of-bounds assumptions
Tobias Grosser [Fri, 26 Jun 2015 12:09:28 +0000 (12:09 +0000)]
Drop divs before adding array-out-of-bounds assumptions

In case we have modulo operations in the access function (supported since
r240518), the assumptions generated to ensure array accesses remain within
bounds can contain existentially quantified dimensions which results in more
complex and more difficult to handle integer sets. As a result LNT's linpack
benchmark started to fail due to excessive compile time.

We now just drop the existentially quantified dimensions. This should be
generally save, but may result in less precise assumptions which may
consequently make us fall back to the original (unoptimized) code more often. In
practice, these cases probably do not appear to often.

I had difficulties to extract a good test case, but fortunately our LNT bots
cover this one well.

llvm-svn: 240775

9 years agoMake getOther ELF only.
Rafael Espindola [Fri, 26 Jun 2015 11:39:57 +0000 (11:39 +0000)]
Make getOther ELF only.

No other format has this field.

llvm-svn: 240774

9 years agoOptimize the creation of mapping symbols.
Rafael Espindola [Fri, 26 Jun 2015 11:31:13 +0000 (11:31 +0000)]
Optimize the creation of mapping symbols.

No need to create two symbols just to assign one to the other.

llvm-svn: 240773

9 years ago[NativeProcessLinux] Use lambdas in DoOperation calls
Pavel Labath [Fri, 26 Jun 2015 10:14:12 +0000 (10:14 +0000)]
[NativeProcessLinux] Use lambdas in DoOperation calls

Summary:
This removes a lot of boilerplate, which was needed to execute monitor operations. Previously one
needed do declare a separate class for each operation which would manually capture all needed
arguments, which was very verbose. In addition to less code, I believe this also makes the code
more readable, since now the implementation of the operation can be physically closer to the code
that invokes it.

Test Plan: Code compiles on x86, arm and mips, tests pass on x86 linux.

Reviewers: tberghammer, chaoren

Subscribers: aemerson, lldb-commits

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

llvm-svn: 240772

9 years agoDo not ignore projects/LLVMBuild.txt in git repo
Sergey Dmitrouk [Fri, 26 Jun 2015 10:13:56 +0000 (10:13 +0000)]
Do not ignore projects/LLVMBuild.txt in git repo

Without explicit exception for the path, it matches projects/* rule.

llvm-svn: 240771

9 years agoAdd branch emulation to aarch64 instruction emulator
Tamas Berghammer [Fri, 26 Jun 2015 09:41:32 +0000 (09:41 +0000)]
Add branch emulation to aarch64 instruction emulator

The emulation of the branches are required by the new stack
unwinding logic to reinstantiate the prologue at the right place.

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

llvm-svn: 240769

9 years agoXML register info fix
Ewan Crawford [Fri, 26 Jun 2015 09:38:27 +0000 (09:38 +0000)]
XML register info fix

There are a couple of bugs in the XML register info handling which this patch fixes:

+ conflicting variable names in lambda, both capture list and parameters contains a variable called 'name'.

+ prev_reg_num, which sets the register number, should be incremented after each register is processed.

+ Windows errors regarding empty strings and the 'xi:' prefix disappearing from 'xi:include' node name.

Reviewers: clayborg

Subscribers: lldb-commits, deepak2427

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

llvm-svn: 240768

9 years ago[libsanitizer] Delete the unused GetBinaryName() function.
Alexander Potapenko [Fri, 26 Jun 2015 09:28:24 +0000 (09:28 +0000)]
[libsanitizer] Delete the unused GetBinaryName() function.

llvm-svn: 240767

9 years agoRemove code for scalar and PHI to array translation
Tobias Grosser [Fri, 26 Jun 2015 07:31:18 +0000 (07:31 +0000)]
Remove code for scalar and PHI to array translation

This removes old code that has been disabled since several weeks and was hidden
behind the flags -disable-polly-intra-scop-scalar-to-array=false and
-polly-model-phi-nodes=false. Earlier, Polly used to translate scalars and
PHI nodes to single element arrays, as this avoided the need for their special
handling in Polly. With Johannes' patches adding native support for such scalar
references to Polly, this code is not needed any more. After this commit both
-polly-prepare and -polly-independent are now mostly no-ops. Only a couple of
simple transformations still remain, but they are scheduled for removal too.

Thanks again to Johannes Doerfert for his nice work in making all this code
obsolete.

llvm-svn: 240766

9 years ago[Mips] Reject R_MIPS_CALL16 against local symbols
Simon Atanasyan [Fri, 26 Jun 2015 07:25:20 +0000 (07:25 +0000)]
[Mips] Reject R_MIPS_CALL16 against local symbols

llvm-svn: 240765

9 years ago[Mips] Use helper functions to determine relocations purpose
Simon Atanasyan [Fri, 26 Jun 2015 07:25:12 +0000 (07:25 +0000)]
[Mips] Use helper functions to determine relocations purpose

That allows to remove duplicated long switch/case statements.

No functional changes.

llvm-svn: 240764

9 years ago[Mips] Create LA25 stubs for all branch relocations
Simon Atanasyan [Fri, 26 Jun 2015 07:25:06 +0000 (07:25 +0000)]
[Mips] Create LA25 stubs for all branch relocations

llvm-svn: 240763

9 years ago[X86] Cleanup X86WindowsTargetObjectFile::getSectionForConstant
David Majnemer [Fri, 26 Jun 2015 07:03:12 +0000 (07:03 +0000)]
[X86] Cleanup X86WindowsTargetObjectFile::getSectionForConstant

No functionality changed, just keeping things clean.

llvm-svn: 240762

9 years ago[ObjC] Add NSValue support for objc_boxed_expressions
Alex Denisov [Fri, 26 Jun 2015 05:28:36 +0000 (05:28 +0000)]
[ObjC] Add NSValue support for objc_boxed_expressions

Patch extends ObjCBoxedExpr to accept records (structs and unions):

typedef struct __attribute__((objc_boxable)) _Color {
  int r, g, b;
} Color;

Color color;
NSValue *boxedColor = @(color); // [NSValue valueWithBytes:&color objCType:@encode(Color)];

llvm-svn: 240761

9 years ago[InterleavedAccess] Fix failures "undefined type 'llvm::raw_ostream'" on windows.
Hao Liu [Fri, 26 Jun 2015 04:38:21 +0000 (04:38 +0000)]
[InterleavedAccess] Fix failures "undefined type 'llvm::raw_ostream'" on windows.

llvm-svn: 240760

9 years agoCOFF: Update README with the latest performance numbers.
Rui Ueyama [Fri, 26 Jun 2015 04:26:02 +0000 (04:26 +0000)]
COFF: Update README with the latest performance numbers.

llvm-svn: 240759

9 years agoCOFF: Add a test for r240719.
Rui Ueyama [Fri, 26 Jun 2015 03:50:27 +0000 (03:50 +0000)]
COFF: Add a test for r240719.

llvm-svn: 240758

9 years agoCOFF: Change symbol resolution order for entry and /include.
Rui Ueyama [Fri, 26 Jun 2015 03:44:00 +0000 (03:44 +0000)]
COFF: Change symbol resolution order for entry and /include.

We were resolving entry symbols and /include'd symbols after all other
symbols are resolved. But looks like it's too late. I found that it
causes some program to fail to link.

Let's say we have an object file A which defines symbols X and Y in an
archive. We also have another file B after A which defines X, Y and
_DLLMainCRTStartup in another archive. They conflict each other, so
either A or B can be linked.

If we have _DLLMainCRTStartup as an undefined symbol, file B is always
chosen. If not, there's a chance that A is chosen. If the linker
find it needs _DllMainCRTStartup after that, it's too late.

This patch adds undefined symbols to the symbol table as soon as
possible to fix the issue.

llvm-svn: 240757

9 years agoCOFF: Fix local absolute symbols.
Rui Ueyama [Fri, 26 Jun 2015 03:09:23 +0000 (03:09 +0000)]
COFF: Fix local absolute symbols.

Absolute symbols were always handled as external symbols, so if two
or more object files define the same absolute symbol, they would
conflict even if the symbol is private to each file.
This patch fixes that bug.

llvm-svn: 240756

9 years ago[ARM] Lower interleaved memory accesses to vldN/vstN intrinsics.
Hao Liu [Fri, 26 Jun 2015 02:45:36 +0000 (02:45 +0000)]
[ARM] Lower interleaved memory accesses to vldN/vstN intrinsics.
This patch also adds a function to calculate the cost of interleaved memory accesses.

E.g. Lower an interleaved load:
        %wide.vec = load <8 x i32>, <8 x i32>* %ptr, align 4
        %v0 = shuffle %wide.vec, undef, <0, 2, 4, 6>
        %v1 = shuffle %wide.vec, undef, <1, 3, 5, 7>
     into:
        %vld2 = { <4 x i32>, <4 x i32> } call llvm.arm.neon.vld2(%ptr, 4)
        %vec0 = extractelement { <4 x i32>, <4 x i32> } %vld2, i32 0
        %vec1 = extractelement { <4 x i32>, <4 x i32> } %vld2, i32 1

E.g. Lower an interleaved store:
        %i.vec = shuffle <8 x i32> %v0, <8 x i32> %v1, <0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11>
        store <12 x i32> %i.vec, <12 x i32>* %ptr, align 4
     into:
        %sub.v0 = shuffle <8 x i32> %v0, <8 x i32> v1, <0, 1, 2, 3>
        %sub.v1 = shuffle <8 x i32> %v0, <8 x i32> v1, <4, 5, 6, 7>
        %sub.v2 = shuffle <8 x i32> %v0, <8 x i32> v1, <8, 9, 10, 11>
        call void llvm.arm.neon.vst3(%ptr, %sub.v0, %sub.v1, %sub.v2, 4)

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

llvm-svn: 240755

9 years ago[AArch64] Lower interleaved memory accesses to ldN/stN intrinsics. This patch also...
Hao Liu [Fri, 26 Jun 2015 02:32:07 +0000 (02:32 +0000)]
[AArch64] Lower interleaved memory accesses to ldN/stN intrinsics. This patch also adds a function to calculate the cost of interleaved memory accesses.

E.g. Lower an interleaved load:
        %wide.vec = load <8 x i32>, <8 x i32>* %ptr
        %v0 = shuffle %wide.vec, undef, <0, 2, 4, 6>
        %v1 = shuffle %wide.vec, undef, <1, 3, 5, 7>
     into:
        %ld2 = { <4 x i32>, <4 x i32> } call llvm.aarch64.neon.ld2(%ptr)
        %vec0 = extractelement { <4 x i32>, <4 x i32> } %ld2, i32 0
        %vec1 = extractelement { <4 x i32>, <4 x i32> } %ld2, i32 1

E.g. Lower an interleaved store:
        %i.vec = shuffle <8 x i32> %v0, <8 x i32> %v1, <0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11>
        store <12 x i32> %i.vec, <12 x i32>* %ptr
     into:
        %sub.v0 = shuffle <8 x i32> %v0, <8 x i32> v1, <0, 1, 2, 3>
        %sub.v1 = shuffle <8 x i32> %v0, <8 x i32> v1, <4, 5, 6, 7>
        %sub.v2 = shuffle <8 x i32> %v0, <8 x i32> v1, <8, 9, 10, 11>
        call void llvm.aarch64.neon.st3(%sub.v0, %sub.v1, %sub.v2, %ptr)

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

llvm-svn: 240754

9 years agoWhen the user specifies a corefile that is not readable,
Jason Molenda [Fri, 26 Jun 2015 02:16:48 +0000 (02:16 +0000)]
When the user specifies a corefile that is not readable,
give them a meaningful error message instead of
"Unable to find process plug-in for core file ...".

<rdar://problem/21255759>
<rdar://problem/21091522>
http://blog.ignoranthack.me/?p=204

llvm-svn: 240753

9 years agoFix crash-on-invalid bug in template instantiation.
Manuel Klimek [Fri, 26 Jun 2015 02:15:04 +0000 (02:15 +0000)]
Fix crash-on-invalid bug in template instantiation.

Get rid of code-path that (according to Richard Smith) is not needed but
leads to a crasher bug when assuming a template has been fully
instantiated and thus has a definition.

llvm-svn: 240752

9 years ago[InterleavedAccess] Add a pass InterleavedAccess to identify interleaved memory acces...
Hao Liu [Fri, 26 Jun 2015 02:10:27 +0000 (02:10 +0000)]
[InterleavedAccess] Add a pass InterleavedAccess to identify interleaved memory accesses and transform into target specific intrinsics.

E.g. An interleaved load (Factor = 2):
        %wide.vec = load <8 x i32>, <8 x i32>* %ptr
        %v0 = shuffle <8 x i32> %wide.vec, <8 x i32> undef, <0, 2, 4, 6>
        %v1 = shuffle <8 x i32> %wide.vec, <8 x i32> undef, <1, 3, 5, 7>
It can be transformed into a ld2 intrinsic in AArch64 backend or a vld2 intrinsic in ARM backend.

E.g. An interleaved store (Factor = 3):
        %i.vec = shuffle <8 x i32> %v0, <8 x i32> %v1, <0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11>
        store <12 x i32> %i.vec, <12 x i32>* %ptr
It can be transformed into a st3 intrinsic in AArch64 backend or a vst3 intrinsic in ARM backend.

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

llvm-svn: 240751

9 years agoAsmPrinter: More explicitly scope iterator for MSVC
Duncan P. N. Exon Smith [Fri, 26 Jun 2015 00:53:44 +0000 (00:53 +0000)]
AsmPrinter: More explicitly scope iterator for MSVC

r240748 seems to be on the right path.  Be more explicit.

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/1961/

llvm-svn: 240750

9 years agoCOFF: Don't read non-x64 object files.
Rui Ueyama [Fri, 26 Jun 2015 00:42:21 +0000 (00:42 +0000)]
COFF: Don't read non-x64 object files.

Currently the new LLD supports only x86-64.

llvm-svn: 240749

9 years agoAsmPrinter: Explicitly scope iterator for MSVC
Duncan P. N. Exon Smith [Fri, 26 Jun 2015 00:41:53 +0000 (00:41 +0000)]
AsmPrinter: Explicitly scope iterator for MSVC

Try to placate bots by explicitly scoping a conversion constructor from
`iterator` to `const_iterator`.

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/5931/

llvm-svn: 240748

9 years agoFileCheck-ize test and make sure more things don't happen.
Paul Robinson [Fri, 26 Jun 2015 00:36:50 +0000 (00:36 +0000)]
FileCheck-ize test and make sure more things don't happen.

Attribute 'nodebug' means no llvm.dbg.* intrinsics, no !dbg
annotations, and no DISubprogram for the function.

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

llvm-svn: 240747

9 years agoRevert "X86: Reject register operands with obvious type mismatches."
Matthias Braun [Fri, 26 Jun 2015 00:26:49 +0000 (00:26 +0000)]
Revert "X86: Reject register operands with obvious type mismatches."

Revert until http://llvm.org/PR23955 is investigated.

This reverts commit r239309.

llvm-svn: 240746

9 years agoFix mismatched architectures in test
Matthias Braun [Fri, 26 Jun 2015 00:26:46 +0000 (00:26 +0000)]
Fix mismatched architectures in test

llvm-svn: 240745

9 years agoaad/fix labels in test/CodeGen/X86/StackColoring.ll
Matthias Braun [Fri, 26 Jun 2015 00:26:44 +0000 (00:26 +0000)]
aad/fix labels in test/CodeGen/X86/StackColoring.ll

llvm-svn: 240744

9 years agoAdd new file from r240741 to CMakeLists.txt.
Nico Weber [Fri, 26 Jun 2015 00:19:32 +0000 (00:19 +0000)]
Add new file from r240741 to CMakeLists.txt.

llvm-svn: 240743

9 years ago[Sema] Commit a better fix for r240242
Davide Italiano [Fri, 26 Jun 2015 00:18:35 +0000 (00:18 +0000)]
[Sema] Commit a better fix for r240242

Skip calls to HasTrivialDestructorBody() in the case where the
destructor is never invoked. Alternatively, Richard proposed to change
Sema to declare a trivial destructor for anonymous union member, which
seems too wasteful.

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

llvm-svn: 240742

9 years agoAdd an inttypes.h wrapper that fixes up some macros in Microsoft mode.
Nico Weber [Fri, 26 Jun 2015 00:13:18 +0000 (00:13 +0000)]
Add an inttypes.h wrapper that fixes up some macros in Microsoft mode.

Before MSVS2015, MSVS's headers disagree about int32_t and PRIx32 and so on.
Provide a wrapper header to fix this, so that -Wformat can still be used.
Fixes PR23412.

llvm-svn: 240741

9 years ago[Sema] Maintain ellipsis location when transforming lambda captures
Meador Inge [Fri, 26 Jun 2015 00:09:55 +0000 (00:09 +0000)]
[Sema] Maintain ellipsis location when transforming lambda captures

This patch fixes a crash caused by the following case:

  template<typename T>
  auto f(T x) {
    auto g = [](auto ... args) {
      auto h = [args...]() -> int {
        return 0;
      };
      return h;
    };
    return g;
  }

  auto x = f(0)();

When the templated function 'f' is instantiated and the inner-most
lambda is transformed the ellipsis location on the captured variable
is lost.  Then the lambda returned by 'f' is instantiated and the
tree transformer chokes on the invalid ellipsis location.  The
problem is fixed by making a minor change to properly track the
ellipsis location.

This fixes PR23716.

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

llvm-svn: 240740

9 years agoUse the right ifdef macro, reviewed by Jason
Han Ming Ong [Fri, 26 Jun 2015 00:04:51 +0000 (00:04 +0000)]
Use the right ifdef macro, reviewed by Jason

llvm-svn: 240739

9 years ago[ASan] Use llvm::getDISubprogram() to get function entry debug location.
Alexey Samsonov [Fri, 26 Jun 2015 00:00:47 +0000 (00:00 +0000)]
[ASan] Use llvm::getDISubprogram() to get function entry debug location.

It can be more robust than copying debug info from first non-alloca
instruction in the entry basic block. We use the same strategy in
coverage instrumentation.

llvm-svn: 240738

9 years agoRe-enable 'process save-core' for arm64 targets.
Jason Molenda [Thu, 25 Jun 2015 23:58:25 +0000 (23:58 +0000)]
Re-enable 'process save-core' for arm64 targets.
Whatever problem I saw that caused me to disable this
initially is not a problem today.
<rdar://problem/21173317>
<rdar://problem/20266253>

llvm-svn: 240737

9 years agoAsmPrinter: Use an intrusively linked list for DIE::Children
Duncan P. N. Exon Smith [Thu, 25 Jun 2015 23:52:10 +0000 (23:52 +0000)]
AsmPrinter: Use an intrusively linked list for DIE::Children

Replace the `std::vector<>` for `DIE::Children` with an intrusively
linked list.  This is a strict memory improvement: it requires no
auxiliary storage, and reduces `sizeof(DIE)` by one pointer.  It also
factors out the DIE-related malloc traffic.

This drops llc memory usage from 735 MB down to 718 MB, or ~2.3%.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

llvm-svn: 240736

9 years ago[CodeGen] Restrict isTriviallyRecursive to predefined lib functions forwarding to...
David Majnemer [Thu, 25 Jun 2015 23:50:40 +0000 (23:50 +0000)]
[CodeGen] Restrict isTriviallyRecursive to predefined lib functions forwarding to lib functions

isTriviallyRecursive is only supposed to guard functions part of the
implementation.

This fixes PR23953.

llvm-svn: 240735

9 years agoFix a typo correction crash when resolving ambiguous corrections.
Kaelyn Takata [Thu, 25 Jun 2015 23:47:39 +0000 (23:47 +0000)]
Fix a typo correction crash when resolving ambiguous corrections.

In certain cases, the tree transform would introduce new TypoExprs while
trying one of the corrections, invalidating the unique_ptr in the state
reference, and also causing a TypoExpr to exist that will never be
corrected since it doesn't exist in the final corrected expression. The
simple solution to both problems is to temporarily disable typo
correction while handling potentially ambiguous typo corrections.

llvm-svn: 240734

9 years agoAsmPrinter: Convert DIE::Values to a linked list
Duncan P. N. Exon Smith [Thu, 25 Jun 2015 23:46:41 +0000 (23:46 +0000)]
AsmPrinter: Convert DIE::Values to a linked list

Change `DIE::Values` to a singly linked list, where each node is
allocated on a `BumpPtrAllocator`.  In order to support `push_back()`,
the list is circular, and points at the tail element instead of the
head.  I abstracted the core list logic out to `IntrusiveBackList` so
that it can be reused for `DIE::Children`, which also cares about
`push_back()`.

This drops llc memory usage from 799 MB down to 735 MB, about 8%.

(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;
see r236629 for details.)

llvm-svn: 240733

9 years agollvm api change.
Michael J. Spencer [Thu, 25 Jun 2015 23:41:55 +0000 (23:41 +0000)]
llvm api change.

llvm-svn: 240732

9 years ago[ELF] Move ELF{32,64}{L,B}E typedefs to llvm.
Michael J. Spencer [Thu, 25 Jun 2015 23:41:23 +0000 (23:41 +0000)]
[ELF] Move ELF{32,64}{L,B}E typedefs to llvm.

llvm-svn: 240731

9 years ago[ELF] Add some accessors for lld.
Michael J. Spencer [Thu, 25 Jun 2015 23:40:41 +0000 (23:40 +0000)]
[ELF] Add some accessors for lld.

llvm-svn: 240730

9 years agoMake llvm-dwarfdump exit with non-zero exit code if error was occured.
Alexey Samsonov [Thu, 25 Jun 2015 23:40:15 +0000 (23:40 +0000)]
Make llvm-dwarfdump exit with non-zero exit code if error was occured.

llvm-svn: 240729

9 years agordar://problem/21469556
Han Ming Ong [Thu, 25 Jun 2015 23:39:56 +0000 (23:39 +0000)]
rdar://problem/21469556
Make sure that the memory report is correct for 64-bit devices.

llvm-svn: 240728

9 years agoPPCISelLowering.cpp: Appease PR23956. [-Wdocumentation]
NAKAMURA Takumi [Thu, 25 Jun 2015 23:38:44 +0000 (23:38 +0000)]
PPCISelLowering.cpp: Appease PR23956. [-Wdocumentation]

llvm-svn: 240727

9 years agoSplit test up into two target-spcific directories.
Adrian Prantl [Thu, 25 Jun 2015 23:38:22 +0000 (23:38 +0000)]
Split test up into two target-spcific directories.

llvm-svn: 240726

9 years ago[docs] Several updates to the Address Sanitizer webpage.
Anna Zaks [Thu, 25 Jun 2015 23:36:44 +0000 (23:36 +0000)]
[docs] Several updates to the Address Sanitizer webpage.

 - Added the description of the interceptor suppression.
 - Re-organized a bit: grouped a few things under the Issue Suppression
   section, grouped IOC and leaks under a section, placed symbolication
   info into Symbolizing the Reports section..
 - In supported platforms: "MacOS" -> "OS X"; added "iOS Simulator"
 - Added a paragraph to the Usage section describing when DYLD_INSERT_LIBRARIES
   might need to be used.
 - "attribute((no_sanitize_address))" -> "__attribute__((no_sanitize("address")))"
 - Updated Leak Sanitizer page with most up to date info.
....

http://reviews.llvm.org/D10559

llvm-svn: 240725

9 years ago[asan] Do not unset DYLD_ROOT_PATH before calling atos on Darwin
Anna Zaks [Thu, 25 Jun 2015 23:36:21 +0000 (23:36 +0000)]
[asan] Do not unset DYLD_ROOT_PATH before calling atos on Darwin

We were unsetting DYLD_ROOT_PATH before calling atos on Darwin in order to
address it not working for symbolicating 32 bit binaries. (atos essentiall
tries to respawn as a 32 bit binary and it's disallowed to respawn if
DYLD_ROOT_PATH is set ... ) However, processes rely on having DYLD_ROOT_PATH
set under certain conditions, so this is not the right fix. In particular, this
always crashes when running ASanified process under the debugger in Xcode with
iOS simulator, which is a very important workflow for us to support.

This patch reverts the unsetting of the DYLD_ROOT_PATH. The correct fix to the
misbehavior on 32-bit binaries should happen inside atos.

http://reviews.llvm.org/D10722

llvm-svn: 240724

9 years ago[asan] Do not instrument special purpose LLVM sections.
Anna Zaks [Thu, 25 Jun 2015 23:35:48 +0000 (23:35 +0000)]
[asan] Do not instrument special purpose LLVM sections.

Do not instrument globals that are placed in sections containing "__llvm"
in their name.

This fixes a bug in ASan / PGO interoperability. ASan interferes with LLVM's
PGO, which places its globals into a special section, which is memcpy-ed by
the linker as a whole. When those goals are instrumented, ASan's memcpy wrapper
reports an issue.

http://reviews.llvm.org/D10541

llvm-svn: 240723

9 years ago[asan] Don't run stack malloc on functions containing inline assembly.
Anna Zaks [Thu, 25 Jun 2015 23:35:45 +0000 (23:35 +0000)]
[asan] Don't run stack malloc on functions containing inline assembly.

It makes LLVM run out of registers even on 64-bit platforms. For example, the
following test case fails on darwin.

clang -cc1 -O0 -triple x86_64-apple-macosx10.10.0 -emit-obj -fsanitize=address -mstackrealign -o ~/tmp/ex.o -x c ex.c
error: inline assembly requires more registers than available

void TestInlineAssembly(const unsigned char *S, unsigned int pS, unsigned char *D, unsigned int pD, unsigned int h) {

unsigned int sr = 4, pDiffD = pD - 5;
unsigned int pDiffS = (pS << 1) - 5;
char flagSA = ((pS & 15) == 0),
flagDA = ((pD & 15) == 0);
asm volatile (
  "mov %0,  %%"PTR_REG("si")"\n"
  "mov %2,  %%"PTR_REG("cx")"\n"
  "mov %1,  %%"PTR_REG("di")"\n"
  "mov %8,  %%"PTR_REG("ax")"\n"
  :
  : "m" (S), "m" (D), "m" (pS), "m" (pDiffS), "m" (pDiffD), "m" (sr), "m" (flagSA), "m" (flagDA), "m" (h)
  : "%"PTR_REG("si"), "%"PTR_REG("di"), "%"PTR_REG("ax"), "%"PTR_REG("cx"), "%"PTR_REG("dx"), "memory"
);
}

http://reviews.llvm.org/D10719

llvm-svn: 240722

9 years agoCOFF: Rename /opt:icf -> /opt:lldicf.
Rui Ueyama [Thu, 25 Jun 2015 23:26:58 +0000 (23:26 +0000)]
COFF: Rename /opt:icf -> /opt:lldicf.

ICF implemented in LLD is so experimental that we don't want to
enable that even if /opt:icf option is passed. I'll rename it back
once the feature is complete.

llvm-svn: 240721

9 years agoRemove `requires` for x86 CPU features.
Sean Silva [Thu, 25 Jun 2015 23:22:11 +0000 (23:22 +0000)]
Remove `requires` for x86 CPU features.

Ever since the target attributes change, we don't need to guard these
headers with `requires`. Actually it's a bit worse, because if we do
then they are included textually under the covers, causing declarations
to appear in submodules they aren't supposed to be in.

llvm-svn: 240720

9 years agoCOFF: Better error message for duplicate symbols.
Rui Ueyama [Thu, 25 Jun 2015 23:22:00 +0000 (23:22 +0000)]
COFF: Better error message for duplicate symbols.

Now the symbol table prints out not only symbol names but
also file names for duplicate symbols.

llvm-svn: 240719

9 years agoFix the test added in r240710.
Jonathan Roelofs [Thu, 25 Jun 2015 23:21:11 +0000 (23:21 +0000)]
Fix the test added in r240710.

llvm-svn: 240718

9 years agoDebug Info: Add basic test coverage for the DWARF encoding of bitfields.
Adrian Prantl [Thu, 25 Jun 2015 23:19:19 +0000 (23:19 +0000)]
Debug Info: Add basic test coverage for the DWARF encoding of bitfields.

While looking at a couple of bugs in the debug info output for bitfields
I noticed that there wasn't a single regression test to test my changes
against, so here's a start.

llvm-svn: 240717

9 years ago[CFI] Diagnose when we CFI in diagnostic mode is unavailable on a toolchain.
Alexey Samsonov [Thu, 25 Jun 2015 23:14:32 +0000 (23:14 +0000)]
[CFI] Diagnose when we CFI in diagnostic mode is unavailable on a toolchain.

Summary:
Namely, we must have proper C++ABI support in UBSan runtime. We don't
have a good way to check for that, so just assume that C++ABI support is
there whenever -fsanitize=vptr is supported (i.e. only on handful of
platforms).

Exact diagnostic is also tricky. It's not "cfi" that is unsupported,
just the diagnostic mode. So, I suggest to report that
"-fno-sanitize-trap=cfi-foobar" is incompatible with a given target
toolchain.

Test Plan: regression test suite

Reviewers: pcc

Subscribers: cfe-commits

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

llvm-svn: 240716

9 years agoDisplay profile file name when emitting a file not found diagnostic.
Diego Novillo [Thu, 25 Jun 2015 22:56:00 +0000 (22:56 +0000)]
Display profile file name when emitting a file not found diagnostic.

When a profile file cannot be opened, we used to display just the error
message but not the name of the profile the compiler was trying to open.
This will become useful in the next set of patches that introduce
GCC-compatible flags to specify profiles.

llvm-svn: 240715

9 years agoXcode project cleanups.
Greg Clayton [Thu, 25 Jun 2015 22:47:02 +0000 (22:47 +0000)]
Xcode project cleanups.

- Don't have any header files claim to be part of the lldb-core target. If they are part of the lldb-core target then any file can just #include the header file name without the prefix (#include "Foo.h") when the cmake/make/other builds would require a full path (#include "lldb/Core/Foo.h"). This will help make sure the builds succeed on all platforms when changes are made on MacOSX.
- Add the Hexagon dynamic loader to the DynamicLoader plug-in folder so it gets compiled in MacOSX. There was a recent build bot failure that wasn't caught due to this code not being compile in the MacOSX build

llvm-svn: 240714

9 years agoMark armv7em and armv7m as compatible architectures.
Jason Molenda [Thu, 25 Jun 2015 22:37:57 +0000 (22:37 +0000)]
Mark armv7em and armv7m as compatible architectures.
<rdar://problem/21244671>

llvm-svn: 240713

9 years agoCommit file that was missing 240466.
Greg Clayton [Thu, 25 Jun 2015 22:34:08 +0000 (22:34 +0000)]
Commit file that was missing 240466.

<rdar://problem/21494354>

llvm-svn: 240712

9 years agoUnbreak the build.
Greg Clayton [Thu, 25 Jun 2015 22:20:02 +0000 (22:20 +0000)]
Unbreak the build.

llvm-svn: 240711

9 years agoThis should actually fix the broken bots.
Chris Bieneman [Thu, 25 Jun 2015 22:15:39 +0000 (22:15 +0000)]
This should actually fix the broken bots.

llvm-svn: 240710

9 years agoDAGCombiner: Use pop_back_val()
Matt Arsenault [Thu, 25 Jun 2015 22:15:05 +0000 (22:15 +0000)]
DAGCombiner: Use pop_back_val()

llvm-svn: 240709

9 years agoAdd an ELFSymbolRef type.
Rafael Espindola [Thu, 25 Jun 2015 22:10:04 +0000 (22:10 +0000)]
Add an ELFSymbolRef type.

This allows user code to say Sym.getSize() instead of having to manually fetch
the object.

llvm-svn: 240708

9 years ago[Parse] Allow 'constexpr' in condition declarations
Meador Inge [Thu, 25 Jun 2015 22:06:40 +0000 (22:06 +0000)]
[Parse] Allow 'constexpr' in condition declarations

This patch implements the functionality specified by DR948.
The changes are two fold.  First, the parser was modified
to allow 'constexpr's to appear in condition declarations
(which was a hard error before).  Second, Sema was modified
to cleanup maybe odr-used declarations by way of a call to
'ActOnFinishFullExpr'.  As 'constexpr's were not allowed in
condition declarations before the cleanup wasn't necessary
(such declarations were always odr-used).

This fixes PR22491.

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

llvm-svn: 240707