Commit Graph

67 Commits

Author SHA1 Message Date
Chris Lattner
74645a2472 Step #2 of the load promotion rewrite: change how assigns are handled.
Previously, the definite init pass would check to see if there was a
load available to optimize out the load of a non-trivial assign.  Now
we just unconditionally lower an assign to a load/copy/store sequence,
and lead later load elimination zap the load if it is redundant.

This allows us to remove the old mechanics for doing reasoning about
load elimination, including all the "AccessPath" stuff.


Swift SVN r9340
2013-10-15 00:26:22 +00:00
Chris Lattner
5708f5d28c Take a big step towards rewriting how definite init promotes loads
into SSA form, moving to resolving rdar://15170149.

Instead of promoting loads in the middle of the process of proving
that everything passes DI requirements, do this after a full element
is ok.

Doing this requires changing just about everything about how we modeled
elements and subelements being promoted, but this is good for a lot of
reasons:
1) we now don't eagerly scalarize all loads to struct members, now we
   just scalarize top-level tuples.  This is good for preserving higher
   level operations.
2) Even without scalarization, we can still model things at an extremely 
   fine grain, but we can also keep aggregate operations together.
   This means that load promotion doesn't insert a kajillion 
   struct_extract + struct sequences to decompose then recompose things.

This is just patch #1 of a series, but this is the bulk of the hard work.



Swift SVN r9338
2013-10-15 00:03:57 +00:00
Chris Lattner
a0d7510bc1 improve a comment, improve support for copyaddrs to and from the same aggregate.
Swift SVN r9246
2013-10-12 00:27:35 +00:00
Mark Lacey
94d2c06e21 Replace MemPromotion with Definitie Init in debug output.
Also replace memory-promotion with definite-init for DEBUG_TYPE and fix
a typo.

Swift SVN r9191
2013-10-11 03:24:37 +00:00
Chris Lattner
0c78c40775 Teach copy_addr explosion to scalarize any generated loads so that we
can forward larger stores to them.


Swift SVN r9168
2013-10-10 20:46:05 +00:00
Chris Lattner
e19ce563a5 Keep track of stores produced by exploded copy_addrs in the NonLoadUses
set.  This is the last fix required to get copy_addr to forward to the
load in this trivial example from rdar://15170149:

func testTrivial(a : @inout Int) -> Int {
  return a
}

on to more testing.



Swift SVN r9167
2013-10-10 20:20:53 +00:00
Chris Lattner
a3836f430d Fix -enable-copyaddr-forwarding to properly extract out the result of a large
aggregate store to forward to a smaller load, e.g. to feed a copyaddr of an 
Int to a load of the Builtin.Int64 inside of it.



Swift SVN r9166
2013-10-10 20:14:42 +00:00
Chris Lattner
1284eacd3d The Uses vector can grow now, ElementPromotion::doIt shouldn't iterate over
it with a for-each loop.



Swift SVN r9165
2013-10-10 20:00:12 +00:00
Joe Groff
29066ca358 SIL: Make consistent use of element-type-deriving createStruct/TupleExtract helpers in DefiniteInitialization.
Swift SVN r9139
2013-10-10 15:34:20 +00:00
Joe Groff
5650130518 SIL: Substitute struct field types when creating struct ops in passes.
The AST type of the VarDecl is incorrect for bound generic structs and needs to be substituted.

Swift SVN r9130
2013-10-10 04:35:57 +00:00
Chris Lattner
75b4fcd5ac Progress towards having memory promotion explode copy_addrs when necessary to
feed loads.  The new behavior is currently only enabled by the 
-enable-copyaddr-forwarding flag and is known broken, I'm working on it!


Swift SVN r9121
2013-10-10 00:56:28 +00:00
John McCall
b880e60100 Remove SILFunctionTypeInfo in favor of SILFunctionType.
We still don't actually use this as a type, however.

Swift SVN r9091
2013-10-09 20:55:55 +00:00
Chris Lattner
bbaa07125d refactor the checkLoadAccessPathAndComputeValue to be a method
on ElementPromotion, preparing it for future changes.  No functionality
change.


Swift SVN r9070
2013-10-09 18:17:55 +00:00
Chris Lattner
d6b01a42ad add a new (skeleton) pass for deshadowing inout variables.
Swift SVN r8954
2013-10-07 15:53:40 +00:00
Stephen Lin
3f5c0dbf0e Update SILArgument::getModule(), SILBasicBlock::getModule() and SILInstruction::getModule() signatures to match SILFunction::getModule(), for consistency; standardize usage of SILFunction::getParent() to SILFunction::getModule().
Swift SVN r8932
2013-10-04 21:12:20 +00:00
Chris Lattner
767da738bb Change the command line option to sil-opt for the definite initialization
pass to be -definite-init instead of -memory-promotion, rename the
entrypoint for the pass to match, and tidy various and sundry comments.


Swift SVN r8927
2013-10-04 18:45:09 +00:00
Chris Lattner
6b6887b2e0 rename MemoryPromotion.cpp -> DefiniteInitialization.cpp.
Promotion isn't really its purpose, it just happens to do that sometimes.



Swift SVN r8925
2013-10-04 18:39:34 +00:00