Given an operand to an apply/partial_apply, we want to get the BB
argument in the body of the called function that represents the operand.
Swift SVN r15609
Drill down into partial_apply to examine how the container pointer is
used within the partial_apply. If the uses are not unexpected, and do
not allow the container pointer to escape the partial_apply, then we'll
check how the partial_apply is used when passed into an apply by
drilling down one level into that apply (but no further). If the
partial_apply itself cannot escape the current function or any funtion
it is passed to, then we should be able to clone the partial_apply body
and rewrite it to remove the box container pointer (coming in a future
commit).
This is all effectively disabled now by passing false to the call to
canValueEscape in findUnexpectedBoxUse which disables drilling down into
the apply.
Swift SVN r15591
r15322 reworked the logic for determining where the final releases are,
which means that we no longer need to collect the uses and releases as
we evaluate candidates for promotion.
Swift SVN r15333
Promote alloc_box to alloc_stack in the case where we have multiple
releases along different paths (including paths that follow a back-edge
to the alloc_box itself).
The new approach effectively uses liveness (computed on a per-alloc_box
basis) to determine where the final release on any path will
be. Building the stdlib takes the same amount of time as it did before
this change.
Deletes 56 of the 116 remaining alloc_box in the stdlib, and speeds up
the string walk benchmark by ~8%.
Swift SVN r15322
checkAllocBoxUses had two places where mark_uninitialized was being
processed, the second one unreachable.
The code removed by this commit was the code added later, and it makes
the assumption that the mark_uninitialized is the only use of the value
being processed. Although that assumption might be reasonable and
currently true, it's not verified.
Swift SVN r14043
Riding off of project_existential[_ref] was convenient, but the
resuls are used quite differently. Note that open_existential[_ref]
still don't print/parse reasonably yet.
Swift SVN r13878
Now the pass does not need to know about the pass manager. We also don't have
runOnFunction or runOnModule anymore because the trnasformation knows
which module it is processing. The Pass itself knows how to invalidate the
analysis, based on the injected pass manager that is internal to the
transformation.
Now our DCE transformation looks like this:
class DCE : public SILModuleTransform {
void run() {
performSILDeadCodeElimination(getModule());
invalidateAnalysis(SILAnalysis::InvalidationKind::All);
}
};
Swift SVN r13598
- purge @inout from comments in the compiler except for places talking about
the SIL argument convention.
- change diagnostics to not refer to @inout
- Change the astprinter to print InoutType without the @, so it doesn't show
up in diagnostics or in closure argument types in code completion.
- Implement type parsing support for the new inout syntax (before we just
handled patterns).
- Switch the last couple of uses in the stdlib (in types) to inout.
- Various testcase updates (more to come).
Swift SVN r13564
Have SILGen mark all variables bound from pattern bindings without initializers (and *only* ones without initializers) with mark_uninitialized [var] pseudo instructions. On the DI end, *only* consider mark_uninitialized instructions for DI analysis. This has many benefits:
- DI doesn't waste time analyzing locals that are trivially initialized in the original source code.
- DI doesn't try to mangle canonical SIL that has been inlined from transparent functions, which may have been optimized into a form DI isn't written to understand.
While we're here, fix an issue with DCE where it would try to kill unused MarkUninitialized instructions. Although MarkUninitialized has no side effects, it still is semantically important to raw SIL, and can't be killed.
Chris did most of the work here; I just finished updating tests and fixing bugs.
Swift SVN r13247
This pass is attempting to do a simple optimization where it determines if we
have an allocbox that has a most post dominating retain together which it
forms a single entry/single exit region.
It does this by checking domination/post-domination, but it does not check
control equivalence. This patch puts in a check to make sure that if we have a
cycle into the entry BB, we do not optimize.
rdar://15832873.
Swift SVN r12662
In nongeneric contexts, or contexts where we only care about the indirectness of parameters or have already substituted the generic parameters for a function, the interface types are interchangeable, so just switch over.
Swift SVN r12044
to avoid confusing uses of the box with uses of the allocation in partial
apply instructions. This resolves rdar://15595118.
Unfortunately, the testcase cannot be reduced into something that the
silparser handles, since it goes away when non-generic.
Swift SVN r11408
Remove the initialize_var instruction now that DI fully diagnoses initialization problems. Change String-to-NSString bridging to explicitly invoke String's default constructor; it was the last remaining user of initialize_var. Remove dead code to emit an implicit default constructor without a body.
Swift SVN r11066
new mark_unitialized instructions. These defeated the alloc_box to stack promotion
pass, so everything ended up on the heap, leading to really terrible performance.
This updates things to understand mark_uninitialized, allowing us to promote them.
This fixes rdar://15607469.
Swift SVN r10985
The empty tuple used for return value when none is supplied does not really correspond to user code. (We don’t have epilog, so mark it as pert of cleanup.)
The destroy_addr instructions are doing the cleanup.
Swift SVN r9765
clean up a couple random things in silcombiner:
- it shouldn't return "made any changes" out of the pass.
- statistics should be spelled out more and don't end with periods.
Swift SVN r9755
promote a lot more boxes. This is the last step to resolve
rdar://15228172 getting us back O(n) string performance. There is
still more work to do, but this is progress.
Swift SVN r9751