mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Update SIL devirtualization to handle begin_apply instructions.
In order to make this reasonable, I needed to shift responsibilities around a little; the devirtualization operation is now responsible for replacing uses of the original apply. I wanted to remove the phase-separation completely, but there was optimization-remark code relying on the old apply site not having been deleted yet. The begin_apply aspects of this aren't testable independently of replacing materializeForSet because coroutines are currently never called indirectly.
This commit is contained in:
@@ -69,14 +69,14 @@ bool Devirtualizer::devirtualizeAppliesInFunction(SILFunction &F,
|
||||
}
|
||||
}
|
||||
for (auto Apply : Applies) {
|
||||
auto NewInstPair = tryDevirtualizeApply(Apply, CHA, &ORE);
|
||||
if (!NewInstPair.second)
|
||||
auto NewInst = tryDevirtualizeApply(Apply, CHA, &ORE);
|
||||
if (!NewInst)
|
||||
continue;
|
||||
|
||||
Changed = true;
|
||||
|
||||
replaceDeadApply(Apply, NewInstPair.first);
|
||||
NewApplies.push_back(NewInstPair.second);
|
||||
deleteDevirtualizedApply(Apply);
|
||||
NewApplies.push_back(NewInst);
|
||||
}
|
||||
|
||||
// For each new apply, attempt to link in function bodies if we do
|
||||
|
||||
Reference in New Issue
Block a user