Commit Graph

86 Commits

Author SHA1 Message Date
ken0nek
fcd8fcee91 Convert [Cc]an not -> [Cc]annot 2015-12-23 00:55:48 +09:00
practicalswift
36d7072013 Remove immediately adjacent repeated words ("the the", "for for", "an an", etc.). 2015-12-21 22:16:04 +01:00
Xin Tong
a6639667b6 Fix a bug in expandTypeIntoNodeProjectionPaths. This is exposed by the bug fixed in
a630f5942e.

Existing tests ensure correctness.
2015-12-20 23:39:41 -08:00
Xin Tong
5f2f0904af Fall back to the old implementation of type to leaf node expansion. It seems the
new implementation still has bugs
2015-12-09 14:49:31 -08:00
Michael Gottesman
a8c12d0564 [proj] Change SubSeqRelation_t::Unrelated => SubSeqRelation_t::Unknown
This more correctly describes what the enum case means semantically.
2015-12-09 14:40:22 -08:00
Xin Tong
fc477ed65d Break type tree expansion with/without intermediate nodes into 2 different functions. Makes the logic easier to understand 2015-12-09 13:06:23 -08:00
Xin Tong
840342b920 Update some comments for expandTypeIntoLeafProjectionPaths in Projection.h 2015-12-09 12:17:22 -08:00
Jordan Kay
008a42fd65 Fix misspellings 2015-12-03 14:28:54 -05:00
Xin Tong
9cb86737fd [RLE-DSE] Implement LoadStoreValue in MemLocation.cpp. LoadStoreValue represents
the value residing in a given MemLocation. In RLE, we create a map between
MemLocation and its corresponding LoadStoreValue.
2015-11-05 10:03:31 -08:00
Michael Gottesman
a2a6a32983 Fix leak in function signature opts.
rdar://23346077
2015-11-02 11:07:56 -08:00
Xin Tong
562f417ff9 Use address projection instead of projection when expanding projection paths
for a SILType in MemLocation.

We get a sequence of address projections when initializing a memory location, i.e.
trace back to the base and then call getAddrProjectionPath.

To keep it consistent, we use address projections when we expand the projection
tree for a specific SILType as well.

By doing so, to get the type of the MemLocation, we can get just the first entry
in the projectionpath and get its object type.

Swift SVN r32775
2015-10-20 17:07:26 +00:00
Xin Tong
895509ad8c Refactor how expand and reduce are implemented in MemLocation. BreadthFirstList now
takes a SILType instead of a MemLocation, BreadthFirstList will be used to expand
memory values in RLE as well.

Existing test cases make sure refactoring did not break anything.

Swift SVN r32739
2015-10-17 15:25:55 +00:00
Xin Tong
aba0903a16 Use new API in Projection.cpp(getFirstLevelProjection) to enumerate individual
fields in SILType in dead store elimination.

Swift SVN r32423
2015-10-03 18:43:03 +00:00
Xin Tong
b7e600104f Implement more type support for getFirstLevelProjection
Swift SVN r32380
2015-10-01 21:20:54 +00:00
Xin Tong
f63969213d Fix a stale comment in Projection.cpp
Swift SVN r32357
2015-10-01 00:30:08 +00:00
Michael Gottesman
add135a176 [proj] Add support to projection for getting all first level projections of an aggregate type and reforming from that type.
I am using this for SROAing BB arguments.

Swift SVN r31754
2015-09-08 00:55:41 +00:00
Andrew Trick
43d19255a4 Fix an incorrect static_assert on 32-bit targets.
Jason Molenda ran into this when building armv7 on swiftlang-700.1.41
and sent me a patch.

Swift SVN r29496
2015-06-18 22:34:03 +00:00
Andrew Trick
e017e039e8 SIL/Projection: support for index_addr.
Moved the lightweight access path helper into a ProjectionIndex utility.
Added support to it and the kitchen-sink Projection utility.

Add a ProjectionIndex utility that supports IndexAddr and does only what it needs to do.

While I'm at it, add IndexAddr support to Projection and
ProjectionPath so that other passes can make use of it.
Unfortunately, LoadStore optimization is still not strong enough to
benefit, so I don't have a test case yet.

Note that we have to be very careful now not to assume that when one
projection path is a subsequence of another it must address an
containing region of memory. The implicit index_addr #0 is not part of
the projection path!

Swift SVN r29167
2015-05-30 04:37:01 +00:00
Mark Lacey
e94877c2a3 Minor clean-up in Projection code.
When iterating over LeafIndices, we do not need to check to see if the
nodes they index into are live, since the only things that end up in
LeafIndices are indices of live nodes.

Swift SVN r29061
2015-05-27 07:01:19 +00:00
Erik Eckstein
8aca63b2fc Don't delete debug_value/debug_value_addr in dead code elimination unless their definitions are dead.
And also adapt a whole set of SIL passes so that they can deal with (the not deleted) debug_value instructions.
This was required to prevent perforamnce and code size regressions.
Now the generated code is (almost) the same as before.

The effect of this change is that we keep debug_value/debug_value_addr also in optimized code (more or less).
Fixes rdar://problem/18709125.




Swift SVN r28872
2015-05-21 13:34:47 +00:00
Michael Gottesman
bf50078d7e Fix assert Projection so it works across all platforms.
Swift SVN r26612
2015-03-26 23:07:28 +00:00
Michael Gottesman
52a332b2bd Specify that the static_asserts I inserted in the past couple of comments are
meant to ensure behavior does not change by mistake, but are open to be changed
if one wishes to modify them on purpose.



Swift SVN r26531
2015-03-25 06:46:53 +00:00
Michael Gottesman
3ec2d151f6 Shrink Projection to 24 bytes and Add some static assertions to make sure that SILValue and Projection stay the same size and standard layout.
Swift SVN r26526
2015-03-25 06:21:08 +00:00
Michael Gottesman
0ac649d87b [proj-tree] Use a passed in BumpPtrAllocator instead of SmallVector for memory.
Previously I was using a large SmallVector to create Nodes for the
ProjectionTree. This created an issue when the SmallVector would convert
from small to large representation in the middle of a method on an
object that is stored in the SmallVector. Thus the 'this' pointer will
be invalidated and all sorts of fun times will occur.

I switched now to using a BumpPtrAllocator which is passed into the tree
and used in FunctionSignatureOptimization for all projection trees.

<rdar://problem/19534462>

Swift SVN r24706
2015-01-24 09:12:50 +00:00
Erik Eckstein
5cffa73bbd Refactoring: extract some code of the inliner to the projection classes.
Michael, thanks for your comments!

This also adds support for tuples and enums in Projection::getOperandForAggregate().



Swift SVN r24112
2014-12-23 16:26:08 +00:00
Dmitri Hrybenko
850ab19115 Avoid using libc++ extension for tuples
Swift SVN r23636
2014-12-03 03:39:02 +00:00
Michael Gottesman
6d61aad42e [proj] Add a new data structure called a "Projection Tree".
A "Projection Tree" takes in a type and constructs a tree where each non-leaf
node represents an aggregate that can be split up and all leaf nodes represent a
subtype of the original type that we can not split.

It additionally provides the capability to propagate usage information
and liveness information through the tree, making it trivial to perform
SROA + partial dead use elimination. I am using this in function
signature opts for that purpose.

Swift SVN r23586
2014-11-28 20:38:55 +00:00
Michael Gottesman
6c29301490 Fix a stale comment.
Swift SVN r23389
2014-11-17 23:02:46 +00:00
Michael Gottesman
2d703a28f5 [proj] Add Projection::create{Addr,Value}Projection so one can create Projections without knowing what the internal state of the projection is.
Swift SVN r23371
2014-11-17 17:52:16 +00:00
Michael Gottesman
eeab468c8e [proj] Prepare Projection so that I can add generic create{Addr,Value}Projection.
I want to cleanup some code paths in SILCombine and LoadStoreOpts to use
generic create{Addr,Value}Projection methods which create the
appropriate projection instruction for a Projection method. Also this
will allow me to start to hide more of the internal state of Projection.

Swift SVN r23366
2014-11-17 06:43:37 +00:00
Michael Gottesman
a4a633351f [projection] Make projection constructors private and create static failable initializers using Optional.
This changes the Projection API so that you pass in an instruction and get back
an optional depending on what theinstruction was. This is much cleaner than
always needing to do a switch.

This commit also cleans up the naming in Projection so that we always use the
term "value projection" for struct_extract, tuple_extract, and
unchecked_enum_data instead of the term "extract". This lines up better with the
name we use for the *_addr instructions, "address projection" and avoids
ambiguity since unchecked_enum_data does not have the word "extract" in it.

Additionally by adding in the failable initializers, my centralization of the
initialization logic enables me to ensure that isAddrProjection and
isValueProjection stay in sync with the various constructors via asserts. This
should prevent future bugs if we add additional notions of "projection".

Swift SVN r23356
2014-11-16 04:09:16 +00:00
Michael Gottesman
7285835422 [projection] Rename isAddressProjection => isAddrProjection and add isValueProjection.
This is apart of some cleanups of the Projection class.

I also improved the comment at the top of projection to make its usage
clearer.

Swift SVN r23355
2014-11-16 04:09:15 +00:00
Michael Gottesman
3ae10834d6 [ls-opts] Teach LoadStoreOpts how to forward smaller previous loaded items to the uses of larger later loads that partially alias the load.
This will help the ARC optimizer given future function sig optimization work and
is in general good since this has been a hole in our load store forwarding for a
while.

rdar://18831605

Swift SVN r23102
2014-11-04 19:44:06 +00:00
Michael Gottesman
01a00347ca [aa] Add ProjectionPath::computeSubSeqRelation() and use it to teach AA how to check for partial aliasing.
rdar://18831605

Swift SVN r23076
2014-11-03 03:38:01 +00:00
Michael Gottesman
bb48674cf3 [aa] Move address projection path AA to use projection path infrastructure.
rdar://18831605

Swift SVN r23061
2014-11-02 00:41:13 +00:00
Michael Gottesman
596f406f31 [aa] Refactor all projection path logic into a class called ProjectionPath.
rdar://18831605

Swift SVN r23060
2014-11-02 00:41:13 +00:00