Commit Graph

71 Commits

Author SHA1 Message Date
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
102cd40ea0 [load-store-opts] RetainValue is insert from a load store opts perspective despite it having side effects due to it touching reference counts.
Swift SVN r18912
2014-06-15 20:01:42 +00:00
Michael Gottesman
aa70a16d7e [load-store-opts] Track, perform load forwarding, and eliminate multiple stores.
rdar://16703656

Swift SVN r17746
2014-05-09 00:44:28 +00:00
Michael Gottesman
9fee32d515 [load-store-opts] Do not invalidate stores if AA says that an instruction does not alias the store's destination conservatively.
Swift SVN r17738
2014-05-09 00:00:21 +00:00
Michael Gottesman
02c42cd0a4 [load-store-opts] Refactor out special cases for strong_retain, cond-fail, and dealloc_stack into a helper function call isLSForwardingInertInstruction.
Swift SVN r17735
2014-05-08 23:34:22 +00:00
Michael Gottesman
f18dbbe9e8 [load-store-opts] Refactor load forwarding into its own method LSBBForwarder::tryToForwardLoad.
Now the main optimize method of load store forwarding is ~60 lines and
is significantly more readable.

Swift SVN r17718
2014-05-08 22:42:16 +00:00
Michael Gottesman
df441227f1 [load-store-opts] Refactor out dead store elimination into LSBBForwarder::tryToEliminateDeadStore.
Swift SVN r17717
2014-05-08 22:42:16 +00:00
Michael Gottesman
d4698e3beb [load-store-opts] Move invalidateAliasingLoads onto LSBBForwarder and remove unneeded arguments.
Swift SVN r17716
2014-05-08 22:42:16 +00:00
Michael Gottesman
f510d16666 [load-store-opts] Refactor out call to recursivelyDeleteTriviallyDeadInstructions -> LSBBForwarder::deleteInstruction.
Swift SVN r17715
2014-05-08 22:42:15 +00:00
Michael Gottesman
328dd3cf52 [load-store-opts] Refactor/Simplify LoadStoreOpts by including a BBState structure.
This makes the main method able to be broken down into simpler pieces
without the need to pass as many things around.

Swift SVN r17714
2014-05-08 22:42:14 +00:00
Michael Gottesman
bd62e9d9e7 [load-store-opts] Keeping performing load store optimizations on a basic block until we no longer eliminate anything.
Swift SVN r17670
2014-05-08 02:33:35 +00:00
Manman Ren
fb299a4899 [LoadStoreOpt] make sure Loads do not hold deleted SILInstructions.
We add a callback function to recursivelyDeleteTriviallyDeadInstructions.
When a Load instruction is deleted, we erase it from Loads.

rdar://16815627


Swift SVN r17558
2014-05-06 20:02:31 +00:00
Mark Lacey
1452d24671 Small cleanup: Remove unnecessary calls to getDef(), mostly in dyn_cast<>(...).
Swift SVN r16235
2014-04-11 23:05:16 +00:00
Nadav Rotem
cce0b2d342 Add comments that describe the purpose of the set.
Swift SVN r15394
2014-03-23 20:55:24 +00:00
Nadav Rotem
4d9598fad1 Remove store instructions that store a loaded value that is known to be unmodified.
After this change swap in RC4 contains only 2 stores (of the swapped values).



Swift SVN r15386
2014-03-23 08:03:58 +00:00
Nadav Rotem
79c552b003 Zero -> Nullptr. NFC.
Swift SVN r15384
2014-03-23 07:04:14 +00:00
Nadav Rotem
8e4ff9bf10 Any instruction that invalidates loads should also invalidate stores.
Swift SVN r15382
2014-03-23 06:54:16 +00:00
Nadav Rotem
20c8272388 Promote partial-loads after stores.
Swift SVN r14217
2014-02-21 18:41:58 +00:00
Nadav Rotem
0a5f7b57a7 Change the debug string to match the ail-opt flag.
Swift SVN r14216
2014-02-21 18:40:35 +00:00
Michael Gottesman
fbe2ccf0d6 [sil-aa] Add in convenience methods for querying AliasAnalysis::getMemoryBehavior.
The methods are:

 * mayWriteToMemory()
 * mayReadFromMemory()
 * mayReadOrWriteMemory()
 * mayHaveSideEffects() [Side effects + writing to memory]
 * mayHavePureSideEffects() [Only side effects, ignores writes to memory]

Swift SVN r13791
2014-02-12 00:14:29 +00:00
Michael Gottesman
8cff098f1e Split SILCodeMotion into two passes, LoadStoreOpts and SILCodeMotion.
LoadStoreOpts removes duplicate loads, forwards stores to loads, and eliminates
dead stores.

Swift SVN r13789
2014-02-11 23:36:51 +00:00