mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Do not specialize dead apply/partial_apply.
Do not specialize an apply/partial_apply that we've already added to the set of dead instructions. Doing so can result in creating a new instruction which we will leave around, and which will have a type mismatch in its parameter list. Fixes rdar://problem/25447450.
This commit is contained in:
@@ -67,6 +67,19 @@ bool GenericSpecializer::specializeAppliesInFunction(SILFunction &F) {
|
||||
if (!Callee || !Callee->isDefinition())
|
||||
continue;
|
||||
|
||||
// Do not attempt to specialize known dead instructions. Doing
|
||||
// so would be a waste of time (since they are unused), and can
|
||||
// also lead to verification errors on the newly created
|
||||
// apply. This can happen in the case of a partial application
|
||||
// of a reabstraction thunk where we have done an RAUW on the
|
||||
// reabstracted function (which is an argument of the partial
|
||||
// apply). In this case we add the partial apply of the
|
||||
// reabstraction thunk to the set of dead applies, but its
|
||||
// arguments types do not match the expected types of the
|
||||
// argument that has been RAUWed into it.
|
||||
if (DeadApplies.count(Apply.getInstruction()))
|
||||
continue;
|
||||
|
||||
// We have a call that can potentially be specialized, so
|
||||
// attempt to do so.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user