Skip to content

Commit 6b7ae41

Browse files
committed
SIL: remove unused instructions thin_function_to_pointer and pointer_to_thin_function
1 parent e2a394b commit 6b7ae41

33 files changed

+23
-310
lines changed

Diff for: docs/SIL.rst

-10
Original file line numberDiff line numberDiff line change
@@ -6632,16 +6632,6 @@ passed to a function (materializeForSet) which escapes the closure in a way not
66326632
expressed by the convert's users. The mandatory pass must ensure the lifetime
66336633
in a conservative way.
66346634

6635-
thin_function_to_pointer
6636-
````````````````````````
6637-
6638-
TODO
6639-
6640-
pointer_to_thin_function
6641-
````````````````````````
6642-
6643-
TODO
6644-
66456635
classify_bridge_object
66466636
``````````````````````
66476637
::

Diff for: include/swift/SIL/SILBuilder.h

-12
Original file line numberDiff line numberDiff line change
@@ -1060,18 +1060,6 @@ class SILBuilder {
10601060
lifetimeGuaranteed));
10611061
}
10621062

1063-
ThinFunctionToPointerInst *
1064-
createThinFunctionToPointer(SILLocation Loc, SILValue Op, SILType Ty) {
1065-
return insert(new (getModule()) ThinFunctionToPointerInst(
1066-
getSILDebugLocation(Loc), Op, Ty));
1067-
}
1068-
1069-
PointerToThinFunctionInst *
1070-
createPointerToThinFunction(SILLocation Loc, SILValue Op, SILType Ty) {
1071-
return insert(PointerToThinFunctionInst::create(
1072-
getSILDebugLocation(Loc), Op, Ty, getFunction()));
1073-
}
1074-
10751063
UpcastInst *createUpcast(SILLocation Loc, SILValue Op, SILType Ty) {
10761064
return createUpcast(Loc, Op, Ty, Op.getOwnershipKind());
10771065
}

Diff for: include/swift/SIL/SILCloner.h

-20
Original file line numberDiff line numberDiff line change
@@ -1434,26 +1434,6 @@ void SILCloner<ImplClass>::visitConvertEscapeToNoEscapeInst(
14341434
getOpType(Inst->getType()), Inst->isLifetimeGuaranteed()));
14351435
}
14361436

1437-
template<typename ImplClass>
1438-
void SILCloner<ImplClass>::visitThinFunctionToPointerInst(
1439-
ThinFunctionToPointerInst *Inst) {
1440-
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
1441-
recordClonedInstruction(Inst, getBuilder().createThinFunctionToPointer(
1442-
getOpLocation(Inst->getLoc()),
1443-
getOpValue(Inst->getOperand()),
1444-
getOpType(Inst->getType())));
1445-
}
1446-
1447-
template<typename ImplClass>
1448-
void SILCloner<ImplClass>::visitPointerToThinFunctionInst(
1449-
PointerToThinFunctionInst *Inst) {
1450-
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
1451-
recordClonedInstruction(Inst, getBuilder().createPointerToThinFunction(
1452-
getOpLocation(Inst->getLoc()),
1453-
getOpValue(Inst->getOperand()),
1454-
getOpType(Inst->getType())));
1455-
}
1456-
14571437
template<typename ImplClass>
14581438
void
14591439
SILCloner<ImplClass>::visitUpcastInst(UpcastInst *Inst) {

Diff for: include/swift/SIL/SILInstruction.h

-33
Original file line numberDiff line numberDiff line change
@@ -5241,39 +5241,6 @@ class ConvertEscapeToNoEscapeInst final
52415241
void setLifetimeGuaranteed() { lifetimeGuaranteed = true; }
52425242
};
52435243

5244-
/// ThinFunctionToPointerInst - Convert a thin function pointer to a
5245-
/// Builtin.RawPointer.
5246-
class ThinFunctionToPointerInst
5247-
: public UnaryInstructionBase<SILInstructionKind::ThinFunctionToPointerInst,
5248-
ConversionInst>
5249-
{
5250-
friend SILBuilder;
5251-
5252-
ThinFunctionToPointerInst(SILDebugLocation DebugLoc, SILValue operand,
5253-
SILType ty)
5254-
: UnaryInstructionBase(DebugLoc, operand, ty) {}
5255-
};
5256-
5257-
/// PointerToThinFunctionInst - Convert a Builtin.RawPointer to a thin
5258-
/// function pointer.
5259-
class PointerToThinFunctionInst final
5260-
: public UnaryInstructionWithTypeDependentOperandsBase<
5261-
SILInstructionKind::PointerToThinFunctionInst,
5262-
PointerToThinFunctionInst,
5263-
ConversionInst> {
5264-
friend SILBuilder;
5265-
5266-
PointerToThinFunctionInst(SILDebugLocation DebugLoc, SILValue operand,
5267-
ArrayRef<SILValue> TypeDependentOperands,
5268-
SILType ty)
5269-
: UnaryInstructionWithTypeDependentOperandsBase(
5270-
DebugLoc, operand, TypeDependentOperands, ty) {}
5271-
5272-
static PointerToThinFunctionInst *
5273-
create(SILDebugLocation DebugLoc, SILValue Operand, SILType Ty,
5274-
SILFunction &F);
5275-
};
5276-
52775244
/// UpcastInst - Perform a conversion of a class instance to a supertype.
52785245
class UpcastInst final : public UnaryInstructionWithTypeDependentOperandsBase<
52795246
SILInstructionKind::UpcastInst, UpcastInst,

Diff for: include/swift/SIL/SILNode.h

-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ class alignas(8) SILNode :
367367

368368
UIWTDOB_BITFIELD(ConvertFunctionInst, ConversionInst, 1,
369369
WithoutActuallyEscaping : 1);
370-
UIWTDOB_BITFIELD_EMPTY(PointerToThinFunctionInst, ConversionInst);
371370
UIWTDOB_BITFIELD_EMPTY(UnconditionalCheckedCastInst, ConversionInst);
372371
UIWTDOB_BITFIELD_EMPTY(UpcastInst, ConversionInst);
373372
UIWTDOB_BITFIELD_EMPTY(UncheckedRefCastInst, ConversionInst);

Diff for: include/swift/SIL/SILNodes.def

-4
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,6 @@ ABSTRACT_VALUE_AND_INST(SingleValueInstruction, ValueBase, SILInstruction)
405405
ConversionInst, None, DoesNotRelease)
406406
SINGLE_VALUE_INST(ConvertEscapeToNoEscapeInst, convert_escape_to_noescape,
407407
ConversionInst, None, DoesNotRelease)
408-
SINGLE_VALUE_INST(ThinFunctionToPointerInst, thin_function_to_pointer,
409-
ConversionInst, None, DoesNotRelease)
410-
SINGLE_VALUE_INST(PointerToThinFunctionInst, pointer_to_thin_function,
411-
ConversionInst, None, DoesNotRelease)
412408
SINGLE_VALUE_INST(RefToBridgeObjectInst, ref_to_bridge_object,
413409
ConversionInst, None, DoesNotRelease)
414410
BRIDGED_SINGLE_VALUE_INST(BridgeObjectToRefInst, bridge_object_to_ref,

Diff for: include/swift/SIL/SILNodes.def.rej

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
***************
2+
*** 405,414 ****
3+
ConversionInst, None, DoesNotRelease)
4+
SINGLE_VALUE_INST(ConvertEscapeToNoEscapeInst, convert_escape_to_noescape,
5+
ConversionInst, None, DoesNotRelease)
6+
- SINGLE_VALUE_INST(ThinFunctionToPointerInst, thin_function_to_pointer,
7+
- ConversionInst, None, DoesNotRelease)
8+
- SINGLE_VALUE_INST(PointerToThinFunctionInst, pointer_to_thin_function,
9+
- ConversionInst, None, DoesNotRelease)
10+
BRIDGED_SINGLE_VALUE_INST(RefToBridgeObjectInst, ref_to_bridge_object,
11+
ConversionInst, None, DoesNotRelease)
12+
BRIDGED_SINGLE_VALUE_INST(BridgeObjectToRefInst, bridge_object_to_ref,
13+
--- 405,410 ----
14+
ConversionInst, None, DoesNotRelease)
15+
SINGLE_VALUE_INST(ConvertEscapeToNoEscapeInst, convert_escape_to_noescape,
16+
ConversionInst, None, DoesNotRelease)
17+
BRIDGED_SINGLE_VALUE_INST(RefToBridgeObjectInst, ref_to_bridge_object,
18+
ConversionInst, None, DoesNotRelease)
19+
BRIDGED_SINGLE_VALUE_INST(BridgeObjectToRefInst, bridge_object_to_ref,

Diff for: lib/IRGen/IRGenSIL.cpp

-22
Original file line numberDiff line numberDiff line change
@@ -1311,8 +1311,6 @@ class IRGenSILFunction :
13111311

13121312
void visitConvertFunctionInst(ConvertFunctionInst *i);
13131313
void visitConvertEscapeToNoEscapeInst(ConvertEscapeToNoEscapeInst *i);
1314-
void visitThinFunctionToPointerInst(ThinFunctionToPointerInst *i);
1315-
void visitPointerToThinFunctionInst(PointerToThinFunctionInst *i);
13161314
void visitUpcastInst(UpcastInst *i);
13171315
void visitAddressToPointerInst(AddressToPointerInst *i);
13181316
void visitPointerToAddressInst(PointerToAddressInst *i);
@@ -5856,26 +5854,6 @@ void IRGenSILFunction::visitConvertEscapeToNoEscapeInst(
58565854
setLoweredExplosion(i, out);
58575855
}
58585856

5859-
void IRGenSILFunction::visitThinFunctionToPointerInst(
5860-
swift::ThinFunctionToPointerInst *i) {
5861-
Explosion in = getLoweredExplosion(i->getOperand());
5862-
llvm::Value *fn = in.claimNext();
5863-
fn = Builder.CreateBitCast(fn, IGM.Int8PtrTy);
5864-
Explosion out;
5865-
out.add(fn);
5866-
setLoweredExplosion(i, out);
5867-
}
5868-
5869-
void IRGenSILFunction::visitPointerToThinFunctionInst(
5870-
swift::PointerToThinFunctionInst *i) {
5871-
Explosion in = getLoweredExplosion(i->getOperand());
5872-
llvm::Value *fn = in.claimNext();
5873-
fn = Builder.CreateBitCast(fn, IGM.FunctionPtrTy);
5874-
Explosion out;
5875-
out.add(fn);
5876-
setLoweredExplosion(i, out);
5877-
}
5878-
58795857
void IRGenSILFunction::visitAddressToPointerInst(swift::AddressToPointerInst *i)
58805858
{
58815859
Explosion to;

Diff for: lib/IRGen/LoadableByAddress.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -2782,9 +2782,6 @@ bool LoadableByAddress::recreateConvInstr(SILInstruction &I,
27822782
IRGenModule *currIRMod =
27832783
getIRGenModule()->IRGen.getGenModule(convInstr->getFunction());
27842784
SILType currSILType = convInstr->getType();
2785-
if (auto *thinToPointer = dyn_cast<ThinFunctionToPointerInst>(convInstr)) {
2786-
currSILType = thinToPointer->getOperand()->getType();
2787-
}
27882785
auto currSILFunctionType = currSILType.castTo<SILFunctionType>();
27892786
GenericEnvironment *genEnv =
27902787
getSubstGenericEnvironment(convInstr->getFunction());
@@ -2813,14 +2810,6 @@ bool LoadableByAddress::recreateConvInstr(SILInstruction &I,
28132810
instr->getLoc(), instr->getOperand(), newType);
28142811
break;
28152812
}
2816-
case SILInstructionKind::ThinFunctionToPointerInst: {
2817-
auto instr = cast<ThinFunctionToPointerInst>(convInstr);
2818-
newType =
2819-
MapperCache.getNewSILType(genEnv, instr->getType(), *getIRGenModule());
2820-
newInstr = convBuilder.createThinFunctionToPointer(
2821-
instr->getLoc(), instr->getOperand(), newType);
2822-
break;
2823-
}
28242813
case SILInstructionKind::ConvertFunctionInst: {
28252814
auto instr = cast<ConvertFunctionInst>(convInstr);
28262815
newInstr = convBuilder.createConvertFunction(
@@ -2956,7 +2945,6 @@ void LoadableByAddress::run() {
29562945
case SILInstructionKind::ConvertFunctionInst:
29572946
case SILInstructionKind::ConvertEscapeToNoEscapeInst:
29582947
case SILInstructionKind::MarkDependenceInst:
2959-
case SILInstructionKind::ThinFunctionToPointerInst:
29602948
case SILInstructionKind::ThinToThickFunctionInst:
29612949
case SILInstructionKind::DifferentiableFunctionInst:
29622950
case SILInstructionKind::LinearFunctionInst:

Diff for: lib/SIL/IR/OperandOwnership.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ OPERAND_OWNERSHIP(TrivialUse, ObjCToThickMetatype)
171171
OPERAND_OWNERSHIP(TrivialUse, OpenExistentialAddr)
172172
OPERAND_OWNERSHIP(TrivialUse, OpenExistentialMetatype)
173173
OPERAND_OWNERSHIP(TrivialUse, PointerToAddress)
174-
OPERAND_OWNERSHIP(TrivialUse, PointerToThinFunction)
175174
OPERAND_OWNERSHIP(TrivialUse, ProjectBlockStorage)
176175
OPERAND_OWNERSHIP(TrivialUse, RawPointerToRef)
177176
OPERAND_OWNERSHIP(TrivialUse, SelectEnumAddr)
@@ -180,7 +179,6 @@ OPERAND_OWNERSHIP(TrivialUse, SwitchEnumAddr)
180179
OPERAND_OWNERSHIP(TrivialUse, SwitchValue)
181180
OPERAND_OWNERSHIP(TrivialUse, TailAddr)
182181
OPERAND_OWNERSHIP(TrivialUse, ThickToObjCMetatype)
183-
OPERAND_OWNERSHIP(TrivialUse, ThinFunctionToPointer)
184182
OPERAND_OWNERSHIP(TrivialUse, ThinToThickFunction)
185183
OPERAND_OWNERSHIP(TrivialUse, TupleElementAddr)
186184
OPERAND_OWNERSHIP(TrivialUse, UncheckedAddrCast)

Diff for: lib/SIL/IR/SILInstruction.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -844,12 +844,6 @@ namespace {
844844
bool visitClassifyBridgeObjectInst(ClassifyBridgeObjectInst *X) {
845845
return true;
846846
}
847-
bool visitThinFunctionToPointerInst(ThinFunctionToPointerInst *X) {
848-
return true;
849-
}
850-
bool visitPointerToThinFunctionInst(PointerToThinFunctionInst *X) {
851-
return true;
852-
}
853847

854848
bool visitObjCProtocolInst(ObjCProtocolInst *RHS) {
855849
auto *X = cast<ObjCProtocolInst>(LHS);

Diff for: lib/SIL/IR/SILInstructions.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -2335,19 +2335,6 @@ ThinToThickFunctionInst::create(SILDebugLocation DebugLoc, SILValue Operand,
23352335
DebugLoc, Operand, TypeDependentOperands, Ty, forwardingOwnershipKind);
23362336
}
23372337

2338-
PointerToThinFunctionInst *
2339-
PointerToThinFunctionInst::create(SILDebugLocation DebugLoc, SILValue Operand,
2340-
SILType Ty, SILFunction &F) {
2341-
SILModule &Mod = F.getModule();
2342-
SmallVector<SILValue, 8> TypeDependentOperands;
2343-
collectTypeDependentOperands(TypeDependentOperands, F, Ty.getASTType());
2344-
unsigned size =
2345-
totalSizeToAlloc<swift::Operand>(1 + TypeDependentOperands.size());
2346-
void *Buffer = Mod.allocateInst(size, alignof(PointerToThinFunctionInst));
2347-
return ::new (Buffer) PointerToThinFunctionInst(DebugLoc, Operand,
2348-
TypeDependentOperands, Ty);
2349-
}
2350-
23512338
ConvertFunctionInst *ConvertFunctionInst::create(
23522339
SILDebugLocation DebugLoc, SILValue Operand, SILType Ty, SILModule &Mod,
23532340
SILFunction *F,

Diff for: lib/SIL/IR/SILPrinter.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -1791,12 +1791,6 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
17911791
*this << (CI->isLifetimeGuaranteed() ? "" : "[not_guaranteed] ")
17921792
<< getIDAndType(CI->getOperand()) << " to " << CI->getType();
17931793
}
1794-
void visitThinFunctionToPointerInst(ThinFunctionToPointerInst *CI) {
1795-
printUncheckedConversionInst(CI, CI->getOperand());
1796-
}
1797-
void visitPointerToThinFunctionInst(PointerToThinFunctionInst *CI) {
1798-
printUncheckedConversionInst(CI, CI->getOperand());
1799-
}
18001794
void visitUpcastInst(UpcastInst *CI) {
18011795
printUncheckedConversionInst(CI, CI->getOperand());
18021796
}

Diff for: lib/SIL/IR/ValueOwnership.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ CONSTANT_OWNERSHIP_INST(None, OpenExistentialAddr)
121121
CONSTANT_OWNERSHIP_INST(None, OpenExistentialBox)
122122
CONSTANT_OWNERSHIP_INST(None, OpenExistentialMetatype)
123123
CONSTANT_OWNERSHIP_INST(None, PointerToAddress)
124-
CONSTANT_OWNERSHIP_INST(None, PointerToThinFunction)
125124
CONSTANT_OWNERSHIP_INST(None, ProjectBlockStorage)
126125
CONSTANT_OWNERSHIP_INST(None, ProjectBox)
127126
CONSTANT_OWNERSHIP_INST(None, ProjectExistentialBox)
@@ -135,7 +134,6 @@ CONSTANT_OWNERSHIP_INST(None, SuperMethod)
135134
CONSTANT_OWNERSHIP_INST(None, ObjCSuperMethod)
136135
CONSTANT_OWNERSHIP_INST(None, TailAddr)
137136
CONSTANT_OWNERSHIP_INST(None, ThickToObjCMetatype)
138-
CONSTANT_OWNERSHIP_INST(None, ThinFunctionToPointer)
139137
CONSTANT_OWNERSHIP_INST(None, TupleElementAddr)
140138
CONSTANT_OWNERSHIP_INST(None, UncheckedAddrCast)
141139
CONSTANT_OWNERSHIP_INST(None, UncheckedTakeEnumDataAddr)

Diff for: lib/SIL/Parser/ParseSIL.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -3608,8 +3608,6 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
36083608
case SILInstructionKind::RefTo##Name##Inst: \
36093609
case SILInstructionKind::Name##ToRefInst:
36103610
#include "swift/AST/ReferenceStorage.def"
3611-
case SILInstructionKind::ThinFunctionToPointerInst:
3612-
case SILInstructionKind::PointerToThinFunctionInst:
36133611
case SILInstructionKind::ThinToThickFunctionInst:
36143612
case SILInstructionKind::ThickToObjCMetatypeInst:
36153613
case SILInstructionKind::ObjCToThickMetatypeInst:
@@ -3717,12 +3715,6 @@ bool SILParser::parseSpecificSILInstruction(SILBuilder &B,
37173715
ResultVal = B.create##Name##ToRef(InstLoc, Val, Ty); \
37183716
break;
37193717
#include "swift/AST/ReferenceStorage.def"
3720-
case SILInstructionKind::ThinFunctionToPointerInst:
3721-
ResultVal = B.createThinFunctionToPointer(InstLoc, Val, Ty);
3722-
break;
3723-
case SILInstructionKind::PointerToThinFunctionInst:
3724-
ResultVal = B.createPointerToThinFunction(InstLoc, Val, Ty);
3725-
break;
37263718
case SILInstructionKind::ThinToThickFunctionInst:
37273719
ResultVal =
37283720
B.createThinToThickFunction(InstLoc, Val, Ty, forwardingOwnership);

Diff for: lib/SIL/Utils/InstructionUtils.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,6 @@ RuntimeEffect swift::getRuntimeEffect(SILInstruction *inst, SILType &impactType)
412412
#undef LOADABLE_REF_STORAGE_HELPER
413413
case SILInstructionKind::ConvertFunctionInst:
414414
case SILInstructionKind::ConvertEscapeToNoEscapeInst:
415-
case SILInstructionKind::ThinFunctionToPointerInst:
416-
case SILInstructionKind::PointerToThinFunctionInst:
417415
case SILInstructionKind::RefToBridgeObjectInst:
418416
case SILInstructionKind::BridgeObjectToRefInst:
419417
case SILInstructionKind::BridgeObjectToWordInst:

Diff for: lib/SIL/Verifier/SILVerifier.cpp

-28
Original file line numberDiff line numberDiff line change
@@ -4417,34 +4417,6 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
44174417
}
44184418
}
44194419

4420-
void checkThinFunctionToPointerInst(ThinFunctionToPointerInst *CI) {
4421-
auto opTI = requireObjectType(SILFunctionType, CI->getOperand(),
4422-
"thin_function_to_pointer operand");
4423-
requireObjectType(BuiltinRawPointerType, CI,
4424-
"thin_function_to_pointer result");
4425-
4426-
auto rep = opTI->getRepresentation();
4427-
require(rep == SILFunctionTypeRepresentation::Thin ||
4428-
rep == SILFunctionTypeRepresentation::Method ||
4429-
rep == SILFunctionTypeRepresentation::WitnessMethod,
4430-
"thin_function_to_pointer only works on thin, method or "
4431-
"witness_method functions");
4432-
}
4433-
4434-
void checkPointerToThinFunctionInst(PointerToThinFunctionInst *CI) {
4435-
auto resultTI = requireObjectType(SILFunctionType, CI,
4436-
"pointer_to_thin_function result");
4437-
requireObjectType(BuiltinRawPointerType, CI->getOperand(),
4438-
"pointer_to_thin_function operand");
4439-
4440-
auto rep = resultTI->getRepresentation();
4441-
require(rep == SILFunctionTypeRepresentation::Thin ||
4442-
rep == SILFunctionTypeRepresentation::Method ||
4443-
rep == SILFunctionTypeRepresentation::WitnessMethod,
4444-
"pointer_to_thin_function only works on thin, method or "
4445-
"witness_method functions");
4446-
}
4447-
44484420
void checkCondFailInst(CondFailInst *CFI) {
44494421
requireSameType(CFI->getOperand()->getType(),
44504422
SILType::getBuiltinIntegerType(1, F.getASTContext()),

Diff for: lib/SILOptimizer/Analysis/EscapeAnalysis.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ static bool isNonWritableMemoryAddress(SILValue V) {
289289
case ValueKind::ObjCSuperMethodInst:
290290
case ValueKind::StringLiteralInst:
291291
case ValueKind::ThinToThickFunctionInst:
292-
case ValueKind::ThinFunctionToPointerInst:
293-
case ValueKind::PointerToThinFunctionInst:
294292
// These instructions return pointers to memory which can't be a
295293
// destination of a store.
296294
return true;

Diff for: lib/SILOptimizer/Analysis/SimplifyInstruction.cpp

-20
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ namespace {
6666
SILValue
6767
visitUncheckedTrivialBitCastInst(UncheckedTrivialBitCastInst *UTBCI);
6868
SILValue visitEndCOWMutationInst(EndCOWMutationInst *ECM);
69-
SILValue visitThinFunctionToPointerInst(ThinFunctionToPointerInst *TFTPI);
70-
SILValue visitPointerToThinFunctionInst(PointerToThinFunctionInst *PTTFI);
7169
SILValue visitBeginAccessInst(BeginAccessInst *BAI);
7270
SILValue visitMetatypeInst(MetatypeInst *MTI);
7371
SILValue visitConvertFunctionInst(ConvertFunctionInst *cfi);
@@ -464,24 +462,6 @@ visitUncheckedBitwiseCastInst(UncheckedBitwiseCastInst *UBCI) {
464462
return SILValue();
465463
}
466464

467-
SILValue InstSimplifier::visitThinFunctionToPointerInst(ThinFunctionToPointerInst *TFTPI) {
468-
// (thin_function_to_pointer (pointer_to_thin_function x)) -> x
469-
if (auto *PTTFI = dyn_cast<PointerToThinFunctionInst>(TFTPI->getOperand()))
470-
if (PTTFI->getOperand()->getType() == TFTPI->getType())
471-
return PTTFI->getOperand();
472-
473-
return SILValue();
474-
}
475-
476-
SILValue InstSimplifier::visitPointerToThinFunctionInst(PointerToThinFunctionInst *PTTFI) {
477-
// (pointer_to_thin_function (thin_function_to_pointer x)) -> x
478-
if (auto *TFTPI = dyn_cast<ThinFunctionToPointerInst>(PTTFI->getOperand()))
479-
if (TFTPI->getOperand()->getType() == PTTFI->getType())
480-
return TFTPI->getOperand();
481-
482-
return SILValue();
483-
}
484-
485465
SILValue InstSimplifier::visitBeginAccessInst(BeginAccessInst *BAI) {
486466
// Remove "dead" begin_access.
487467
if (llvm::all_of(BAI->getUses(), [](Operand *operand) -> bool {

0 commit comments

Comments
 (0)