Tighten up the analysis in InOutDeshadowing to ensure that the supposed shadow copy is actually stored back to the inout on every exit path. This avoids forwarding address-only inouts into @in arguments, for which we also emit a copy_addr to a stack slot. Fixes <rdar://problem/16105449>.
Before and after this patch, we deshadow the same number of copies:
293 inout-deshadow - Number of inout shadow variables kept
207 inout-deshadow - Number of inout shadow variables removed
Swift SVN r14108
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
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
I tried hard find all references to 'func' in documentation, comments and
diagnostics, but I am sure that I missed a few. If you find something, please
let me know.
rdar://15346654
Swift SVN r9886
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
before DI. This will enable us to simplify its algorithm to make it
more predictable and powerful.
To test the end-to-end behavior of inout promotion in the compiler,
I'm adding a new integration test with some examples that we cover
today. There is still more work to be done though.
Swift SVN r9748
eliminate stack allocations of non-trivial type. This is progress towards
rdar://15228172 but is not enough, we are still leaving copyvalue+destroys
around, which need to be fixed.
Swift SVN r9705
algorithm used by inout deshadowing broke in many common cases. Reimplement
the pass with a different approach, where it looks for autogenerated copies
into and out of the inout pointer, which may be exploded.
This doesn't handle nontrivial types yet, but is progress towards fixing
rdar://15228172.
Swift SVN r9702
There are no values other than instructions that can use other values. BBArguments are
defs, not uses. This eliminates a bunch of casts in clients that use getUser().
Swift SVN r9701
it is catching all the cases it should right now. The primary misses
are by-ref closure captures, which are modeled as inout arguments but
have no inout shadow to remove.
Swift SVN r9062
which don't get their init/take flags reliably set. This causes the
transformation to trigger on many many many more inout shadows, and also
breaks the debug info test.
Swift SVN r9041