Skip to content

Commit 68b9f42

Browse files
committed
SIL: Remove SILType::getReferentType()
1 parent 4504aee commit 68b9f42

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,10 @@ class SILBuilder {
918918
} \
919919
Copy##Name##ValueInst *createCopy##Name##Value(SILLocation Loc, \
920920
SILValue operand) { \
921+
auto type = getFunction().getLoweredType( \
922+
operand->getType().getASTType().getReferenceStorageReferent()); \
921923
return insert(new (getModule()) \
922-
Copy##Name##ValueInst(getSILDebugLocation(Loc), operand, getModule())); \
924+
Copy##Name##ValueInst(getSILDebugLocation(Loc), operand, type)); \
923925
}
924926
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
925927
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...") \

include/swift/SIL/SILInstruction.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6332,9 +6332,8 @@ class Copy##Name##ValueInst \
63326332
SingleValueInstruction> { \
63336333
friend class SILBuilder; \
63346334
Copy##Name##ValueInst(SILDebugLocation DebugLoc, SILValue operand, \
6335-
SILModule &M) \
6336-
: UnaryInstructionBase(DebugLoc, operand, \
6337-
operand->getType().getReferentType(M)) {} \
6335+
SILType type) \
6336+
: UnaryInstructionBase(DebugLoc, operand, type) {} \
63386337
};
63396338
#include "swift/AST/ReferenceStorage.def"
63406339

include/swift/SIL/SILType.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,6 @@ class SILType {
501501

502502
/// Returns true if this is the AnyObject SILType;
503503
bool isAnyObject() const { return getASTType()->isAnyObject(); }
504-
505-
/// Returns the underlying referent SILType of an @sil_unowned or @sil_weak
506-
/// Type.
507-
SILType getReferentType(SILModule &M) const;
508504

509505
/// Returns a SILType with any archetypes mapped out of context.
510506
SILType mapTypeOutOfContext() const;

lib/SIL/SILType.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,6 @@ SILType::canUseExistentialRepresentation(SILModule &M,
395395
llvm_unreachable("Unhandled ExistentialRepresentation in switch.");
396396
}
397397

398-
SILType SILType::getReferentType(SILModule &M) const {
399-
auto Ty = castTo<ReferenceStorageType>();
400-
return M.Types.getLoweredType(Ty->getReferentType()->getCanonicalType());
401-
}
402-
403398
SILType SILType::mapTypeOutOfContext() const {
404399
return SILType::getPrimitiveType(getASTType()->mapTypeOutOfContext()
405400
->getCanonicalType(),

0 commit comments

Comments
 (0)