Skip to content

Commit a31a87a

Browse files
committed
Clean up.
Delete print debugging, add doc comments, fix formatting.
1 parent 9ae76a4 commit a31a87a

File tree

16 files changed

+183
-406
lines changed

16 files changed

+183
-406
lines changed

include/swift/SILOptimizer/Utils/Differentiation/Thunk.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ getOrCreateSubsetParametersThunkForLinearMap(
114114
AutoDiffDerivativeFunctionKind kind, SILAutoDiffIndices desiredIndices,
115115
SILAutoDiffIndices actualIndices);
116116

117-
SILValue reabstractFunction(SILBuilder &builder, SILOptFunctionBuilder &fb, SILLocation loc,
118-
SILValue fn,
119-
CanSILFunctionType toType, std::function<SubstitutionMap(SubstitutionMap)> remapSubstMap);
117+
/// Reabstract the given function-typed value to the given target type.
118+
SILValue reabstractFunction(
119+
SILBuilder &builder, SILOptFunctionBuilder &fb, SILLocation loc,
120+
SILValue fn, CanSILFunctionType toType,
121+
std::function<SubstitutionMap(SubstitutionMap)> remapSubstMap);
120122

121123
} // end namespace autodiff
122124

lib/AST/ASTContext.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3424,12 +3424,6 @@ SILFunctionType::SILFunctionType(
34243424
WitnessMethodConformance(witnessMethodConformance),
34253425
Substitutions(substitutions) {
34263426

3427-
llvm::dbgs() << "constructing SILFunctionType\n" << genericSig << "\n";
3428-
for (auto param : params)
3429-
param.dump();
3430-
for (auto result : normalResults)
3431-
result.dump();
3432-
34333427
Bits.SILFunctionType.HasErrorResult = errorResult.hasValue();
34343428
Bits.SILFunctionType.ExtInfoBits = ext.Bits;
34353429
Bits.SILFunctionType.HasUncommonInfo = false;
@@ -3478,27 +3472,13 @@ SILFunctionType::SILFunctionType(
34783472
"non-witness_method SIL function with a conformance");
34793473

34803474
// Make sure the type follows invariants.
3481-
if (!(!substitutions || genericSig)) {
3482-
llvm::errs() << "ERROR! '!substitutions || genericSig'\n";
3483-
dump();
3484-
}
34853475
assert((!substitutions || genericSig)
34863476
&& "can only have substitutions with a generic signature");
3487-
if (!(!genericSigIsImplied || substitutions)) {
3488-
llvm::errs() << "ERROR! '!genericSigIsImplied || substitutions'\n";
3489-
dump();
3490-
}
34913477
assert((!genericSigIsImplied || substitutions)
34923478
&& "genericSigIsImplied should only be set for a type with generic "
34933479
"types and substitutions");
34943480

34953481
if (substitutions) {
3496-
if (substitutions.getGenericSignature().getCanonicalSignature() !=
3497-
genericSig.getCanonicalSignature()) {
3498-
llvm::errs() << "GENERIC SIGNATURE MISMATCH!\n";
3499-
substitutions.getGenericSignature().getCanonicalSignature()->dump();
3500-
genericSig.getCanonicalSignature()->dump();
3501-
}
35023482
assert(substitutions.getGenericSignature().getCanonicalSignature() ==
35033483
genericSig.getCanonicalSignature() &&
35043484
"substitutions must match generic signature");
@@ -3516,8 +3496,6 @@ SILFunctionType::SILFunctionType(
35163496

35173497
for (auto param : getParameters()) {
35183498
(void)param;
3519-
param.dump();
3520-
llvm::dbgs() << param.getInterfaceType() << "\n";
35213499
assert(!param.getInterfaceType()->hasError()
35223500
&& "interface type of parameter should not contain error types");
35233501
assert(!param.getInterfaceType()->hasArchetype()

lib/AST/Type.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5055,7 +5055,6 @@ AnyFunctionType *AnyFunctionType::getAutoDiffDerivativeFunctionType(
50555055
auto *derivativeFunctionType =
50565056
makeFunctionType(curryLevels.back()->getParams(), retTy,
50575057
curryLevels.size() == 1 ? derivativeGenSig : nullptr,
5058-
// nullptr,
50595058
curryLevels.back()->getExtInfo());
50605059

50615060
// Wrap the derivative function type in additional curry levels.
@@ -5067,7 +5066,6 @@ AnyFunctionType *AnyFunctionType::getAutoDiffDerivativeFunctionType(
50675066
derivativeFunctionType = makeFunctionType(
50685067
curryLevel->getParams(), derivativeFunctionType,
50695068
i == curryLevelsWithoutLast.size() - 1 ? derivativeGenSig : nullptr,
5070-
// nullptr,
50715069
curryLevel->getExtInfo());
50725070
}
50735071

lib/SIL/AbstractionPattern.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,8 +954,6 @@ AbstractionPattern AbstractionPattern::getAutoDiffDerivativeFunctionType(
954954
indices, kind, lookupConformance, derivativeGenericSignature,
955955
makeSelfParamFirst);
956956
assert(derivativeFnTy);
957-
llvm::errs() << "AbstractionPattern::getAutoDiffDerivativeFunctionType\n";
958-
derivativeFnTy->dump();
959957
return AbstractionPattern(getGenericSignature(),
960958
derivativeFnTy->getCanonicalType());
961959
}

0 commit comments

Comments
 (0)