SILGen: Explicitly mark uninitialized locals with mark_uninitialized, and have DI only consider mark_uninitialized storage.

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 commit is contained in:
Joe Groff
2014-01-31 22:50:21 +00:00
parent a610743064
commit 71379f5bad
14 changed files with 236 additions and 145 deletions

View File

@@ -190,10 +190,15 @@ static bool checkAllocBoxUses(AllocBoxInst *ABI, SILValue V,
auto *User = UI->getUser();
// These instructions do not cause the box's address to escape.
if (!useCaptured(UI)) {
if (!useCaptured(UI)) {
Users.push_back(User);
continue;
}
if (auto *MUI = dyn_cast<MarkUninitializedInst>(User)) {
Users.push_back(MUI);
return checkAllocBoxUses(ABI, SILValue(MUI, 0), Users);
}
// These instructions only cause the alloc_box to escape if they are used in
// a way that escapes. Recursively check that the uses of the instruction