Commit Graph

114 Commits

Author SHA1 Message Date
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
4ad4b2db46 Remove newly dead swift::findAddressProjectionPathBetweenValues.
Swift SVN r23064
2014-11-02 02:53:37 +00:00
Michael Gottesman
5f70b01e4d [load-store-opts] Refactor load store opts to use the new ProjectionPath infrastructure.
rdar://18831605

Swift SVN r23063
2014-11-02 02:53:36 +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
Manman Ren
bea41c0bd3 [Alias Analysis] handle casts in projection path.
We ignore casts when generating projection paths for alias analysis. When
comparing two paths, we say no alias when accessing different fields of
the same Decl Context.


Swift SVN r20353
2014-07-23 00:02:28 +00:00
Michael Gottesman
735a23a0a3 [sil-combine] Rewrite unchecked_addr_cast to access layout compatible first element fields via typed GEPS.
A first element field of a nominal type is either the first element of a
struct or the first payload of an enum. We currently allow the stdlib to
rappel into struct heirarchies using reinterpretCast. This patch teaches
the optimizer how to rewrite such unchecked_addr_cast into
unchecked_enum_data_addr and struct_element_addr instructions. Then
Mem2Reg and Load Store Forwarding will remove the allocation generated
by such uses of reinterpret cast.

<rdar://problem/16703656>

Swift SVN r18977
2014-06-18 09:34:05 +00:00
Michael Gottesman
3ba6b7c663 [sil-combine] Make output of (extract (load)) -> (load (element_addr)) deterministic by not using pointer address as a sorting criteria for vardecls.
Instead for vardecls, we use the index of the field in the structdecl itself as
a stable ordering of vardecls.

I validated that the indeterminism was gone by running the failing test 1000
times in a row. Doug and I were hitting the indeterminism with well less than
100 iterations before, so I feel the number of iterations is sufficient.

Swift SVN r13859
2014-02-13 04:57:54 +00:00
Michael Gottesman
de48699d49 [sil-aa] Teach SILAA how to prove that two GEPs from the same base pointer with the same projections must alias.
Swift SVN r13768
2014-02-11 00:55:09 +00:00
Michael Gottesman
3a1d46d145 [sil-code-motion] Refactor out the address projection path computation from findExtractPathBetweenValues to a new function findAddressProjectionPathBetweenValues and wire up the old method to use the results of the refactored method.
This is in preparation for using the refactored functionality in Alias
Analysis's address projection disambiguation code.

Swift SVN r13765
2014-02-11 00:09:15 +00:00
Michael Gottesman
5b3423308d Refactor out the class Projection class into its own header swift/SIL/Projection.h.
This class allows you to deal with tuple and nominal projections in a way that
is agnostic of either of them.

Expect some incoming utilities based off of this for dealing with what I call
'aggregate type trees'.

Swift SVN r13735
2014-02-10 05:07:36 +00:00