Skip to content

Commit f165659

Browse files
authored
Merge pull request #30350 from gottesmm/pr-72ad962e024d65f236dcbae49c7a0eb2c64c7f83
2 parents 1c1fae3 + 89f3364 commit f165659

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,8 +1939,8 @@ static void prepareCallArguments(ApplySite AI, SILBuilder &Builder,
19391939
/// function being applied.
19401940
static ApplySite replaceWithSpecializedCallee(ApplySite AI,
19411941
SILValue Callee,
1942-
SILBuilder &Builder,
19431942
const ReabstractionInfo &ReInfo) {
1943+
SILBuilderWithScope Builder(AI.getInstruction());
19441944
SILLocation Loc = AI.getLoc();
19451945
SmallVector<SILValue, 4> Arguments;
19461946
SILValue StoreResultTo;
@@ -2029,7 +2029,7 @@ replaceWithSpecializedFunction(ApplySite AI, SILFunction *NewF,
20292029
const ReabstractionInfo &ReInfo) {
20302030
SILBuilderWithScope Builder(AI.getInstruction());
20312031
FunctionRefInst *FRI = Builder.createFunctionRef(AI.getLoc(), NewF);
2032-
return replaceWithSpecializedCallee(AI, FRI, Builder, ReInfo);
2032+
return replaceWithSpecializedCallee(AI, FRI, ReInfo);
20332033
}
20342034

20352035
namespace {
@@ -2444,11 +2444,11 @@ void swift::trySpecializeApplyOfGeneric(
24442444
// thunk which converts from the re-abstracted function back to the
24452445
// original function with indirect parameters/results.
24462446
auto *PAI = cast<PartialApplyInst>(Apply.getInstruction());
2447-
SILBuilderWithScope Builder(PAI);
24482447
SILFunction *Thunk =
24492448
ReabstractionThunkGenerator(FuncBuilder, ReInfo, PAI, SpecializedF)
24502449
.createThunk();
24512450
NewFunctions.push_back(Thunk);
2451+
SILBuilderWithScope Builder(PAI);
24522452
auto *FRI = Builder.createFunctionRef(PAI->getLoc(), Thunk);
24532453
SmallVector<SILValue, 4> Arguments;
24542454
for (auto &Op : PAI->getArgumentOperands()) {
@@ -2476,8 +2476,7 @@ void swift::trySpecializeApplyOfGeneric(
24762476
for (Operand *Use : NewPAI->getUses()) {
24772477
SILInstruction *User = Use->getUser();
24782478
if (auto FAS = FullApplySite::isa(User)) {
2479-
SILBuilder Builder(User);
2480-
replaceWithSpecializedCallee(FAS, NewPAI, Builder, ReInfo);
2479+
replaceWithSpecializedCallee(FAS, NewPAI, ReInfo);
24812480
DeadApplies.insert(FAS.getInstruction());
24822481
continue;
24832482
}

0 commit comments

Comments
 (0)