[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
This commit is contained in:
Michael Gottesman
2014-11-04 19:44:06 +00:00
parent 58273118e2
commit 3ae10834d6
4 changed files with 248 additions and 18 deletions

View File

@@ -124,6 +124,10 @@ public:
return Index < Other.Index;
}
/// Determine if I is an extract instruction whose corresponding projection
/// equals this projection.
bool matchesExtract(SILInstruction *I) const;
static bool isAddressProjection(SILValue V) {
switch (V->getKind()) {
case ValueKind::StructElementAddrInst:
@@ -188,6 +192,9 @@ public:
static Optional<ProjectionPath>
getAddrProjectionPath(SILValue Start, SILValue End, bool IgnoreCasts=false);
static Optional<ProjectionPath>
subtractPaths(const ProjectionPath &LHS, const ProjectionPath &RHS);
/// Returns true if the two paths have a non-empty symmetric difference.
///
/// This means that the two objects have the same base but access different
@@ -199,6 +206,11 @@ public:
/// subsequence of the other.
SubSeqRelation_t computeSubSeqRelation(const ProjectionPath &RHS) const;
/// Find all extract paths from I that matches this projection path. Return
/// the tails of each extract path in Tails.
bool findMatchingExtractPaths(SILInstruction *I,
SmallVectorImpl<SILInstruction *> &Tails) const;
/// Returns true if LHS and RHS have all the same projections in the same
/// order.
bool operator==(const ProjectionPath &RHS) const {