platform/upstream/llvm.git
8 years agoIR: Add ConstantData, for operand-less Constants
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 02:39:49 +0000 (02:39 +0000)]
IR: Add ConstantData, for operand-less Constants

Add a common parent `ConstantData` to the constants that have no
operands.  These are guaranteed to represent abstract data that is in no
way tied to a specific Module.

This is a good cleanup on its own.  It also makes it simpler to disallow
RAUW (and factor away use-lists) on these constants in the future.  (I
have some experimental patches that make RAUW illegal on ConstantData,
and they seem to catch a bunch of bugs...)

llvm-svn: 261464

8 years agoUnbreak non-X86 targets from fallout caused by r261462
David Majnemer [Sun, 21 Feb 2016 01:40:04 +0000 (01:40 +0000)]
Unbreak non-X86 targets from fallout caused by r261462

llvm-svn: 261463

8 years ago[X86] Use the correct alignment for COMDAT constant pool entries
David Majnemer [Sun, 21 Feb 2016 01:30:30 +0000 (01:30 +0000)]
[X86] Use the correct alignment for COMDAT constant pool entries

COFF doesn't have sections with mergeable contents.  Instead, each
constant pool entry ends up in a COMDAT section.  The linker, when
choosing between COMDAT sections, doesn't choose the max alignment of
the two sections.  You just get whatever alignment was on the section.

If one constant needed a higher alignment in one object file from
another one, then we will get into trouble if the linker chooses the
lower alignment one.

Instead, lets promote the alignment of the constant pool entry to make
sure we don't use an under aligned constant with an instruction which
assumed otherwise.

This fixes PR26680.

llvm-svn: 261462

8 years agoLex: Never overflow the file in HeaderMap::lookupFilename()
Duncan P. N. Exon Smith [Sun, 21 Feb 2016 00:14:36 +0000 (00:14 +0000)]
Lex: Never overflow the file in HeaderMap::lookupFilename()

If a header map file is corrupt, the strings in the string table may not
be null-terminated.  The logic here previously relied on `MemoryBuffer`
always being null-terminated, but this isn't actually guaranteed by the
class AFAICT.  Moreover, we're seeing a lot of crash traces at calls to
`strlen()` inside of `lookupFilename()`, so something is going wrong
there.

Instead, use `strnlen()` to get the length, and check for corruption.

Also remove code paths that could call `StringRef(nullptr)`.  r261459
made these rather obvious (although they'd been there all along).

llvm-svn: 261461

8 years ago[InstCombine] SSE/SSE2 (u)comiss/(u)comisd comparison intrinsics only use the lowest...
Simon Pilgrim [Sat, 20 Feb 2016 23:17:35 +0000 (23:17 +0000)]
[InstCombine] SSE/SSE2 (u)comiss/(u)comisd comparison intrinsics only use the lowest vector element

llvm-svn: 261460

8 years agoLex: Change HeaderMapImpl::getString() to return StringRef, NFC
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 23:12:51 +0000 (23:12 +0000)]
Lex: Change HeaderMapImpl::getString() to return StringRef, NFC

llvm-svn: 261459

8 years ago[WebAssembly] Refine a README.txt entry.
Dan Gohman [Sat, 20 Feb 2016 23:11:14 +0000 (23:11 +0000)]
[WebAssembly] Refine a README.txt entry.

The register coloring pass may also need to be involved in order to
optimally sort registers.

llvm-svn: 261458

8 years ago[WebAssembly] Handle CopyToReg nodes with flag results in LowerCopyToReg.
Dan Gohman [Sat, 20 Feb 2016 23:09:44 +0000 (23:09 +0000)]
[WebAssembly] Handle CopyToReg nodes with flag results in LowerCopyToReg.

llvm-svn: 261457

8 years agoLex: Use dbgs() instead of fprintf() in HeaderMap::dump()
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 23:09:14 +0000 (23:09 +0000)]
Lex: Use dbgs() instead of fprintf() in HeaderMap::dump()

This way it's easy to change HeaderMapImpl::getString() to return a
StringRef.

There's a slight change here, because I used `errs()` instead of
`dbgs()`.  But `dbgs()` is more appropriate for a dump method.

llvm-svn: 261456

8 years agoLex: Add a test for HeaderMap::lookupFileName()
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 22:53:22 +0000 (22:53 +0000)]
Lex: Add a test for HeaderMap::lookupFileName()

Add a simple test for `HeaderMap::lookupFileName()`.  I'm planning to
add better error checking in a moment, and I'll add more tests like this
then.

llvm-svn: 261455

8 years ago[InstCombine] Added SSE/SSE2 comparison intrinsics demanded vector elements tests
Simon Pilgrim [Sat, 20 Feb 2016 22:41:31 +0000 (22:41 +0000)]
[InstCombine] Added SSE/SSE2 comparison intrinsics demanded vector elements tests

llvm-svn: 261454

8 years ago[WebAssembly] Write stack pointer back to memory when FP is used
Derek Schuff [Sat, 20 Feb 2016 22:18:47 +0000 (22:18 +0000)]
[WebAssembly] Write stack pointer back to memory when FP is used

The stack pointer is bumped when there is a frame pointer or when there
are static-size objects, but was only getting written back when there
were static-size objects.

llvm-svn: 261453

8 years ago[WebAssembly] Stackify function prologs and epilogs
Derek Schuff [Sat, 20 Feb 2016 21:46:50 +0000 (21:46 +0000)]
[WebAssembly] Stackify function prologs and epilogs

The instructions are the same, but fewer locals are used.

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

llvm-svn: 261452

8 years ago[InstCombine] Added some SSE/SSE2 demanded vector elements tests
Simon Pilgrim [Sat, 20 Feb 2016 21:44:48 +0000 (21:44 +0000)]
[InstCombine] Added some SSE/SSE2 demanded vector elements tests

llvm-svn: 261451

8 years agoDon't scan for SSA register operands to update when not in SSA form.
Dan Gohman [Sat, 20 Feb 2016 21:28:18 +0000 (21:28 +0000)]
Don't scan for SSA register operands to update when not in SSA form.

TailDuplicate can run on either on SSA code or non-SSA code, as indicated to
it by MRI->isSSA() ("PreRegAlloc" here). TailDuplicate does extra work to
preserve SSA invariants when it duplicates code. This patch makes it skip
some of this extra work in the case where the code is not in SSA form.

llvm-svn: 261450

8 years agoLex: Check whether the header map buffer has space for the buckets
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 21:24:31 +0000 (21:24 +0000)]
Lex: Check whether the header map buffer has space for the buckets

Check up front whether the header map buffer has space for all of its
declared buckets.

There was already a check in `getBucket()`, but it had UB (comparing
pointers that were outside of objects in the error path) and was
insufficient (only checking for a single byte of the relevant bucket).
I fixed the check, moved it to `checkHeader()`, and left a fixed version
behind as an assertion.

llvm-svn: 261449

8 years agoLex: Check buckets on header map construction
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 21:00:58 +0000 (21:00 +0000)]
Lex: Check buckets on header map construction

If the number of buckets is not a power of two, immediately recognize
the header map as corrupt, rather than waiting for the first lookup.  I
converted the later check to an assert.

llvm-svn: 261448

8 years agoFix the build bot break caused by rL261441.
Nemanja Ivanovic [Sat, 20 Feb 2016 20:45:37 +0000 (20:45 +0000)]
Fix the build bot break caused by rL261441.

The patch has a necessary call to a function inside an assert. Which is fine
when you have asserts turned on. Not so much when they're off. Sorry about
the regression.

llvm-svn: 261447

8 years agoLex: Add some unit tests for corrupt header maps
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 20:39:51 +0000 (20:39 +0000)]
Lex: Add some unit tests for corrupt header maps

Split the implementation of `HeaderMap` into `HeaderMapImpl` so that we
can write unit tests that don't depend on the `FileManager`, and then
write a few tests that cover the types of corrupt header maps already
detected.

This also moves type and constant definitions from HeaderMap.cpp to
HeaderMapTypes.h so that the test can access them.

llvm-svn: 261446

8 years ago[c-index-test] CMake: When installing c-index-test to a different prefix directory...
Argyrios Kyrtzidis [Sat, 20 Feb 2016 20:34:55 +0000 (20:34 +0000)]
[c-index-test] CMake: When installing c-index-test to a different prefix directory, add an rpath so that
it can find libclang.

llvm-svn: 261445

8 years ago[X86][AVX] Added test case for PR22359
Simon Pilgrim [Sat, 20 Feb 2016 19:21:20 +0000 (19:21 +0000)]
[X86][AVX] Added test case for PR22359

llvm-svn: 261444

8 years agoLex: clang-format HeaderMap.h, NFC
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 18:55:08 +0000 (18:55 +0000)]
Lex: clang-format HeaderMap.h, NFC

llvm-svn: 261443

8 years agoLex: Remove explicitly deleted copy constructor, NFC
Duncan P. N. Exon Smith [Sat, 20 Feb 2016 18:53:45 +0000 (18:53 +0000)]
Lex: Remove explicitly deleted copy constructor, NFC

`std::unique_ptr<MemoryBuffer>` already deletes these, so there's no
reason for the boiler-plate in HeaderMap.

llvm-svn: 261442

8 years agoFix for PR 26500
Nemanja Ivanovic [Sat, 20 Feb 2016 18:16:25 +0000 (18:16 +0000)]
Fix for PR 26500

This patch corresponds to review:
http://reviews.llvm.org/D17294

It ensures that whatever block we are emitting the prologue/epilogue into, we
have the necessary scratch registers. It takes away the hard-coded register
numbers for use as scratch registers as registers that are guaranteed to be
available in the function prologue/epilogue are not guaranteed to be available
within the function body. Since we shrink-wrap, the prologue/epilogue may end
up in the function body.

llvm-svn: 261441

8 years ago[X86] Regenerated pr16360.ll
Simon Pilgrim [Sat, 20 Feb 2016 17:56:45 +0000 (17:56 +0000)]
[X86] Regenerated pr16360.ll

llvm-svn: 261440

8 years ago[X86][SSE41] More fast-isel intrinsics tests
Simon Pilgrim [Sat, 20 Feb 2016 17:30:37 +0000 (17:30 +0000)]
[X86][SSE41] More fast-isel intrinsics tests

llvm-svn: 261439

8 years ago[X86][SSE41] Added fast-isel intrinsics tests
Simon Pilgrim [Sat, 20 Feb 2016 17:11:32 +0000 (17:11 +0000)]
[X86][SSE41] Added fast-isel intrinsics tests

As discussed on PR24580, this patch adds some (more to come) initial fast-isel codegen tests to match the IR generated in clang/test/CodeGen/sse41-builtins.c

llvm-svn: 261438

8 years ago[DAGCombiner] Use getBitcast helper when possible. NFCI.
Simon Pilgrim [Sat, 20 Feb 2016 15:05:29 +0000 (15:05 +0000)]
[DAGCombiner] Use getBitcast helper when possible. NFCI.

llvm-svn: 261437

8 years agoIntroduce helper function to build isl_flow, NFC.
Hongbin Zheng [Sat, 20 Feb 2016 14:45:48 +0000 (14:45 +0000)]
Introduce helper function to build isl_flow, NFC.

llvm-svn: 261436

8 years agoAdd the missing modifier 'static' for addZeroPaddingToSchedule, NFC
Hongbin Zheng [Sat, 20 Feb 2016 14:45:46 +0000 (14:45 +0000)]
Add the missing modifier 'static' for addZeroPaddingToSchedule, NFC

llvm-svn: 261435

8 years ago[X86][SSE] Fixed issue with commutation of 'faux unary' target shuffles (PR26667)
Simon Pilgrim [Sat, 20 Feb 2016 14:39:45 +0000 (14:39 +0000)]
[X86][SSE] Fixed issue with commutation of 'faux unary' target shuffles (PR26667)

Fixed a bug introduced by D16683 when a binary shuffle is simplified to a unary shuffle (with undef/zero sentinel mask indices) - if this resulted in only the second input being used combineX86ShuffleChain failed to take this into account and still referenced the first input.

llvm-svn: 261434

8 years ago[X86][SSE] Move all undef/zero cases before target shuffle combining.
Simon Pilgrim [Sat, 20 Feb 2016 12:57:32 +0000 (12:57 +0000)]
[X86][SSE] Move all undef/zero cases before target shuffle combining.

First small step towards fixing PR26667 - we need to ensure that combineX86ShuffleChain only gets called with a valid shuffle input node (a similar issue was found in D17041).

llvm-svn: 261433

8 years ago[CMake] Add partial support for MSVC in compiler-rt builtins, by Roman Shirokiy.
Andrey Turetskiy [Sat, 20 Feb 2016 12:56:04 +0000 (12:56 +0000)]
[CMake] Add partial support for MSVC in compiler-rt builtins, by Roman Shirokiy.

This enables MSVC build of complex number arithmetic compiler-rt builtins.

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

llvm-svn: 261432

8 years ago[clang-tidy] Describe modules, link to LLVM development docs, other minor updates
Alexander Kornienko [Sat, 20 Feb 2016 11:42:13 +0000 (11:42 +0000)]
[clang-tidy] Describe modules, link to LLVM development docs, other minor updates

llvm-svn: 261431

8 years agoWhen MemoryDependenceAnalysis hits a CFG with many transparent blocks,
Joerg Sonnenberger [Sat, 20 Feb 2016 11:24:44 +0000 (11:24 +0000)]
When MemoryDependenceAnalysis hits a CFG with many transparent blocks,
the algorithm easily degrades into quadratic memory and time complexity.
The easiest example is a long chain of BBs that don't otherwise use a
location. The caching will add an entry for every intermediate block and
limiting the number of results doesn't help as no results are produced
until a definition is found.

Introduce a limit similar to the existing instructions-per-block limit.
This limit counts the total number of blocks checked. If the limit is
reached, entries are considered unknown. The initial value is 1000,
which avoids regressions for normal sized functions while still
limiting edge cases to reasnable memory consumption and execution time.

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

llvm-svn: 261430

8 years ago[X86] Enable the LEA optimization pass by default.
Andrey Turetskiy [Sat, 20 Feb 2016 11:11:55 +0000 (11:11 +0000)]
[X86] Enable the LEA optimization pass by default.

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

llvm-svn: 261429

8 years ago[X86] PR26575: Fix LEA optimization pass (Part 2).
Andrey Turetskiy [Sat, 20 Feb 2016 10:58:28 +0000 (10:58 +0000)]
[X86] PR26575: Fix LEA optimization pass (Part 2).

Handle address displacement operands of a type other than Immediate or Global in LEAs and load/stores.

Ref: https://llvm.org/bugs/show_bug.cgi?id=26575

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

llvm-svn: 261428

8 years ago[SimplifyCFG] Use pointer identity to simplify predicate.
Benjamin Kramer [Sat, 20 Feb 2016 10:40:42 +0000 (10:40 +0000)]
[SimplifyCFG] Use pointer identity to simplify predicate.

No functional change intended.

llvm-svn: 261427

8 years ago[LVI] Move ConstantRanges instead of copying.
Benjamin Kramer [Sat, 20 Feb 2016 10:40:34 +0000 (10:40 +0000)]
[LVI] Move ConstantRanges instead of copying.

No functional change intended. Copying small (<= 64 bits) APInts isn't
expensive but bloats code by generating the slow path everywhere. Moving
doesn't care about the size of the value.

llvm-svn: 261426

8 years ago[MSVC Compat] Implement -EHc semantics
David Majnemer [Sat, 20 Feb 2016 09:23:47 +0000 (09:23 +0000)]
[MSVC Compat] Implement -EHc semantics

The -EHc flag implicitly adds a nothrow attribute to any extern "C"
function when exceptions are enabled.

llvm-svn: 261425

8 years ago[MSVC Compat] Add support for /GX, /GX-
David Majnemer [Sat, 20 Feb 2016 09:23:44 +0000 (09:23 +0000)]
[MSVC Compat] Add support for /GX, /GX-

These are legacy flags which map to /EHsc and /EHs-c- respectively.

llvm-svn: 261424

8 years agoRemove -fnew-ms-eh
David Majnemer [Sat, 20 Feb 2016 09:23:41 +0000 (09:23 +0000)]
Remove -fnew-ms-eh

This flag no longer controls any behavior inside of clang.

llvm-svn: 261423

8 years agoFix handling of vaargs on PPC32 when going from regsave to overflow.
Roman Divacky [Sat, 20 Feb 2016 08:31:24 +0000 (08:31 +0000)]
Fix handling of vaargs on PPC32 when going from regsave to overflow.

It can happen that when we only have 1 more register left in the regsave
area we need to store a value bigger than 1 register and therefore we
go to the overflow area. In this case we have to leave the last slot
in the regsave area unused and keep using overflow area. Do this
by storing a limit value to the used register counter in the overflow block.

Issue diagnosed by and solution tested by Mark Millard!

llvm-svn: 261422

8 years agoRename <__hash_table> traits so they don't conflict with similar traits.
Eric Fiselier [Sat, 20 Feb 2016 07:59:16 +0000 (07:59 +0000)]
Rename <__hash_table> traits so they don't conflict with similar traits.

In particular <__tree> defines many of the same types of traits classes.

llvm-svn: 261421

8 years agoMove some code from doInitialization to runOnFunction
David Majnemer [Sat, 20 Feb 2016 07:34:21 +0000 (07:34 +0000)]
Move some code from doInitialization to runOnFunction

This has no observable behavior change, it just makes the state
insertion pass look a little more like normal passes.

llvm-svn: 261420

8 years agoRemove all usages of "const" node pointer typedefs in the assoc containers.
Eric Fiselier [Sat, 20 Feb 2016 07:12:17 +0000 (07:12 +0000)]
Remove all usages of "const" node pointer typedefs in the assoc containers.

The "const" pointer typedefs such as "__node_const_pointer" and
"__node_base_const_pointer" are identical to their non-const pointer types.
This patch changes all usages of "const" pointer type names to their respective
non-const typedef.

Since "fancy pointers to const" cannot be converted back to a non-const pointer
type according to the allocator requirements it is important that we never
actually use "const" pointers.

Furthermore since "__node_const_pointer" and "__node_pointer" already
name the same type, it's very confusing to use both names. Especially
when defining const/non-const overloads for member functions.

llvm-svn: 261419

8 years ago[X86] Remove some unused encoding checks from the disassembler table building.
Craig Topper [Sat, 20 Feb 2016 06:20:21 +0000 (06:20 +0000)]
[X86] Remove some unused encoding checks from the disassembler table building.

llvm-svn: 261418

8 years ago[X86] Add some missing reversed forms of XOP instructions.
Craig Topper [Sat, 20 Feb 2016 06:20:17 +0000 (06:20 +0000)]
[X86] Add some missing reversed forms of XOP instructions.

llvm-svn: 261417

8 years agoCleanup node-type handling in the associative containers.
Eric Fiselier [Sat, 20 Feb 2016 05:28:30 +0000 (05:28 +0000)]
Cleanup node-type handling in the associative containers.

This patch is very similar to r260431.

This patch is the first in a series of patches that's meant to better
support map. map has a special "value_type" that
differs from pair<const Key, Value>. In order to meet the EmplaceConstructible
and CopyInsertable requirements we need to teach __tree about this
special value_type.

This patch creates a "__tree_node_types" traits class that contains
all of the typedefs needed by the associative containers and their iterators.
These typedefs include ones for each node type and  node pointer type,
as well as special typedefs for "map"'s value type.

Although the associative containers already supported incomplete types, this
patch makes it official by adding tests.

This patch will be followed up shortly with various cleanups within __tree and
fixes for various map bugs and problems.

llvm-svn: 261416

8 years ago[OPENMP 4.5] Initial support for data members in 'lastprivate' clause.
Alexey Bataev [Sat, 20 Feb 2016 04:09:36 +0000 (04:09 +0000)]
[OPENMP 4.5] Initial support for data members in 'lastprivate' clause.

OpenMP 4.5 allows to privatize non-static data members of current class
in non-static member functions. Patch adds initial support for data
members.

llvm-svn: 261412

8 years ago[PM/AA] Wire up TBAA to the new pass manager's registry and test it.
Chandler Carruth [Sat, 20 Feb 2016 04:04:52 +0000 (04:04 +0000)]
[PM/AA] Wire up TBAA to the new pass manager's registry and test it.

llvm-svn: 261411

8 years ago[PM/AA] Wire up the scoped-no-alias AA to the new pass manager's
Chandler Carruth [Sat, 20 Feb 2016 04:03:06 +0000 (04:03 +0000)]
[PM/AA] Wire up the scoped-no-alias AA to the new pass manager's
registry and test it.

llvm-svn: 261410

8 years ago[PM/AA] Wire up SCEVAA to the new pass manager's registry and test it.
Chandler Carruth [Sat, 20 Feb 2016 04:01:45 +0000 (04:01 +0000)]
[PM/AA] Wire up SCEVAA to the new pass manager's registry and test it.

llvm-svn: 261409

8 years agoMachineCopyPropagation: Introduce Reg2MIMap typedef; NFC
Matthias Braun [Sat, 20 Feb 2016 03:56:41 +0000 (03:56 +0000)]
MachineCopyPropagation: Introduce Reg2MIMap typedef; NFC

llvm-svn: 261408

8 years agoMachineCopyPropagation: Move variables from function to pass
Matthias Braun [Sat, 20 Feb 2016 03:56:39 +0000 (03:56 +0000)]
MachineCopyPropagation: Move variables from function to pass

This avoids unnecessarily passing them around when calling helper
functions. It may also be slightly faster to call clear() on the
datastructures instead of freshly initializing them for each block.

llvm-svn: 261407

8 years agoMachineCopyPropagation: Use ranged for, cleanup; NFC
Matthias Braun [Sat, 20 Feb 2016 03:56:36 +0000 (03:56 +0000)]
MachineCopyPropagation: Use ranged for, cleanup; NFC

llvm-svn: 261406

8 years agoMachineCopyPropagation: Use assert() instead of if{report_error()} for 'impossible...
Matthias Braun [Sat, 20 Feb 2016 03:56:33 +0000 (03:56 +0000)]
MachineCopyPropagation: Use assert() instead of if{report_error()} for 'impossible' condition

llvm-svn: 261405

8 years ago[PM/AA] Wire up CFLAA to the new pass manager fully, and port one of its
Chandler Carruth [Sat, 20 Feb 2016 03:52:02 +0000 (03:52 +0000)]
[PM/AA] Wire up CFLAA to the new pass manager fully, and port one of its
tests over to exercise this code.

This uncovered a few missing bits here and there in the analysis, but
nothing interesting.

llvm-svn: 261404

8 years ago[PM/AA] Port alias analysis evaluator to the new pass manager, and use
Chandler Carruth [Sat, 20 Feb 2016 03:46:03 +0000 (03:46 +0000)]
[PM/AA] Port alias analysis evaluator to the new pass manager, and use
it to actually test the new pass manager AA wiring.

This patch was extracted from the (somewhat too large) D12357 and
rebosed on top of the slightly different design of the new pass manager
AA wiring that I just landed. With this we can start testing the AA in
a thorough way with the new pass manager.

Some minor cleanups to the code in the pass was necessitated here, but
otherwise it is a very minimal change.

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

llvm-svn: 261403

8 years agoAdd more isl object printing functions
Hongbin Zheng [Sat, 20 Feb 2016 03:40:19 +0000 (03:40 +0000)]
Add more isl object printing functions

llvm-svn: 261402

8 years agoAssign meaningful name to MemoryAccess. NFC
Hongbin Zheng [Sat, 20 Feb 2016 03:40:15 +0000 (03:40 +0000)]
Assign meaningful name to MemoryAccess. NFC

Now the name of MemoryAccess is <StatementName>_[Read|Write|MayWrite]<Number>_<BaseName>,
e.g. Stmt_for_body_4_Read0_MemRef_A

llvm-svn: 261401

8 years agofixing msvc warning.
Mike Aizatsky [Sat, 20 Feb 2016 02:11:49 +0000 (02:11 +0000)]
fixing msvc warning.

llvm-svn: 261396

8 years ago[SCEV] Don't spell `SCEV *` variables as `Scev`; NFC
Sanjoy Das [Sat, 20 Feb 2016 01:59:15 +0000 (01:59 +0000)]
[SCEV] Don't spell `SCEV *` variables as `Scev`; NFC

I missed a spot in rL261393.

llvm-svn: 261395

8 years ago[SCEV] Don't spell `SCEV *` variables as `Scev`; NFC
Sanjoy Das [Sat, 20 Feb 2016 01:44:10 +0000 (01:44 +0000)]
[SCEV] Don't spell `SCEV *` variables as `Scev`; NFC

It reads odd since most other places name a `SCEV *` as `S`.  Pure
renaming change.

llvm-svn: 261393

8 years ago[SCEV] Don't use std::make_pair; NFC
Sanjoy Das [Sat, 20 Feb 2016 01:35:56 +0000 (01:35 +0000)]
[SCEV] Don't use std::make_pair; NFC

`{A, B}` reads cleaner than `std::make_pair(A, B)`.

llvm-svn: 261392

8 years agoWork around GCC bug in .fail.cpp tests
Eric Fiselier [Sat, 20 Feb 2016 01:11:55 +0000 (01:11 +0000)]
Work around GCC bug in .fail.cpp tests

llvm-svn: 261391

8 years ago[SimplifyCFG] Merge together cleanuppads
David Majnemer [Sat, 20 Feb 2016 01:07:45 +0000 (01:07 +0000)]
[SimplifyCFG] Merge together cleanuppads

Cleanuppads may be merged together if one is the only predecessor of the
other in which case a simple transform can be performed: replace the
a cleanupret with a branch and remove an unnecessary cleanuppad.

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

llvm-svn: 261390

8 years agoFix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files...
Eugene Zelenko [Sat, 20 Feb 2016 00:58:29 +0000 (00:58 +0000)]
Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.

llvm-svn: 261389

8 years agoRemove a duplicate declaration specifier from _ReadBarrier
David Majnemer [Sat, 20 Feb 2016 00:57:00 +0000 (00:57 +0000)]
Remove a duplicate declaration specifier from _ReadBarrier

This fixes PR26675.

llvm-svn: 261388

8 years ago[X86ISelLowering] Fix TLSADDR lowering when shrink-wrapping is enabled.
Davide Italiano [Sat, 20 Feb 2016 00:44:47 +0000 (00:44 +0000)]
[X86ISelLowering] Fix TLSADDR lowering when shrink-wrapping is enabled.

TLSADDR nodes are lowered into actuall calls inside MC. In order to prevent
shrink-wrapping from pushing prologue/epilogue past them (which result
in TLS variables being accessed before the stack frame is set up), we
put markers, so that the stack gets adjusted properly.
Thanks to Quentin Colombet for guidance/help on how to fix this problem!

llvm-svn: 261387

8 years agoAMDGPU/SI: Use v_readfirstlane to legalize SMRD with VGPR base pointer
Tom Stellard [Sat, 20 Feb 2016 00:37:25 +0000 (00:37 +0000)]
AMDGPU/SI: Use v_readfirstlane to legalize SMRD with VGPR base pointer

Summary:
Instead of trying to replace SMRD instructions with a VGPR base pointer
with an equivalent MUBUF instruction, we now copy the base pointer to
SGPRs using v_readfirstlane.

This is safe to do, because any load selected as an SMRD instruction
has been proven to have a uniform base pointer, so each thread in the
wave will have the same pointer value in VGPRs.

This will fix some errors on VI from trying to replace SMRD instructions
with addr64-enabled MUBUF instructions that don't exist.

Reviewers: arsenm, cfang, nhaehnle

Subscribers: arsenm, llvm-commits

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

llvm-svn: 261385

8 years ago[RegAllocFast] Properly track the physical register definitions on calls.
Quentin Colombet [Sat, 20 Feb 2016 00:32:29 +0000 (00:32 +0000)]
[RegAllocFast] Properly track the physical register definitions on calls.

PR26485

llvm-svn: 261384

8 years agoFix PR26622 - Make CheckLibcxxAtomic.cmake use the libc++ headers.
Eric Fiselier [Sat, 20 Feb 2016 00:24:43 +0000 (00:24 +0000)]
Fix PR26622 - Make CheckLibcxxAtomic.cmake use the libc++ headers.

llvm-svn: 261383

8 years agoMake __wrap_iter work with GCC again
Eric Fiselier [Sat, 20 Feb 2016 00:19:45 +0000 (00:19 +0000)]
Make __wrap_iter work with GCC again

Summary:
This bug was originally fixed in http://reviews.llvm.org/D7201.

However it was broken again by the fix to https://llvm.org/bugs/show_bug.cgi?id=22605.

This patch re-fixes __wrap_iter with GCC by providing a forward declaration of <vector> before the friend declaration in __wrap_iter.
This patch avoids the issues in PR22605 by putting canonical forward declarations in <iosfwd> and including <iosfwd> in <vector>.

<iosfwd> was chosen as the canonical forward declaration headers for the following reasons:

1. `<iosfwd>` is small with almost no dependancies.
2. It already forward declares `std::allocator`
3. It is already included in `<iterator>` which we need to fix the GCC bug.

This patch fixes the test "gcc_workaround.pass.cpp"

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 261382

8 years agoAdd stdbool.h wrapper for libc++
Eric Fiselier [Sat, 20 Feb 2016 00:16:41 +0000 (00:16 +0000)]
Add stdbool.h wrapper for libc++

Summary:
According to the C++ standard <stdbool.h> isn't allowed to define `true` `false` or `bool`. However these macros are sometimes defined by the compilers `stdbool.h`.

Clang defines the macros whenever `__STRICT_ANSI__` isn't defined (ie `-std=gnu++11`).
New GCC versions define the macros in C++03 mode only, older GCC versions (4.9 and before) always define the macros.

This patch adds a wrapper header for `stdbool.h` that undefs the required macros.

Reviewers: mclow.lists, rsmith, EricWF

Subscribers: cfe-commits

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

llvm-svn: 261381

8 years ago[codeview] Fix emission of file changes in inline line tables
Reid Kleckner [Fri, 19 Feb 2016 23:55:38 +0000 (23:55 +0000)]
[codeview] Fix emission of file changes in inline line tables

These are supposed to be file checksum table offsets, not file ids.

llvm-svn: 261379

8 years ago[CMake] Adding a CMake cache file that matches Apple's build configs
Chris Bieneman [Fri, 19 Feb 2016 22:59:18 +0000 (22:59 +0000)]
[CMake] Adding a CMake cache file that matches Apple's build configs

This should have no impact on anyone, but we're going to use it from GreenDragon to make our builders match what we ship.

llvm-svn: 261377

8 years ago[sancov] use GetLoadedModules for list of modules rather than sanitizer's list.
Mike Aizatsky [Fri, 19 Feb 2016 22:55:21 +0000 (22:55 +0000)]
[sancov] use GetLoadedModules for list of modules rather than sanitizer's list.

llvm-svn: 261376

8 years ago[sancov] sanitizer html report cosmetic improvements.
Mike Aizatsky [Fri, 19 Feb 2016 22:55:08 +0000 (22:55 +0000)]
[sancov] sanitizer html report cosmetic improvements.

llvm-svn: 261375

8 years agoHandle undef symbols in LTO.
Rafael Espindola [Fri, 19 Feb 2016 22:50:16 +0000 (22:50 +0000)]
Handle undef symbols in LTO.

This also handles bc files is archives.

llvm-svn: 261374

8 years ago[modules] Do less scanning of macro definition chains when computing the set of
Richard Smith [Fri, 19 Feb 2016 22:43:58 +0000 (22:43 +0000)]
[modules] Do less scanning of macro definition chains when computing the set of
exported module macros outside local submodule visibility mode. Related to
PR24667.

llvm-svn: 261373

8 years ago[modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single
Richard Smith [Fri, 19 Feb 2016 22:25:36 +0000 (22:25 +0000)]
[modules] Flatten -fmodule-name= and -fmodule-implementation-of= into a single
option. Previously these options could both be used to specify that you were
compiling the implementation file of a module, with a different set of minor
bugs in each case.

This change removes -fmodule-implementation-of, and instead tracks a flag to
determine whether we're currently building a module. -fmodule-name now behaves
the same way that -fmodule-implementation-of previously did.

llvm-svn: 261372

8 years ago[X86ISelLowering] Provide a more informative assert message.
Davide Italiano [Fri, 19 Feb 2016 22:18:49 +0000 (22:18 +0000)]
[X86ISelLowering] Provide a more informative assert message.

I stumbled upon this while debugging a lowering bug.

llvm-svn: 261371

8 years ago[X86ISelLowering] Merge two conditions inside a single if.
Davide Italiano [Fri, 19 Feb 2016 22:01:07 +0000 (22:01 +0000)]
[X86ISelLowering] Merge two conditions inside a single if.

llvm-svn: 261370

8 years agoRevert r255691 "[LoopVectorizer] Refine loop vectorizer's register usage calculator...
Hans Wennborg [Fri, 19 Feb 2016 21:40:12 +0000 (21:40 +0000)]
Revert r255691 "[LoopVectorizer] Refine loop vectorizer's register usage calculator by ignoring specific instructions."

It caused PR26509.

llvm-svn: 261368

8 years agoRevert r253557 "Alternative to long nops for X86 CPUs, by Andrey Turetsky"
Hans Wennborg [Fri, 19 Feb 2016 21:26:31 +0000 (21:26 +0000)]
Revert r253557 "Alternative to long nops for X86 CPUs, by Andrey Turetsky"

Turns out the new nop sequences aren't actually nops on x86_64 (PR26554).

llvm-svn: 261365

8 years agollvm-dwp: Improve performance (N^2 to amortized N) by using a MapVector instead of...
David Blaikie [Fri, 19 Feb 2016 21:09:26 +0000 (21:09 +0000)]
llvm-dwp: Improve performance (N^2 to amortized N) by using a MapVector instead of linear searches through a vector

Figured this would be a problem, but didn't want to jump the gun - large
inputs demonstrate it pretty easily (mostly for type units, but might as
well do the same for CUs too). A random sample 6m27s -> 27s change.

Also, by checking this up-front for CUs (rather than when building the
cu_index) we can probably provide better error messages (see FIXMEs),
hopefully providing the name of the CUs rather than just their
signature.

llvm-svn: 261364

8 years ago[sancov] requiring dynamic asan.
Mike Aizatsky [Fri, 19 Feb 2016 20:47:25 +0000 (20:47 +0000)]
[sancov] requiring dynamic asan.

llvm-svn: 261362

8 years agominor test runline cleanup
Xinliang David Li [Fri, 19 Feb 2016 20:28:51 +0000 (20:28 +0000)]
minor test runline cleanup

llvm-svn: 261361

8 years agoFix incorrect selection of AVX512 sqrt when OptForSize is on
Dimitry Andric [Fri, 19 Feb 2016 20:14:11 +0000 (20:14 +0000)]
Fix incorrect selection of AVX512 sqrt when OptForSize is on

Summary:
When optimizing for size, sqrt calls can be incorrectly selected as
AVX512 VSQRT instructions.  This is because X86InstrAVX512.td has a
`Requires<[OptForSize]>` in its `avx512_sqrt_scalar` multiclass
definition.  Even if the target does not support AVX512, the class can
apparently still be chosen, leading to an incorrect selection of
`vsqrtss`.

In PR26625, this lead to an assertion: Reg >= X86::FP0 && Reg <=
X86::FP6 && "Expected FP register!", because the `vsqrtss` instruction
requires an XMM register, which is not available on i686 CPUs.

Reviewers: grosbach, resistor, joker.eph

Subscribers: spatel, emaste, llvm-commits

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

llvm-svn: 261360

8 years ago[StatepointLowering] Minor non-semantic cleanups
Sanjoy Das [Fri, 19 Feb 2016 19:37:07 +0000 (19:37 +0000)]
[StatepointLowering] Minor non-semantic cleanups

Use auto, bring file up to coding standards etc.

llvm-svn: 261358

8 years agoFix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files...
Eugene Zelenko [Fri, 19 Feb 2016 19:33:46 +0000 (19:33 +0000)]
Fix Clang-tidy modernize-use-nullptr and modernize-use-default warnings in some files in source/Commands; other minor fixes.

llvm-svn: 261356

8 years agoRemove expectedFailureFreeBSD decorator
Ed Maste [Fri, 19 Feb 2016 19:25:03 +0000 (19:25 +0000)]
Remove expectedFailureFreeBSD decorator

All invocations are updated to use the generic expectedFailureAll.

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

llvm-svn: 261355

8 years ago[WebAssembly] Add another optimization idea to README.txt.
Dan Gohman [Fri, 19 Feb 2016 19:22:44 +0000 (19:22 +0000)]
[WebAssembly] Add another optimization idea to README.txt.

llvm-svn: 261354

8 years agoDon't use an atexit handler for cleaning up the temp directory.
Zachary Turner [Fri, 19 Feb 2016 19:20:44 +0000 (19:20 +0000)]
Don't use an atexit handler for cleaning up the temp directory.

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

llvm-svn: 261353

8 years ago[sancov] using static asan
Mike Aizatsky [Fri, 19 Feb 2016 18:46:30 +0000 (18:46 +0000)]
[sancov] using static asan

We are not able to recover coverage points from dynamically linked
binaries at this point without symbols in @plt tables.

llvm-svn: 261352

8 years ago[OpenCL] Generate metadata for opencl_unroll_hint attribute
Anastasia Stulova [Fri, 19 Feb 2016 18:30:11 +0000 (18:30 +0000)]
[OpenCL] Generate metadata for opencl_unroll_hint attribute

Add support for opencl_unroll_hint attribute from OpenCL v2.0 s6.11.5.

Reusing most of metadata generation from CGLoopInfo helper class.

The code is based on Khronos OpenCL compiler:
https://github.com/KhronosGroup/SPIR/tree/spirv-1.0

Patch by Liu Yaxun (Sam)!

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

llvm-svn: 261350

8 years ago[AArch64][ShrinkWrap] Fix bug in prolog clobbering live reg when shrink wrapping.
Geoff Berry [Fri, 19 Feb 2016 18:27:32 +0000 (18:27 +0000)]
[AArch64][ShrinkWrap] Fix bug in prolog clobbering live reg when shrink wrapping.

Summary: See bug https://llvm.org/bugs/show_bug.cgi?id=26642

Reviewers: qcolombet, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

llvm-svn: 261349

8 years ago[StatepointLowering] Update StatepointMaxSlotsRequired correctly
Sanjoy Das [Fri, 19 Feb 2016 18:15:56 +0000 (18:15 +0000)]
[StatepointLowering] Update StatepointMaxSlotsRequired correctly

Now that we don't always add an element to AllocatedStackSlots if we
don't find a pre-existing unallocated stack slot, bumping
StatepointMaxSlotsRequired to `NumSlots + 1` is not correct.  Instead
bump the statistic near the push_back, to
Builder.FuncInfo.StatepointStackSlots.size().

llvm-svn: 261348

8 years ago[StatepointLowering] Fix a mistake in rL261336
Sanjoy Das [Fri, 19 Feb 2016 18:15:53 +0000 (18:15 +0000)]
[StatepointLowering] Fix a mistake in rL261336

The check on MFI->getObjectSize() has to be on the FrameIndex, not on
the index of the FrameIndex in AllocatedStackSlots.  Weirdly, the tests
I added in rL261336 didn't catch this.

llvm-svn: 261347