@@ -1939,8 +1939,8 @@ static void prepareCallArguments(ApplySite AI, SILBuilder &Builder,
1939
1939
// / function being applied.
1940
1940
static ApplySite replaceWithSpecializedCallee (ApplySite AI,
1941
1941
SILValue Callee,
1942
- SILBuilder &Builder,
1943
1942
const ReabstractionInfo &ReInfo) {
1943
+ SILBuilderWithScope Builder (AI.getInstruction ());
1944
1944
SILLocation Loc = AI.getLoc ();
1945
1945
SmallVector<SILValue, 4 > Arguments;
1946
1946
SILValue StoreResultTo;
@@ -2029,7 +2029,7 @@ replaceWithSpecializedFunction(ApplySite AI, SILFunction *NewF,
2029
2029
const ReabstractionInfo &ReInfo) {
2030
2030
SILBuilderWithScope Builder (AI.getInstruction ());
2031
2031
FunctionRefInst *FRI = Builder.createFunctionRef (AI.getLoc (), NewF);
2032
- return replaceWithSpecializedCallee (AI, FRI, Builder, ReInfo);
2032
+ return replaceWithSpecializedCallee (AI, FRI, ReInfo);
2033
2033
}
2034
2034
2035
2035
namespace {
@@ -2444,11 +2444,11 @@ void swift::trySpecializeApplyOfGeneric(
2444
2444
// thunk which converts from the re-abstracted function back to the
2445
2445
// original function with indirect parameters/results.
2446
2446
auto *PAI = cast<PartialApplyInst>(Apply.getInstruction ());
2447
- SILBuilderWithScope Builder (PAI);
2448
2447
SILFunction *Thunk =
2449
2448
ReabstractionThunkGenerator (FuncBuilder, ReInfo, PAI, SpecializedF)
2450
2449
.createThunk ();
2451
2450
NewFunctions.push_back (Thunk);
2451
+ SILBuilderWithScope Builder (PAI);
2452
2452
auto *FRI = Builder.createFunctionRef (PAI->getLoc (), Thunk);
2453
2453
SmallVector<SILValue, 4 > Arguments;
2454
2454
for (auto &Op : PAI->getArgumentOperands ()) {
@@ -2476,8 +2476,7 @@ void swift::trySpecializeApplyOfGeneric(
2476
2476
for (Operand *Use : NewPAI->getUses ()) {
2477
2477
SILInstruction *User = Use->getUser ();
2478
2478
if (auto FAS = FullApplySite::isa (User)) {
2479
- SILBuilder Builder (User);
2480
- replaceWithSpecializedCallee (FAS, NewPAI, Builder, ReInfo);
2479
+ replaceWithSpecializedCallee (FAS, NewPAI, ReInfo);
2481
2480
DeadApplies.insert (FAS.getInstruction ());
2482
2481
continue ;
2483
2482
}
0 commit comments