[sil-devirtualizer] Support devirtualization of try_apply instructions.

rdar://21909405

Swift SVN r30710
This commit is contained in:
Roman Levenstein
2015-07-28 00:11:38 +00:00
parent 85367420bd
commit 696da80ca0
6 changed files with 374 additions and 107 deletions

View File

@@ -220,7 +220,8 @@ ApplyInst *swift::findApplyFromDevirtualizedResult(SILInstruction *I) {
// value, and delete the old apply.
void swift::replaceDeadApply(FullApplySite Old, SILInstruction *New) {
auto *OldApply = Old.getInstruction();
OldApply->replaceAllUsesWith(New);
if (!isa<TryApplyInst>(OldApply))
OldApply->replaceAllUsesWith(New);
recursivelyDeleteTriviallyDeadInstructions(OldApply, true);
}