Skip to content

Commit 5b3056c

Browse files
committed
SILBuilder: Fix incorrect logic in isLoadableOrOpaque()
1 parent a5e4fd5 commit 5b3056c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2148,12 +2148,18 @@ class SILBuilder {
21482148
}
21492149

21502150
bool isLoadableOrOpaque(SILType Ty) {
2151-
if (!F) {
2152-
// We are inserting into the static initializer of a SILGlobalVariable.
2153-
// All types used there are loadable by definition.
2151+
auto &M = C.Module;
2152+
2153+
if (!SILModuleConventions(M).useLoweredAddresses())
21542154
return true;
2155-
}
2156-
return Ty.isLoadableOrOpaque(F);
2155+
2156+
auto expansion = ResilienceExpansion::Maximal;
2157+
// If there's no current SILFunction, we're inserting into a global
2158+
// variable initializer.
2159+
if (F)
2160+
expansion = F->getResilienceExpansion();
2161+
2162+
return M.getTypeLowering(Ty, expansion).isLoadable();
21572163
}
21582164

21592165
void appendOperandTypeName(SILType OpdTy, llvm::SmallString<16> &Name) {

0 commit comments

Comments
 (0)