Commit Graph

2202 Commits

Author SHA1 Message Date
practicalswift
d76bab2059 Fix typo: introdution → introduction 2015-12-14 00:12:00 +01:00
practicalswift
ebd87f3e3b Fix typo: immeditely → immediately 2015-12-14 00:11:52 +01:00
practicalswift
37e7187508 Fix typo: entires → entries 2015-12-14 00:11:42 +01:00
practicalswift
6f5940e49d Fix typo: entires → entries 2015-12-14 00:11:42 +01:00
practicalswift
7e61aec082 Fix typo: droped → dropped 2015-12-14 00:11:39 +01:00
practicalswift
f212b72dc8 Fix typo: correspondance → correspondence 2015-12-14 00:11:30 +01:00
practicalswift
abbb6a09be Fix typo: convencience → convenience 2015-12-14 00:11:28 +01:00
practicalswift
7b2dfcbbe2 Fix typo: causeing → causing 2015-12-14 00:11:22 +01:00
practicalswift
2b6346c0bf Fix typo: artifically → artificially 2015-12-14 00:11:14 +01:00
Xin Tong
3b62b2f15c Rename reduceWithValues to LSValue::reduce 2015-12-13 11:37:34 -08:00
Xin Tong
fb480e9990 Reorder a few header includes 2015-12-13 10:17:15 -08:00
Xin Tong
27b5a40359 Rename MemLocation to LSLocation and LoadStoreValue to LSValue 2015-12-13 10:02:45 -08:00
Xin Tong
642a555a6c Rename MemLocation.h to SILValueProjection.h 2015-12-13 09:31:56 -08:00
Xin Tong
6a5c8701c6 Create a common createExtract function used across DSE and RLE 2015-12-13 09:19:54 -08:00
Xin Tong
7559f2013d Implement a LoadStoreValue vault so that every basic block keeps an
unsigned index instead of the real LoadStoreValue in RLE
2015-12-13 09:10:32 -08:00
Max Moiseev
786e1ea2b1 Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-11 15:19:02 -08:00
Andrew Trick
739b0e9c56 Reorganize SILOptimizer directories for better discoverability.
(libraries now)

It has been generally agreed that we need to do this reorg, and now
seems like the perfect time. Some major pass reorganization is in the
works.

This does not have to be the final word on the matter. The consensus
among those working on the code is that it's much better than what we
had and a better starting point for future bike shedding.

Note that the previous organization was designed to allow separate
analysis and optimization libraries. It turns out this is an
artificial distinction and not an important goal.
2015-12-11 15:14:23 -08:00
Andrew Trick
84450b4c43 Reorganize SILOptimizer directories for better discoverability.
(Headers first)

It has been generally agreed that we need to do this reorg, and now
seems like the perfect time. Some major pass reorganization is in the
works.

This does not have to be the final word on the matter. The consensus
among those working on the code is that it's much better than what we
had and a better starting point for future bike shedding.

Note that the previous organization was designed to allow separate
analysis and optimization libraries. It turns out this is an
artificial distinction and not an important goal.
2015-12-11 12:34:51 -08:00
Ben Langmuir
3e94baa960 Merge pull request #380 from jutaz/bugfix/typos-take-3
Fix typos
2015-12-11 09:19:27 -08:00
Slava Pestov
832a637c04 SIL: Start cleaning up getMethodDispatch() / requiresObjCDispatch()
Move these to SILDeclRef, maybe not the best place but a good home for now.
Factor out a new requiresForeignToNativeThunk() function, which cleans up
some code duplication introduced by the following patch:

478e1c7513

This is a small step towards consolidating duplicated logic for figuring out
method dispatch semantics and emitting curry thunks.
2015-12-11 08:58:52 -08:00
Justas Brazauskas
e799d3e93e Fix typos 2015-12-11 10:58:23 +02:00
David Farler
e6d1d9748b SILGen: Use the base SILDeclRef for super_method override constant info
getOverriddenVTableEntry only goes one level up in the class hierarchy,
but getConstantOverrideInfo requires that the next level up not itself be an
override.

A little bit of refactoring:

SILDeclRef::getOverriddenVTableEntry()
  -> SILDeclRef::getNextOverriddenVTableEntry()

static findOverriddenFunction()
  -> SILDeclRef::getBaseOverriddenVTableEntry()

rdar://problem/22749732
2015-12-10 15:47:50 -08:00
Mark Lacey
b37bc91506 Remove unused callback from SIL linker.
This was once used to maintain the call graph when lazy linking was
happening, but all that is gone now.
2015-12-10 15:12:41 -08:00
Max Moiseev
d610fa0d1c Merge remote-tracking branch 'origin' into swift-3-api-guidelines 2015-12-10 10:29:52 -08:00
Roman Levenstein
46b58ac699 Re-apply "Reduce memory footprint of the Swift compiler"
Use malloc/free for allocating/freeing SIL instructions instead of using the BumpPtrAllocator. This allows for memory reuse and significantly reduces the memory footprint of the compiler.

For example, a peak memory usage during a compilation of the standard library and StdlibUnitTest is reduced by 25%-30%. The performance of the compiler seems to be not affected by this change, i.e. no slowdown is measured.

The use-after-free issues reported by build bots are fixed now.

rdar://23303031
2015-12-10 08:36:59 -08:00
Ge Sen
7ac02d54ba Erase redundant whitespaces. 2015-12-10 13:35:06 +08:00
Dmitri Gribenko
feacbc4433 Rename ErrorType to ErrorProtocol 2015-12-09 17:12:19 -08:00
Xin Tong
8dc7ae522d Implement a type expansion analysis pass. This pass caches the expansion of a type to its individual fields. i.e. a map
between SILType and a list of ProjectionPath is cached. This pass is immutable and never invalidated.

Redundant load elimination and dead store elimination use this pass to improve compilation time.

I see the hit rate of the cache to be ~95%.

Without the pass.
----------------
Running Time	Self (ms)		Symbol Name
16338.0ms   28.2%	62.0	 	       swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>)
2716.0ms    4.6%	5.0	 	        (anonymous namespace)::SimplifyCFGPass::run()
2654.0ms    4.5%	12.0	 	        (anonymous namespace)::ARCSequenceOpts::run()
2218.0ms    3.8%	7.0	 	        (anonymous namespace)::SILCombine::run()
1660.0ms    2.8%	66.0	 	        (anonymous namespace)::SILCSE::run()
1625.0ms    2.8%	120.0	 	        (anonymous namespace)::RedundantLoadElimination::run()
1491.0ms    2.5%	35.0	 	        (anonymous namespace)::DeadStoreElimination::run()
1213.0ms    2.0%	1.0	 	        swift::BottomUpFunctionOrder::getFunctions()
777.0ms    1.3%	127.0	 	        (anonymous namespace)::DCE::run()
381.0ms    0.6%	2.0	 	        (anonymous namespace)::SILCodeMotion::run()

With the pass.
--------------
Running Time	Self (ms)		Symbol Name
15866.0ms   26.8%	73.0 	       swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>)
2736.0ms    4.6%	6.0 	        (anonymous namespace)::SimplifyCFGPass::run()
2696.0ms    4.5%	14. 	        (anonymous namespace)::ARCSequenceOpts::run()
2393.0ms    4.0%	7.0 	        (anonymous namespace)::SILCombine::run()
1673.0ms    2.8%	81. 	        (anonymous namespace)::SILCSE::run()
1290.0ms    2.1%	2.0 	        swift::BottomUpFunctionOrder::getFunctions()
1288.0ms    2.1%	17.0	        swift::BottomUpFunctionOrder::FindSCCs(swift::SILModule&)
1140.0ms    1.9%	138.0	        (anonymous namespace)::RedundantLoadElimination::run()
1119.0ms    1.8%	21.0	        (anonymous namespace)::DeadStoreElimination::run()
749.0ms    1.2%	147.0	 	        (anonymous namespace)::DCE::run()
379.0ms    0.6%	7.0	 	        (anonymous namespace)::SILCodeMotion::run()
256.0ms    0.4%	11.0	 	        (anonymous namespace)::ABCOpt::run()
2015-12-09 16:17:42 -08:00
John McCall
5fddd4a704 Remove the autorelease_return and strong_retain_autoreleased instructions.
There's a buggy SIL verifier check that was previously tautological,
and it turns out that it's violated, apparently harmlessly.  Since it
was already doing nothing, I've commented it out temporarily while
I figure out the right way to fix SILGen to get the invariant right.
2015-12-09 14:50:20 -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
Xin Tong
237d20db28 Replace createMemLocation with a constructor in MemLocation class. NFC 2015-12-09 11:16:21 -08:00
John McCall
bdb4b896a2 Move ObjC-compatible unowned references to the new runtime
functions.

Take the code for the old, broken reference-counting
implementation and delete it with prejudice.
2015-12-08 16:20:32 -08:00
Joe Groff
e55a3e1538 AllocBoxToStack: Update for box-only captures.
Change the logic to handle transforming @box T parameters into @inout_aliased T indirect parameters, instead of just dead-stripping boxes.
2015-12-08 14:35:48 -08:00
Joe Groff
172aee7f51 CapturePromotion: Update to handle lone box arguments.
Match the new SILGen pattern, where only the box parameter is partially applied to the closure, and the address of the value is projected on the callee side.
2015-12-08 14:35:47 -08:00
Arnold Schwaighofer
dee05869ff DebugUtils: Add an api to get the single non debug user 2015-12-08 07:34:25 -08:00
Nadav Rotem
9e311aff6c Make delete notifications elective
This commit adds a hook that allows passes, analysis or data structures that can
be registered as receivers of delete notifications to decide if they want to
receive notifications All of the analysis and the currently executing passes are
automatically registered to receive notifications and this hook is useful in
reducing the runtime overhead. With this change the only analysis that accepts
notifications is alias analysis.
2015-12-07 16:27:19 -08:00
Roman Levenstein
d00ec3afdf Add helper methods to ApplySite
A couple of methods related to the self parameter are useful for almost all apply sites. I'm going to use them e.g. in the devirtualizer.
2015-12-07 15:49:14 -08:00
Mark Lacey
3e643a4973 Merge pull request #287 from XenonXYZ/master
Fixed grammar mistake
2015-12-06 16:33:55 -08:00
Michael Gottesman
1e5aa72f2d Add in clang-format changes that I forgot to commit with the previous commit (sorry).
I clang-formatted the previous commit, but forgot to amend the changes.
2015-12-06 16:29:52 -08:00
Michael Gottesman
302632cefb Make SILFunction::create() private and change all direct uses of SILFunction::create() to instead use SILMod.getOrCreateFunction().
This centralizes the entrypoints for creating SILFunctions. Creating a
SILFunction is intimately tied to a specific SILModule, so it makes sense to
either centralize the creation on SILModule or SILFunction. Since a SILFunction
is in a SILModule, it seems more natural to put it on SILModule.

I purposely created a new override on SILMod that exactly matches the signature
of SILFunction::create so that beyond the extra indirection through SILMod, this
change should be NFC. We can refactor individual cases in later iterations of
refactoring.
2015-12-06 16:23:44 -08:00
Kiran
9d52fb1a40 Fixed grammar mistake
“Its” has been fixed to “it’s”.
2015-12-06 12:19:27 -08:00
Leo Shimonaka
70e66973ee Fix spelling error in documentation / comments / method name 2015-12-05 00:28:08 -05:00
Nadav Rotem
9233217ded [ValueHandle] Allow invalidation of BB arguments.
This commit changes the invalidation handler from SILInstruction to ValueBase,
and also invalidates SILArguments.
2015-12-04 17:32:16 -08:00
Roman Levenstein
4d02520424 Send delete notifications when basic block arguments are being erased. 2015-12-04 16:00:02 -08:00
Roman Levenstein
3bc1bd93c8 Use ValueBase instead of SILInstructions for delete notifications.
This enables e.g. notifications about the removal of SILArguments.
2015-12-04 15:16:25 -08:00
Erik Eckstein
332eeb7fe5 SIL: add SILInstruction::mayReleaseOrReadRefCount()
And use it in ReleaseDevirtualizer.
2015-12-04 12:58:38 -08:00
Nadav Rotem
37991af1cf [SIL] Add support for delete notification handlers.
This commit adds the basic support for delete notification handlers. The SIL
Module is notified every time an instruction is deleted. The module will forward
notification messages to users who ask to be notified.  The motivation for this
work is described in the upcoming commit to OptimizerDesign.md.
2015-12-04 07:37:12 -08:00
John McCall
ac5d14a185 Remove use of the GNU ?: extension from a core header.
Please stop adding uses of this; the source base should be portable
C++ to the greatest extent possible, and saving a few characters of
typing does not qualify for an exception.
2015-12-03 15:07:05 -08:00