1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
Commit Graph

75824 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith
44bfe4a149 IR: Move replaceWithUniqued(), etc., to source file, NFC
llvm-svn: 226522
2015-01-19 23:17:09 +00:00
Duncan P. N. Exon Smith
91a931c9df IR: Cleanup MDNode::MDNode(), NFC
llvm-svn: 226521
2015-01-19 23:15:21 +00:00
Duncan P. N. Exon Smith
77b413580d 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
2015-01-19 23:13:14 +00:00
Duncan P. N. Exon Smith
9c25a26692 IR: Extract MDNodeOpsKey, NFC
Make the MDTuple operand hashing logic reusable.

llvm-svn: 226519
2015-01-19 22:53:18 +00:00
Duncan P. N. Exon Smith
55777b83fd IR: Simplify uniquifyImpl(), NFC
llvm-svn: 226518
2015-01-19 22:52:07 +00:00
Duncan P. N. Exon Smith
a1b2f403fd IR: Simplify erasing from uniquing store, NFC
llvm-svn: 226517
2015-01-19 22:47:08 +00:00
Duncan P. N. Exon Smith
8c03609afe Utils: Simplify MapMetadata(), NFC
Extract out the operand remapping loops, which are now very similar.

llvm-svn: 226515
2015-01-19 22:44:32 +00:00
Duncan P. N. Exon Smith
d56a14d555 Skip upcast, NFC
llvm-svn: 226514
2015-01-19 22:41:14 +00:00
Simon Pilgrim
2ea397ac36 [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
2015-01-19 22:40:45 +00:00
Duncan P. N. Exon Smith
8b10d50b5e Fix whitespace, NFC
llvm-svn: 226512
2015-01-19 22:40:25 +00:00
Duncan P. N. Exon Smith
ad8f8fc5be 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
2015-01-19 22:39:07 +00:00
Duncan P. N. Exon Smith
fef426ff75 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
2015-01-19 22:24:52 +00:00
Duncan P. N. Exon Smith
844de4d931 IR: Split out countUnresolvedOperands(), NFC
llvm-svn: 226508
2015-01-19 22:18:29 +00:00
Duncan P. N. Exon Smith
3f7009cd6e Cleanup whitespace, NFC
llvm-svn: 226507
2015-01-19 22:16:01 +00:00
Duncan P. N. Exon Smith
1368f89f93 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
2015-01-19 21:30:18 +00:00
Rafael Espindola
a02b7738f7 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
2015-01-19 21:11:14 +00:00
Duncan P. N. Exon Smith
0341a8121b 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
2015-01-19 20:36:39 +00:00
Colin LeMahieu
9cc2ac99d5 [Hexagon] Updating muxir/ri/ii intrinsics. Setting predicate registers as compatible with i32 rather than doing custom type conversion.
llvm-svn: 226500
2015-01-19 20:31:18 +00:00
Duncan P. N. Exon Smith
51357ceef8 IR: Extract out and reuse storeImpl(), NFC
llvm-svn: 226499
2015-01-19 20:18:13 +00:00
Duncan P. N. Exon Smith
d4b3654033 IR: Extract out getUniqued(), NFC
llvm-svn: 226498
2015-01-19 20:16:50 +00:00
Duncan P. N. Exon Smith
8b7ed86ca9 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
2015-01-19 20:14:15 +00:00
Duncan P. N. Exon Smith
cf9d31f7c4 IR: Simplify MDNode::setOperand(), NFC
llvm-svn: 226492
2015-01-19 19:29:25 +00:00
Duncan P. N. Exon Smith
8caa30d063 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
2015-01-19 19:28:28 +00:00
Duncan P. N. Exon Smith
85d893bb11 IR: Remove direct comparisons against Metadata::Storage, NFC
llvm-svn: 226490
2015-01-19 19:26:24 +00:00
Duncan P. N. Exon Smith
fad6451545 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
2015-01-19 19:25:33 +00:00
Duncan P. N. Exon Smith
adb551d615 IR: Remove isa<UniquableMDNode>, NFC
llvm-svn: 226488
2015-01-19 19:10:14 +00:00
Duncan P. N. Exon Smith
19ec652214 IR: Simplify DIBuilder::trackIfUnresolved(), NFC
llvm-svn: 226487
2015-01-19 19:09:14 +00:00
Duncan P. N. Exon Smith
f860907b8f IR: Remove isa<MDNodeFwdDecl>, NFC
llvm-svn: 226486
2015-01-19 19:06:41 +00:00
Duncan P. N. Exon Smith
143b7fce41 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
2015-01-19 19:03:18 +00:00
Duncan P. N. Exon Smith
6da60093ee 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
2015-01-19 19:02:06 +00:00
Colin LeMahieu
89f087ffd8 [Hexagon] Converting intrinsics combine imm/imm, simple shifts and extends.
llvm-svn: 226483
2015-01-19 18:56:19 +00:00
Duncan P. N. Exon Smith
671d652451 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
2015-01-19 18:45:35 +00:00
Duncan P. N. Exon Smith
f397523f7d 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
2015-01-19 18:36:18 +00:00
Colin LeMahieu
c9d3d690e7 [Hexagon] Converting remaining ALU32/ALU intrinsics.
llvm-svn: 226480
2015-01-19 18:33:58 +00:00
Colin LeMahieu
dc770a4bae [Hexagon] Converting ALU32/ALU intrinsics to new patterns.
llvm-svn: 226478
2015-01-19 18:22:19 +00:00
Adrian Prantl
e6b30cee57 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
2015-01-19 17:57:29 +00:00
Greg Fitzgerald
91e9dd41fa [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
2015-01-19 17:40:05 +00:00
Colin LeMahieu
9b7e71b043 [Hexagon] Converting halfword to double accumulating multiply intrinsics.
llvm-svn: 226472
2015-01-19 17:36:32 +00:00
Rafael Espindola
bd29c767dc 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
2015-01-19 17:30:24 +00:00
Bradley Smith
ae052a6630 [ARM] SSAT/USAT with an 'asr #32' shift should result in an undefined encoding rather than unpredictable
llvm-svn: 226469
2015-01-19 16:37:17 +00:00
Bradley Smith
7561d7842c [ARM] Fixup sign extend instruction availability w.r.t. DSP extension
llvm-svn: 226468
2015-01-19 16:36:02 +00:00
Rafael Espindola
004c23be3b 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
2015-01-19 15:16:06 +00:00
Chandler Carruth
5aab205d60 [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
2015-01-19 12:36:53 +00:00
Chandler Carruth
507d4a824c [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
2015-01-19 12:12:00 +00:00
Chandler Carruth
77221961c5 [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
2015-01-19 12:09:11 +00:00
Chandler Carruth
bdf701f7d9 [PM] Relax asserts and always try to reconstruct loop simplify form when
we can while splitting critical edges.

The only code which called this and didn't require simplified loops to
be preserved is polly, and the code behaves correctly there anyways.
Without this change, it becomes really hard to share this code with the
new pass manager where things like preserving loop simplify form don't
make any sense.

If anyone discovers this code behaving incorrectly, what it *should* be
testing for is whether the loops it needs to be in simplified form are
in fact in that form. It should always be trying to preserve that form
when it exists.

llvm-svn: 226443
2015-01-19 10:23:00 +00:00
Erik Eckstein
99b67265b7 SLPVectorizer: limit the number of alias checks to reduce the runtime.
In case of blocks with many memory-accessing instructions, alias checking can take lot of time
(because calculating the memory dependencies has quadratic complexity).
I chose a limit which resulted in no changes when running the benchmarks.

llvm-svn: 226439
2015-01-19 09:33:38 +00:00
Hal Finkel
3eec8e9415 [PowerPC] Minor correction to r226432
We don't need to exclude patchpoints from the implicit r2 dependence in
FastISel because it is added as an implicit operand and, thus, should not
confuse that StackMap code.

By inspection / no test case.

llvm-svn: 226434
2015-01-19 07:44:45 +00:00
Michael Kuperstein
83ab484af5 [MIScheduler] Slightly better handling of constrainLocalCopy when both source and dest are local
This fixes PR21792.

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

llvm-svn: 226433
2015-01-19 07:30:47 +00:00
Hal Finkel
89328f88bf [PowerPC] Add r2 as an operand for all calls under both PPC64 ELF V1 and V2
Our PPC64 ELF V2 call lowering logic added r2 as an operand to all direct call
instructions in order to represent the dependency on the TOC base pointer
value. Restricting this to ELF V2, however, does not seem to make sense: calls
under ELF V1 have the same dependence, and indirect calls have an r2 dependence
just as direct ones. Make sure the dependence is noted for all calls under both
ELF V1 and ELF V2.

llvm-svn: 226432
2015-01-19 07:20:27 +00:00