Commit Graph

79 Commits

Author SHA1 Message Date
Chris Lattner
305fe6c8b6 A couple more cleanups: use the SILBuilder helper that
wraps emitDestroyValue, and create SILBuilders locally when
needed (they are cheap to construct) instead of creating them
once and passing them around.


Swift SVN r10444
2013-11-14 01:29:14 +00:00
Chris Lattner
24ce4c03f2 more tidying up, e.g. use a helper on SILBuilder, no functionality change.
Swift SVN r10442
2013-11-14 01:23:33 +00:00
Stephen Lin
2b245b157e MandatoryInlining: rearrange a conditional a bit to be more clear
Swift SVN r10433
2013-11-13 22:19:42 +00:00
Stephen Lin
d9340ccf86 MandatoryInlinning: Clean up arguments that end up being unused after inlining, such at metatype parameters to some standard library functions. Resolves <rdar://problem/15218643>.
Swift SVN r10431
2013-11-13 21:06:14 +00:00
Chris Lattner
ef9bab2f35 Fix an off-by-one in r9905, which patched MandatoryInlining to avoid
invalidating iterators.  The off-by one would lead to it failing to 
remove retain/release pairs around partial_apply's on inlined closures,
preventing the partial_apply itself from being removed, and thus making
it look like lots of values (including self) escape.

Fixing this bug allows us to re-enable the String append test and unxfails
three perf tests.


Swift SVN r10425
2013-11-13 19:13:29 +00:00
Chris Lattner
991900af68 cosmetic changes, primarily to end comment sentences with a .
Swift SVN r10424
2013-11-13 19:08:18 +00:00
Chris Lattner
a92e4de6bf teach instsimplify about struct/structextract folding, mostly for completeness.
This cuts 46 instructions out of the stdlib.


Swift SVN r9907
2013-11-03 18:11:52 +00:00
Chris Lattner
7989080ade mandatory inlining was using an iterator pointing to the ApplyInst
it inlines after it was invalidated.  This was exposed by an unrelated
change I'm about to land.  Fixing this required reworking a few things, and 
unfortunately seems to have broken the string O(1) optimization again.


Swift SVN r9905
2013-11-03 18:05:57 +00:00
Chris Lattner
a2a1b2af55 Clean up tuple and extract SILBuilder stuff:
- Introduce emitTupleExtract / emitStructExtract, which fold when their operand is a tuple/struct.
- Rename SILBuilder::createTupleExtractInst -> createTupleExtract, "Inst" isn't used as a suffix.
- Switch capture promotion and DI to use the new functions.

This trims 300 lines out of the stdlib.


Swift SVN r9897
2013-11-03 04:47:40 +00:00
Chris Lattner
2127da6a91 Enhance the function_ref instruction to maintain a refcount on the
SILFunction that it references.  Use this in the mandatory inlining
pass to remove deserialized transparent functions, to clean up the
-emit-sil output of the compiler (and presumably speed up compile 
time).  This implements rdar://15272652



Swift SVN r9699
2013-10-27 22:00:54 +00:00
Stephen Lin
4043b9c55d MandatoryInlining: Correct cast<> to dyn_cast<>
Swift SVN r9003
2013-10-07 22:38:43 +00:00
Stephen Lin
a6108dbd48 Rename FunctionRefInst::getFunction() and BuiltinFunctionRefInst::getFunction() to FunctionRefInst::getReferencedFunction() and BuiltinFunctionRefInst::getReferencedFunction() to avoid shadowing SILInstruction::getFunction().
Swift SVN r8929
2013-10-04 20:26:41 +00:00
Stephen Lin
5cb4879536 MandatoryInlining: 80 char line limit fixup
Swift SVN r8884
2013-10-03 18:26:50 +00:00
Joe Groff
82a18333ed SIL: Purge SpecializeInst.
Make ApplyInst and PartialApplyInst directly take substitutions for generic functions instead of trying to stage out substitutions separately. The legacy reasons for doing this are gone.

Swift SVN r8747
2013-09-28 00:15:45 +00:00
John McCall
22a3574654 Use copy_value and destroy_value when destroying loadable
aggregates in SIL-gen.  Leave the old expanded paths around
as emitLoweredCopyValue and emitLoweredDestroyValue.

Swift SVN r8535
2013-09-20 23:33:40 +00:00
Stephen Lin
c366c87bd5 Another minor fixup to MandatoryInlining: bail if CalleeValue becomes invalid, rather than try to dyn_cast and crash
Swift SVN r8135
2013-09-12 00:40:50 +00:00
Stephen Lin
19de5fe872 Add minor extra assertion to MandatoryInlining
Swift SVN r8133
2013-09-12 00:33:40 +00:00
Stephen Lin
4a535d4460 Mandatory inlining: clean up alloc_box, partial_apply, etc. after inlining an [auto_closure] argument, in simple cases.
Swift SVN r8127
2013-09-12 00:06:53 +00:00
Stephen Lin
7b2507b468 Minor variable renaming; also, remove unncessary pass by reference
Swift SVN r8110
2013-09-11 20:55:26 +00:00
Stephen Lin
8a2ec6c4b7 Minor documentation rewording
Swift SVN r8104
2013-09-11 20:21:57 +00:00
Stephen Lin
b415d3f599 Fixup reference counting when doing mandatory inlining across a partial application. This does not yet remove the alloc_box for the [auto_closure] but at least ensures that we do not leak or over-release.
Swift SVN r8103
2013-09-11 20:18:42 +00:00
Stephen Lin
e1eb850b83 Minor variable rename to avoid shadowing of a parameter
Swift SVN r7952
2013-09-05 18:24:44 +00:00
Stephen Lin
8a8de7ff7b Generalize MandatoryInlining to see through alloc box or alloc stack, and also fix a bug in not checking if the store is to the right alloc; new tests forthcoming
Swift SVN r7945
2013-09-05 16:39:18 +00:00
Stephen Lin
62ad1cca30 Take out the hack in SILInliner that is no longer necessary now that [auto_closure] is handled specially in SILGen, and allow MandatoryInlining to see through basic indirection through alloc box instructions in order to inline calls to [auto_closure] arguments. Note that the logic here is conservative; any second store (beyond the initial store in the prologue) or any capture of the alloc box will preventing inlining.
Swift SVN r7912
2013-09-04 21:45:19 +00:00
Stephen Lin
75099b7435 Narrow the rule that ApplyInsts in transparently inlined functions get the [transparent] flag to only apply to ApplyInsts that directly call function arguments, which is enough to handle the intended use case of [auto_closure] arguments to [transparent] functions without virally enforcing inlining more than we want to (or should be, once the phase ordering and incomplete SSA-ification issues are resolved).
Swift SVN r7774
2013-08-30 01:38:00 +00:00
Stephen Lin
3828b616d8 Make transparent inlining apply transparency recursively to all calls and also see through applications of partial applications (in SSA form); this is intended to ensure that [auto_closure] arguments of [transparent] functions get inlined, although that's additionally blocked by (apparent?) incompleteness of SSA-ification passes currently and phase ordering issues.
After implementing this I realized that a lot of the logic currently in MandatoryInlining.cpp should be moved into the SILInliner so it can be reused in an optimizing inliner. I plan on doing that refactoring immediately but decided to go ahead and commit this since it's a working incremental step.

Swift SVN r7771
2013-08-30 00:25:24 +00:00
Chris Lattner
69d0afb658 rename [force_inlining] to [transparent].
Swift SVN r7448
2013-08-22 16:05:41 +00:00
Stephen Lin
d1d1f4da0a MandatoryInlining: move check for already-processed function to apply to top-level calls as well
Swift SVN r7257
2013-08-15 16:22:33 +00:00
Stephen Lin
8d90466523 Reorganize SIL source tree: move lib/SIL/SILGen -> lib/SILGen, move lib/SIL/Passes -> lib/SILPasses, add lib/SILPasses/Utils
Swift SVN r7246
2013-08-14 23:47:29 +00:00