Skip to content

Commit b025c30

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 37ceae2 + c9decbe commit b025c30

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,10 +2141,7 @@ void IRGenDebugInfoImpl::emitVariableDeclaration(
21412141
IRBuilder &Builder, ArrayRef<llvm::Value *> Storage, DebugTypeInfo DbgTy,
21422142
const SILDebugScope *DS, ValueDecl *VarDecl, StringRef Name, unsigned ArgNo,
21432143
IndirectionKind Indirection, ArtificialKind Artificial) {
2144-
// FIXME: Make this an assertion.
2145-
// assert(DS && "variable has no scope");
2146-
if (!DS)
2147-
return;
2144+
assert(DS && "variable has no scope");
21482145

21492146
if (Opts.DebugInfoLevel <= IRGenDebugInfoLevel::LineTables)
21502147
return;

lib/SILOptimizer/Transforms/SpecializeOpaqueArchetypes.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,21 @@ class OpaqueSpecializerCloner
256256
Inst->isInitializationOfDest()));
257257
}
258258

259+
SILValue remapResultType(SILLocation loc, SILValue val) {
260+
auto specializedTy = remapType(val->getType());
261+
if (val->getType() == specializedTy)
262+
return val;
263+
return createCast(loc, val, specializedTy);
264+
}
265+
266+
void visitThinToThickFunctionInst(ThinToThickFunctionInst *Inst) {
267+
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
268+
auto loc = getOpLocation(Inst->getLoc());
269+
auto opd = remapResultType(loc, getOpValue(Inst->getOperand()));
270+
recordClonedInstruction(Inst, getBuilder().createThinToThickFunction(
271+
loc, opd, getOpType(Inst->getType())));
272+
}
273+
259274
void visitStoreInst(StoreInst *Inst) {
260275
auto src = getOpValue(Inst->getSrc());
261276
auto dst = getOpValue(Inst->getDest());

test/SILOptimizer/specialize_opaque_type_archetypes.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,3 +539,10 @@ struct Test : RandomAccessCollection {
539539
return foos[i.offset].p
540540
}
541541
}
542+
543+
@inline(never)
544+
func useAbstractFunction<T: P>(_ fn: (Int64) -> T) {}
545+
546+
public func testThinToThick() {
547+
useAbstractFunction(bar)
548+
}

0 commit comments

Comments
 (0)