Skip to content

Commit b957fbb

Browse files
committed
[generic-spec] Add an option -sil-generic-dump-functions-after-specialization that makes it easy to look for errors around specialization.
1 parent 28bbbd5 commit b957fbb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ llvm::cl::opt<bool> VerifyFunctionsAfterSpecialization(
6767
"Verify functions after they are specialized "
6868
"'PrettyStackTraceFunction'-ing the original function if we fail."));
6969

70+
llvm::cl::opt<bool> DumpFunctionsAfterSpecialization(
71+
"sil-generic-dump-functions-after-specialization", llvm::cl::init(false));
72+
7073
static bool OptimizeGenericSubstitutions = false;
7174

7275
/// Max depth of a type which can be processed by the generic
@@ -2115,6 +2118,13 @@ GenericFuncSpecializer::tryCreateSpecialization(bool forcePrespecialization) {
21152118
SpecializedF->verify();
21162119
}
21172120

2121+
if (DumpFunctionsAfterSpecialization) {
2122+
llvm::dbgs() << llvm::Twine("Generic function: ") + GenericFunc->getName() +
2123+
". Specialized Function: " + SpecializedF->getName();
2124+
GenericFunc->dump();
2125+
SpecializedF->dump();
2126+
}
2127+
21182128
return SpecializedF;
21192129
}
21202130

0 commit comments

Comments
 (0)