platform/upstream/llvm.git
9 years agoIntroduce SPIR calling conventions.
Sameer Sahasrabuddhe [Tue, 20 Jan 2015 06:44:32 +0000 (06:44 +0000)]
Introduce SPIR calling conventions.

This implements Section 3.7 from the SPIR 1.2 spec:

    SPIR kernels should use "spir_kernel" calling convention.
    Non-kernel functions use "spir_func" calling convention. All
    other calling conventions are disallowed.

The patch works only for OpenCL source. Any other uses will need
to ensure that kernels are assigned the spir_kernel calling
convention correctly.

llvm-svn: 226548

9 years agoFix Operandreorder logic in SLPVectorizer to generate longer vectorizable chain.
Karthik Bhat [Tue, 20 Jan 2015 06:11:00 +0000 (06:11 +0000)]
Fix Operandreorder logic in SLPVectorizer to generate longer vectorizable chain.
This patch fixes 2 issues in reorderInputsAccordingToOpcode
1) AllSameOpcodeLeft and AllSameOpcodeRight was being calculated incorrectly resulting in code not being vectorized in few cases.
2) Adds logic to reorder operands if we get longer chain of consecutive loads enabling vectorization. Handled the same for cases were we have AltOpcode.
Thanks Michael for inputs and review.
Review: http://reviews.llvm.org/D6677

llvm-svn: 226547

9 years agoBitcode: Don't create comdats when autoupgrading macho bitcode
David Majnemer [Tue, 20 Jan 2015 05:58:07 +0000 (05:58 +0000)]
Bitcode: Don't create comdats when autoupgrading macho bitcode

Don't infer COMDAT groups from older bitcode if the target is macho,
it doesn't have COMDATs.

llvm-svn: 226546

9 years agoReapply "IR: Simplify DIBuilder's HeaderBuilder API, NFC"
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 05:02:42 +0000 (05:02 +0000)]
Reapply "IR: Simplify DIBuilder's HeaderBuilder API, NFC"

This reverts commit r226542, effectively reapplying r226540.  This time,
initialize `IsEmpty` in the copy and move constructors as well.

llvm-svn: 226545

9 years agoFix creation of StringRef in FileSpec::ResolveUsername()
Jason Molenda [Tue, 20 Jan 2015 04:20:42 +0000 (04:20 +0000)]
Fix creation of StringRef in FileSpec::ResolveUsername()
so it doesn't assume that the SmallVector<char> will have
nul terminator.  It did not in at least one case.
Caught by ASAN instrumentation.

llvm-svn: 226544

9 years agoDon't mention a "--core-file" argument to target create. It is
Jason Molenda [Tue, 20 Jan 2015 03:06:17 +0000 (03:06 +0000)]
Don't mention a "--core-file" argument to target create.  It is
"--core".

<rdar://problem/19518164>

llvm-svn: 226543

9 years agoRevert "IR: Simplify DIBuilder's HeaderBuilder API, NFC"
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 03:01:27 +0000 (03:01 +0000)]
Revert "IR: Simplify DIBuilder's HeaderBuilder API, NFC"

This reverts commit r226540, since I hit an unexpected bot failure [1].
I'll investigate.

[1]: http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/20244

llvm-svn: 226542

9 years agoIR: Move MDNode clone() methods from ValueMapper to MDNode, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 02:56:57 +0000 (02:56 +0000)]
IR: Move MDNode clone() methods from ValueMapper to MDNode, NFC

Now that the clone methods used by `MapMetadata()` don't do any
remapping (and return a temporary), they make more sense as member
functions on `MDNode` (and subclasses).

llvm-svn: 226541

9 years agoIR: Simplify DIBuilder's HeaderBuilder API, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 02:54:07 +0000 (02:54 +0000)]
IR: Simplify DIBuilder's HeaderBuilder API, NFC

Change `HeaderBuilder` API to work well even when it's not starting with
a tag.  There's already one case like this, and the tag is moving
elsewhere as part of PR22235.

llvm-svn: 226540

9 years agoAsmParser: PARSE_MD_FIELD() => ParseMDField(), NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 02:42:29 +0000 (02:42 +0000)]
AsmParser: PARSE_MD_FIELD() => ParseMDField(), NFC

Extract most of `PARSE_MD_FIELD()` into a function.

llvm-svn: 226539

9 years agoAsmParser: Refactor duplicate code, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 02:39:21 +0000 (02:39 +0000)]
AsmParser: Refactor duplicate code, NFC

llvm-svn: 226538

9 years ago[PM] Replace the Pass argument in MergeBasicBlockIntoOnlyPred with
Chandler Carruth [Tue, 20 Jan 2015 01:37:09 +0000 (01:37 +0000)]
[PM] Replace the Pass argument in MergeBasicBlockIntoOnlyPred with
a DominatorTree argument as that is the analysis that it wants to
update.

This removes the last non-loop utility function in Utils/ which accepts
a raw Pass argument.

llvm-svn: 226537

9 years agoIR: Delete GenericDwarfNode during teardown
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 01:18:32 +0000 (01:18 +0000)]
IR: Delete GenericDwarfNode during teardown

Fix a leak in `LLVMContextImpl` teardown that the leak sanitizer tracked
down [1].  I've just switched to automatic dispatch here (since I'll
inevitably forget again with the next class).

[1]: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/811/steps/check-llvm%20asan/logs/stdio

llvm-svn: 226536

9 years agoBitcode: Simplify MDNode subclass dispatch, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 01:03:09 +0000 (01:03 +0000)]
Bitcode: Simplify MDNode subclass dispatch, NFC

llvm-svn: 226535

9 years agoBitcode: WriteMDNode() => WriteMDTuple(), NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 01:01:53 +0000 (01:01 +0000)]
Bitcode: WriteMDNode() => WriteMDTuple(), NFC

llvm-svn: 226534

9 years agoBitcode: Add ValueEnumerator::getMetadataOrNullID(), NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 01:00:23 +0000 (01:00 +0000)]
Bitcode: Add ValueEnumerator::getMetadataOrNullID(), NFC

llvm-svn: 226533

9 years agoIR: Canonicalize GenericDwarfNode empty headers to null
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 00:58:46 +0000 (00:58 +0000)]
IR: Canonicalize GenericDwarfNode empty headers to null

llvm-svn: 226532

9 years agoIR: Detect whether to call recalculateHash() via SFINAE, NFC
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 00:57:33 +0000 (00:57 +0000)]
IR: Detect whether to call recalculateHash() via SFINAE, NFC

Rather than relying on updating switch statements correctly, detect
whether `setHash()` exists in the subclass.  If so, call
`recalculateHash()` and `setHash(0)` appropriately.

llvm-svn: 226531

9 years agoAdded an Xcode target so we build the "lldb-mi" executable as part of the "desktop...
Greg Clayton [Tue, 20 Jan 2015 00:04:26 +0000 (00:04 +0000)]
Added an Xcode target so we build the "lldb-mi" executable as part of the "desktop" and "desktop no xpc" targets.

Include paths were switched to be user include paths, if this breaks the linux build we will need to fix the Makefiles/cmake stuff.

<rdar://problem/19198581>

llvm-svn: 226530

9 years agoIR: Introduce GenericDwarfNode
Duncan P. N. Exon Smith [Tue, 20 Jan 2015 00:01:43 +0000 (00:01 +0000)]
IR: Introduce GenericDwarfNode

As part of PR22235, introduce `DwarfNode` and `GenericDwarfNode`.  The
former is a metadata node with a DWARF tag.  The latter matches our
current (generic) schema of a header with string (and stringified
integer) data and an arbitrary number of operands.

This doesn't move it into place yet; that change will require a large
number of testcase updates.

llvm-svn: 226529

9 years agoFix a race condition where you could set the selected thread & target in the
Jim Ingham [Mon, 19 Jan 2015 23:51:51 +0000 (23:51 +0000)]
Fix a race condition where you could set the selected thread & target in the
CommandInterpreter's execution context AFTER the process had started running
and before it initially stopped.  Also fixed one test case that was implicitly
using this (and an abuse of the async mode) to accidentally succeed.

<rdar://problem/16814726>

llvm-svn: 226528

9 years agoAsmParser: Abstract more of MDLocation parser, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:44:41 +0000 (23:44 +0000)]
AsmParser: Abstract more of MDLocation parser, NFC

llvm-svn: 226527

9 years agoAsmParser: Split up ParseMDFieldsImpl(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:39:32 +0000 (23:39 +0000)]
AsmParser: Split up ParseMDFieldsImpl(), NFC

llvm-svn: 226526

9 years ago[dsymutil] Add the detected target triple to the debug map.
Frederic Riss [Mon, 19 Jan 2015 23:33:14 +0000 (23:33 +0000)]
[dsymutil] Add the detected target triple to the debug map.

It will be needed to instantiate the Target object that we will
use to create all the MC objects for the dwarf emission.

llvm-svn: 226525

9 years agoAsmParser: Fix error location for missing fields
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:32:36 +0000 (23:32 +0000)]
AsmParser: Fix error location for missing fields

llvm-svn: 226524

9 years agoIR: Cleanup MDNode field use, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:18:34 +0000 (23:18 +0000)]
IR: Cleanup MDNode field use, NFC

Swap usage of `SubclassData32` and `MDNodeSubclassData`, and rename
`MDNodeSubclassData` to `NumUnresolved`.  Small drive-by cleanup to
`countUnresolvedOperands()` since otherwise the name clash with local
vars named `NumUnresolved` would be confusing.

llvm-svn: 226523

9 years agoIR: Move replaceWithUniqued(), etc., to source file, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:17:09 +0000 (23:17 +0000)]
IR: Move replaceWithUniqued(), etc., to source file, NFC

llvm-svn: 226522

9 years agoIR: Cleanup MDNode::MDNode(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:15:21 +0000 (23:15 +0000)]
IR: Cleanup MDNode::MDNode(), NFC

llvm-svn: 226521

9 years agoIR: Merge UniquableMDNode back into MDNode, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 23:13:14 +0000 (23:13 +0000)]
IR: Merge UniquableMDNode back into MDNode, NFC

As pointed out in r226501, the distinction between `MDNode` and
`UniquableMDNode` is confusing.  When we need subclasses of `MDNode`
that don't use all its functionality it might make sense to break it
apart again, but until then this makes the code clearer.

llvm-svn: 226520

9 years agoIR: Extract MDNodeOpsKey, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:53:18 +0000 (22:53 +0000)]
IR: Extract MDNodeOpsKey, NFC

Make the MDTuple operand hashing logic reusable.

llvm-svn: 226519

9 years agoIR: Simplify uniquifyImpl(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:52:07 +0000 (22:52 +0000)]
IR: Simplify uniquifyImpl(), NFC

llvm-svn: 226518

9 years agoIR: Simplify erasing from uniquing store, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:47:08 +0000 (22:47 +0000)]
IR: Simplify erasing from uniquing store, NFC

llvm-svn: 226517

9 years agoRemove dead code, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:45:41 +0000 (22:45 +0000)]
Remove dead code, NFC

llvm-svn: 226516

9 years agoUtils: Simplify MapMetadata(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:44:32 +0000 (22:44 +0000)]
Utils: Simplify MapMetadata(), NFC

Extract out the operand remapping loops, which are now very similar.

llvm-svn: 226515

9 years agoSkip upcast, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:41:14 +0000 (22:41 +0000)]
Skip upcast, NFC

llvm-svn: 226514

9 years ago[X86][AVX] Missing AVX1 memory folding float instructions
Simon Pilgrim [Mon, 19 Jan 2015 22:40:45 +0000 (22:40 +0000)]
[X86][AVX] Missing AVX1 memory folding float instructions

Now that we can create much more exhaustive X86 memory folding tests, this patch adds the missing AVX1/F16C floating point instruction stack foldings we can easily test for including the scalar intrinsics (add, div, max, min, mul, sub), conversions float/int to double, half precision conversions, rounding, dot product and bit test. The patch also adds a couple of obviously missing SSE instructions (more to follow once we have full SSE testing).

Now that scalar folding is working it broke a very old test (2006-10-07-ScalarSSEMiscompile.ll) - this test appears to make no sense as its trying to ensure that a scalar subtraction isn't folded as it 'would zero the top elts of the loaded vector' - this test just appears to be wrong to me.

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

llvm-svn: 226513

9 years agoFix whitespace, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:40:25 +0000 (22:40 +0000)]
Fix whitespace, NFC

llvm-svn: 226512

9 years agoUtils: Simplify MapMetadata(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:39:07 +0000 (22:39 +0000)]
Utils: Simplify MapMetadata(), NFC

Take advantage of the new ability of temporary nodes to mutate to
distinct and uniqued nodes to greatly simplify the `MapMetadata()`
helper functions.

llvm-svn: 226511

9 years agoIR: Allow temporary nodes to become uniqued or distinct
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:24:52 +0000 (22:24 +0000)]
IR: Allow temporary nodes to become uniqued or distinct

Add `MDNode::replaceWithUniqued()` and `MDNode::replaceWithDistinct()`,
which mutate temporary nodes to become uniqued or distinct.  On uniquing
collisions, the unique version is returned and the node is deleted.

This takes advantage of temporary nodes being folded back in, and should
let me clean up some awkward logic in `MapMetadata()`.

llvm-svn: 226510

9 years agoIR: Remove templates from TempMDNodeDeleter, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:21:15 +0000 (22:21 +0000)]
IR: Remove templates from TempMDNodeDeleter, NFC

r226504 added `TempMDNodeDeleter` to help with `std::unique_ptr<>`-izing
the `MDNode::getTemporary()` interface.  It doesn't need to be
templated, though.

llvm-svn: 226509

9 years agoIR: Split out countUnresolvedOperands(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:18:29 +0000 (22:18 +0000)]
IR: Split out countUnresolvedOperands(), NFC

llvm-svn: 226508

9 years agoCleanup whitespace, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 22:16:01 +0000 (22:16 +0000)]
Cleanup whitespace, NFC

llvm-svn: 226507

9 years agoCodeGen: Update IRBuilder for LLVM API change
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 21:31:48 +0000 (21:31 +0000)]
CodeGen: Update IRBuilder for LLVM API change

`MDNode::getTemporary()` returns a `unique_ptr<>` as of r226504.

llvm-svn: 226506

9 years agoCodeGen: Update LoopAttributes for LLVM API change
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 21:30:48 +0000 (21:30 +0000)]
CodeGen: Update LoopAttributes for LLVM API change

`MDNode::getTemporary()` returns a `unique_ptr<>` as of r226504.

llvm-svn: 226505

9 years agoIR: Return unique_ptr from MDNode::getTemporary()
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 21:30:18 +0000 (21:30 +0000)]
IR: Return unique_ptr from MDNode::getTemporary()

Change `MDTuple::getTemporary()` and `MDLocation::getTemporary()` to
return (effectively) `std::unique_ptr<T, MDNode::deleteTemporary>`, and
clean up call sites.  (For now, `DIBuilder` call sites just call
`release()` immediately.)

There's an accompanying change in each of clang and polly to use the new
API.

llvm-svn: 226504

9 years agoAdd r224985 back with fixes.
Rafael Espindola [Mon, 19 Jan 2015 21:11:14 +0000 (21:11 +0000)]
Add r224985 back with fixes.

The fixes are to note that AArch64 has additional restrictions on when local
relocations can be used. In particular, ld64 requires that relocations to
cstring/cfstrings use linker visible symbols.

Original message:

In an assembly expression like

bar:
  .long L0 + 1

the intended semantics is that bar will contain a pointer one byte past L0.

In sections that are merged by content (strings, 4 byte constants, etc), a
single position in the section doesn't give the linker enough information.
For example, it would not be able to tell a relocation must point to the
end of a string, since that would look just like the start of the next.

The solution used in ELF to use relocation with symbols if there is a non-zero
addend.

In MachO before this patch we would just keep all symbols in some sections.

This would miss some cases (only cstrings on x86_64 were implemented) and was
inefficient since most relocations have an addend of 0 and can be represented
without the symbol.

This patch implements the non-zero addend logic for MachO too.

llvm-svn: 226503

9 years agoIR: Add MDLocation::getTemporary()
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 20:37:44 +0000 (20:37 +0000)]
IR: Add MDLocation::getTemporary()

llvm-svn: 226502

9 years agoIR: Remove MDNodeFwdDecl
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 20:36:39 +0000 (20:36 +0000)]
IR: Remove MDNodeFwdDecl

Remove `MDNodeFwdDecl` (as promised in r226481).  Aside from API
changes, there's no real functionality change here.
`MDNode::getTemporary()` now forwards to `MDTuple::getTemporary()`,
which returns a tuple with `isTemporary()` equal to true.

The main point is that we can now add temporaries of other `MDNode`
subclasses, needed for PR22235 (I introduced `MDNodeFwdDecl` in the
first place because I didn't recognize this need, and thought they were
only needed to handle forward references).

A few things left out of (or highlighted by) this commit:

  - I've had to remove the (few) uses of `std::unique_ptr<>` to deal
    with temporaries, since the destructor is no longer public.
    `getTemporary()` should probably return the equivalent of
    `std::unique_ptr<T, MDNode::deleteTemporary>`.
  - `MDLocation::getTemporary()` doesn't exist yet (worse, it actually
    does exist, but does the wrong thing: `MDNode::getTemporary()` is
    inherited and returns an `MDTuple`).
  - `MDNode` now only has one subclass, `UniquableMDNode`, and the
    distinction between them is actually somewhat confusing.

I'll fix those up next.

llvm-svn: 226501

9 years ago[Hexagon] Updating muxir/ri/ii intrinsics. Setting predicate registers as compatible...
Colin LeMahieu [Mon, 19 Jan 2015 20:31:18 +0000 (20:31 +0000)]
[Hexagon] Updating muxir/ri/ii intrinsics.  Setting predicate registers as compatible with i32 rather than doing custom type conversion.

llvm-svn: 226500

9 years agoIR: Extract out and reuse `storeImpl()`, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 20:18:13 +0000 (20:18 +0000)]
IR: Extract out and reuse `storeImpl()`, NFC

llvm-svn: 226499

9 years agoIR: Extract out getUniqued(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 20:16:50 +0000 (20:16 +0000)]
IR: Extract out getUniqued(), NFC

llvm-svn: 226498

9 years agoIR: Reuse `getImpl()` for `getDistinct()`, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 20:14:15 +0000 (20:14 +0000)]
IR: Reuse `getImpl()` for `getDistinct()`, NFC

Merge `getDistinct()`'s implementation with those of `get()` and
`getIfExists()` for both `MDTuple` and `MDLocation`.  This will make it
easier to scale to supporting temporaries.

llvm-svn: 226497

9 years ago[AVX512] Add sub-vector FP extracts
Adam Nemet [Mon, 19 Jan 2015 20:12:05 +0000 (20:12 +0000)]
[AVX512] Add sub-vector FP extracts

Analogous to AVX2, these need to be implemented as macros to properly
propagate the immediate index operand.

Part of <rdar://problem/17688758>

llvm-svn: 226496

9 years agoIR: Move replaceAllUsesWith() back up to MDNode
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:35:21 +0000 (19:35 +0000)]
IR: Move replaceAllUsesWith() back up to MDNode

Move `MDNodeFwdDecl::replaceAllUsesWith()` back up to `MDNode`, but
assert `isTemporary()`.

llvm-svn: 226495

9 years agoIR: Be specific about what MDNode::get() returns, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:32:27 +0000 (19:32 +0000)]
IR: Be specific about what MDNode::get() returns, NFC

llvm-svn: 226494

9 years agoRemove dead code, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:31:09 +0000 (19:31 +0000)]
Remove dead code, NFC

llvm-svn: 226493

9 years agoIR: Simplify MDNode::setOperand(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:29:25 +0000 (19:29 +0000)]
IR: Simplify MDNode::setOperand(), NFC

llvm-svn: 226492

9 years agoIR: Simplify handleChangedOperand() fast path, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:28:28 +0000 (19:28 +0000)]
IR: Simplify handleChangedOperand() fast path, NFC

Use `isUniqued()` instead of `isStoredDistinctInContext()`, and remove
an assertion that won't be valid once temporaries are merged back in.

llvm-svn: 226491

9 years agoIR: Remove direct comparisons against Metadata::Storage, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:26:24 +0000 (19:26 +0000)]
IR: Remove direct comparisons against Metadata::Storage, NFC

llvm-svn: 226490

9 years agoIR: Assert that resolve() is only called on uniqued nodes, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:25:33 +0000 (19:25 +0000)]
IR: Assert that resolve() is only called on uniqued nodes, NFC

Add an assertion in `UniquableMDNode::resolve()` to prevent temporaries
from being resolved (once they're merged back in).  Needed to shuffle
order of `resolve()` and `storeDistinctInContext()` to prevent it from
firing.

llvm-svn: 226489

9 years agoIR: Remove isa<UniquableMDNode>, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:10:14 +0000 (19:10 +0000)]
IR: Remove isa<UniquableMDNode>, NFC

llvm-svn: 226488

9 years agoIR: Simplify DIBuilder::trackIfUnresolved(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:09:14 +0000 (19:09 +0000)]
IR: Simplify DIBuilder::trackIfUnresolved(), NFC

llvm-svn: 226487

9 years agoIR: Remove isa<MDNodeFwdDecl>, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:06:41 +0000 (19:06 +0000)]
IR: Remove isa<MDNodeFwdDecl>, NFC

llvm-svn: 226486

9 years agoIR: Unify code for MDNode::isResolved(), NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:03:18 +0000 (19:03 +0000)]
IR: Unify code for MDNode::isResolved(), NFC

Unify the definitions of `MDNode::isResolved()` and
`UniquableMDNode::isResolved()`.  Previously, `UniquableMDNode` could
answer this question more efficiently, but now that RAUW support has
been unified with `MDNodeFwdDecl`, `MDNode` doesn't need any casts to
figure out the answer.

llvm-svn: 226485

9 years agoIR: Store RAUW support and Context in the same pointer, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 19:02:06 +0000 (19:02 +0000)]
IR: Store RAUW support and Context in the same pointer, NFC

Add an `LLVMContext &` to `ReplaceableMetadataImpl`, create a class that
either holds a reference to an `LLVMContext` or owns a
`ReplaceableMetadataImpl`, and use the new class in `MDNode`.

  - This saves a pointer in `UniquableMDNode` at the cost of a pointer
    in `ValueAsMetadata` (which didn't used to store the `LLVMContext`).
    There are far more of the former.
  - Unifies RAUW support between `MDNodeFwdDecl` (which is going away,
    see r226481) and `UniquableMDNode`.

llvm-svn: 226484

9 years ago[Hexagon] Converting intrinsics combine imm/imm, simple shifts and extends.
Colin LeMahieu [Mon, 19 Jan 2015 18:56:19 +0000 (18:56 +0000)]
[Hexagon] Converting intrinsics combine imm/imm, simple shifts and extends.

llvm-svn: 226483

9 years agoIR: Add isUniqued() and isTemporary()
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 18:45:35 +0000 (18:45 +0000)]
IR: Add isUniqued() and isTemporary()

Change `MDNode::isDistinct()` to only apply to 'distinct' nodes (not
temporaries), and introduce `MDNode::isUniqued()` and
`MDNode::isTemporary()` for the other two possibilities.

llvm-svn: 226482

9 years agoIR: Use an enum to describe Metadata storage, NFC
Duncan P. N. Exon Smith [Mon, 19 Jan 2015 18:36:18 +0000 (18:36 +0000)]
IR: Use an enum to describe Metadata storage, NFC

More clearly describe the type of storage used for `Metadata`.

  - `Uniqued`: uniqued, stored in the context.
  - `Distinct`: distinct, stored in the context.
  - `Temporary`: not owned by anyone.

This is the first in a series of commits to fix a design problem with
`MDNodeFwdDecl` that I need to solve for PR22235.  While `MDNodeFwdDecl`
works well as a forward declaration, we use `MDNode::getTemporary()` for
more than forward declarations -- we also need to create early versions
of nodes (with fields not filled in) that we'll fill out later (see
`DIBuilder::finalize()` and `CGDebugInfo::finalize()` for examples).
This was a blind spot I had when I introduced `MDNodeFwdDecl` (which
David Blaikie (indirectly) highlighted in an unrelated review [1]).

[1]: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150112/252381.html

In general, we need `MDTuple::getTemporary()` to give a temporary tuple
(like `MDNodeFwdDecl`), `MDLocation::getTemporary()` to give a temporary
location, and (the problem at hand) `GenericDebugMDNode::getTemporary()`
to give a temporary generic debug node.

So I need to fold the idea of "temporary" nodes back into
`UniquableMDNode`.  (More commits to follow as I refactor.)

llvm-svn: 226481

9 years ago[Hexagon] Converting remaining ALU32/ALU intrinsics.
Colin LeMahieu [Mon, 19 Jan 2015 18:33:58 +0000 (18:33 +0000)]
[Hexagon] Converting remaining ALU32/ALU intrinsics.

llvm-svn: 226480

9 years agoadded support for PPC architectures (version 3): initial patch provided by Carlo...
Andrey Churbanov [Mon, 19 Jan 2015 18:29:35 +0000 (18:29 +0000)]
added support for PPC architectures (version 3): initial patch provided by Carlo Bertolli, latest version from Johnny Peyton

llvm-svn: 226479

9 years ago[Hexagon] Converting ALU32/ALU intrinsics to new patterns.
Colin LeMahieu [Mon, 19 Jan 2015 18:22:19 +0000 (18:22 +0000)]
[Hexagon] Converting ALU32/ALU intrinsics to new patterns.

llvm-svn: 226478

9 years agoPrint out the full output of gtest
Vince Harron [Mon, 19 Jan 2015 18:18:24 +0000 (18:18 +0000)]
Print out the full output of gtest

This patch fixes a bug that prevented all gtest output from being
displayed.

Submitted for Tamas Berghammer

llvm-svn: 226477

9 years agoRemove support for DIVariable's FlagIndirectVariable and expect
Adrian Prantl [Mon, 19 Jan 2015 17:57:29 +0000 (17:57 +0000)]
Remove support for DIVariable's FlagIndirectVariable and expect
frontends to use a DIExpression with a DW_OP_deref instead.

This is not only a much more natural place for this informationl; there
is also a technical reason: The FlagIndirectVariable is used to mark a
variable that is turned into a reference by virtue of the calling
convention; this happens for example to aggregate return values.
The inliner, for example, may actually need to undo this indirection to
correctly represent the value in its new context. This is impossible to
implement because the DIVariable can't be safely modified. We can however
safely construct a new DIExpression on the fly.

llvm-svn: 226476

9 years agoMigrate all uses of DIVariable's FlagIndirectVariable to use a DIExpression
Adrian Prantl [Mon, 19 Jan 2015 17:51:58 +0000 (17:51 +0000)]
Migrate all uses of DIVariable's FlagIndirectVariable to use a DIExpression
with a DW_OP_deref instead.

llvm-svn: 226474

9 years ago[AArch64] Implement GHC calling convention
Greg Fitzgerald [Mon, 19 Jan 2015 17:40:05 +0000 (17:40 +0000)]
[AArch64] Implement GHC calling convention

Original patch by Luke Iannini.  Minor improvements and test added by
Erik de Castro Lopo.

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

From: Erik de Castro Lopo <erikd@mega-nerd.com>
llvm-svn: 226473

9 years ago[Hexagon] Converting halfword to double accumulating multiply intrinsics.
Colin LeMahieu [Mon, 19 Jan 2015 17:36:32 +0000 (17:36 +0000)]
[Hexagon] Converting halfword to double accumulating multiply intrinsics.

llvm-svn: 226472

9 years agoFixed Linux build error in gtest
Vince Harron [Mon, 19 Jan 2015 17:31:22 +0000 (17:31 +0000)]
Fixed Linux build error in gtest

llvm-svn: 226471

9 years agoProduce errors when an assignment expression would use a common symbol.
Rafael Espindola [Mon, 19 Jan 2015 17:30:24 +0000 (17:30 +0000)]
Produce errors when an assignment expression would use a common symbol.

An assignment will produce a symbol with a given section and offset. There is
no way to represent something like "1 byte after a common symbol".

This matches the behavior of GNU as.

Part of PR22217.

llvm-svn: 226470

9 years ago[ARM] SSAT/USAT with an 'asr #32' shift should result in an undefined encoding rather...
Bradley Smith [Mon, 19 Jan 2015 16:37:17 +0000 (16:37 +0000)]
[ARM] SSAT/USAT with an 'asr #32' shift should result in an undefined encoding rather than unpredictable

llvm-svn: 226469

9 years ago[ARM] Fixup sign extend instruction availability w.r.t. DSP extension
Bradley Smith [Mon, 19 Jan 2015 16:36:02 +0000 (16:36 +0000)]
[ARM] Fixup sign extend instruction availability w.r.t. DSP extension

llvm-svn: 226468

9 years agoBring r226038 back.
Rafael Espindola [Mon, 19 Jan 2015 15:16:06 +0000 (15:16 +0000)]
Bring r226038 back.

No change in this commit, but clang was changed to also produce trivial comdats when
needed.

Original message:

Don't create new comdats in CodeGen.

This patch stops the implicit creation of comdats during codegen.

Clang now sets the comdat explicitly when it is required. With this patch clang and gcc
now produce the same result in pr19848.

llvm-svn: 226467

9 years agotsan: remove TSAN_SHADOW_COUNT
Dmitry Vyukov [Mon, 19 Jan 2015 15:01:07 +0000 (15:01 +0000)]
tsan: remove TSAN_SHADOW_COUNT

TSAN_SHADOW_COUNT is defined to 4 in all environments.
Other values of TSAN_SHADOW_COUNT were never tested and
were broken by recent changes to shadow mapping.
Remove it as there is no reason to fix nor maintain it.

llvm-svn: 226466

9 years agoAdd comdat to thunks.
Rafael Espindola [Mon, 19 Jan 2015 14:02:14 +0000 (14:02 +0000)]
Add comdat to thunks.

llvm-svn: 226465

9 years agoTwo fixes sent by C.Bergstrom: MB() does real synch for ARM; _Quad is not used when...
Andrey Churbanov [Mon, 19 Jan 2015 14:00:00 +0000 (14:00 +0000)]
Two fixes sent by C.Bergstrom: MB() does real synch for ARM; _Quad is not used when not available.

llvm-svn: 226464

9 years agoMake this test a bit stricter. NFC.
Rafael Espindola [Mon, 19 Jan 2015 13:59:31 +0000 (13:59 +0000)]
Make this test a bit stricter. NFC.

llvm-svn: 226463

9 years ago[Sanitizers] Intercept statvfs() on FreeBSD
Viktor Kutuzov [Mon, 19 Jan 2015 13:26:25 +0000 (13:26 +0000)]
[Sanitizers] Intercept statvfs() on FreeBSD
Committed unreviewed with permission.

llvm-svn: 226462

9 years ago[Msan] Intercept stat() and fstatat() on FreeBSD
Viktor Kutuzov [Mon, 19 Jan 2015 13:22:33 +0000 (13:22 +0000)]
[Msan] Intercept stat() and fstatat() on FreeBSD
Differential Revision: http://reviews.llvm.org/D7051

llvm-svn: 226461

9 years ago[PM] Update Polly for LLVM r226459 which removed another pass argument
Chandler Carruth [Mon, 19 Jan 2015 12:37:33 +0000 (12:37 +0000)]
[PM] Update Polly for LLVM r226459 which removed another pass argument
from an API in the process of preparing for the new pass manager.

llvm-svn: 226460

9 years ago[PM] Replace the Pass argument to SplitEdge with specific analyses used
Chandler Carruth [Mon, 19 Jan 2015 12:36:53 +0000 (12:36 +0000)]
[PM] Replace the Pass argument to SplitEdge with specific analyses used
and updated.

This may appear to remove handling for things like alias analysis when
splitting critical edges here, but in fact no callers of SplitEdge
relied on this. Similarly, all of them wanted to preserve LCSSA if there
was any update of the loop info. That makes the interface much simpler.

With this, all of BasicBlockUtils.h is free of Pass arguments and
prepared for the new pass manager. This is tho majority of utilities
that relied on pass arguments.

llvm-svn: 226459

9 years ago[sanitizer] Make unrecognized flags not fatal.
Evgeniy Stepanov [Mon, 19 Jan 2015 12:22:57 +0000 (12:22 +0000)]
[sanitizer] Make unrecognized flags not fatal.

Print a warning at verbosity=1 and higher instead of dying immediately.

llvm-svn: 226458

9 years ago[PM] Cleanup a dead option to critical edge splitting that I noticed
Chandler Carruth [Mon, 19 Jan 2015 12:12:00 +0000 (12:12 +0000)]
[PM] Cleanup a dead option to critical edge splitting that I noticed
while refactoring this API for the new pass manager.

No functionality changed here, the code didn't actually support this
option.

llvm-svn: 226457

9 years ago[PM] Remove the Pass argument from all of the critical edge splitting
Chandler Carruth [Mon, 19 Jan 2015 12:09:11 +0000 (12:09 +0000)]
[PM] Remove the Pass argument from all of the critical edge splitting
APIs and replace it and numerous booleans with an option struct.

The critical edge splitting API has a really large surface of flags and
so it seems worth burning a small option struct / builder. This struct
can be constructed with the various preserved analyses and then flags
can be flipped in a builder style.

The various users are now responsible for directly passing along their
analysis information. This should be enough for the critical edge
splitting to work cleanly with the new pass manager as well.

This API is still pretty crufty and could be cleaned up a lot, but I've
focused on this change just threading an option struct rather than
a pass through the API.

llvm-svn: 226456

9 years ago[NFC] Update createMachineScheduler() comment
Sergey Dmitrouk [Mon, 19 Jan 2015 12:02:25 +0000 (12:02 +0000)]
[NFC] Update createMachineScheduler() comment

It became invalid after signature changes.

llvm-svn: 226455

9 years agoclang-format: Fix crasher on weird comments.
Daniel Jasper [Mon, 19 Jan 2015 11:49:32 +0000 (11:49 +0000)]
clang-format: Fix crasher on weird comments.

Crashing input:
  /\
  / comment

llvm-svn: 226454

9 years ago[sanitizer] Switch flag parsing to LowLevelAlloc.
Evgeniy Stepanov [Mon, 19 Jan 2015 11:47:13 +0000 (11:47 +0000)]
[sanitizer] Switch flag parsing to LowLevelAlloc.

InternalAlloc is quite complex and its behavior may depend on the values of
flags. As such, it should not be used while parsing flags.

Sadly, LowLevelAlloc does not support deallocation of memory.

llvm-svn: 226453

9 years ago[sanitizer] Simplify code in flag parser.
Evgeniy Stepanov [Mon, 19 Jan 2015 10:54:36 +0000 (10:54 +0000)]
[sanitizer] Simplify code in flag parser.

llvm-svn: 226452

9 years agoclang-format: Fix crasher on incomplete condition compilation.
Daniel Jasper [Mon, 19 Jan 2015 10:52:16 +0000 (10:52 +0000)]
clang-format: Fix crasher on incomplete condition compilation.

Previously crashing input:
  void f(
  #if A
      );
  #else
  #endif

llvm-svn: 226451

9 years agoclang-format: Fix crash on invalid code.
Daniel Jasper [Mon, 19 Jan 2015 10:51:42 +0000 (10:51 +0000)]
clang-format: Fix crash on invalid code.

Input "a<," made clang-format crash.

llvm-svn: 226450

9 years agoclang-format: Fix clang-format crash on invalid code.
Daniel Jasper [Mon, 19 Jan 2015 10:51:23 +0000 (10:51 +0000)]
clang-format: Fix clang-format crash on invalid code.

llvm-svn: 226449

9 years agoclang-format: Fix assertion when trying to build a nullptr StringRef.
Daniel Jasper [Mon, 19 Jan 2015 10:51:05 +0000 (10:51 +0000)]
clang-format: Fix assertion when trying to build a nullptr StringRef.

llvm-svn: 226448