Skip to content

Commit ac4fa33

Browse files
committed
Stash optimization debugging
1 parent ddeef64 commit ac4fa33

File tree

5 files changed

+26
-1
lines changed

5 files changed

+26
-1
lines changed

lib/SILOptimizer/FunctionSignatureTransforms/ExistentialSpecializer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ void ExistentialSpecializer::specializeExistentialArgsInAppliesWithinFunction(
336336
/// Update statistics on the number of functions specialized.
337337
++NumFunctionsWithExistentialArgsSpecialized;
338338

339+
llvm::errs() << "Adding function to pass manger in existential\n";
340+
llvm::errs() << ET.getExistentialSpecializedFunction()->getName() << "\n";
341+
339342
/// Make sure the PM knows about the new specialized inner function.
340343
addFunctionToPassManagerWorklist(ET.getExistentialSpecializedFunction(),
341344
Callee);

lib/SILOptimizer/PassManager/PassManager.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,24 @@ void SILPassManager::runPassOnFunction(unsigned TransIdx, SILFunction *F) {
407407
Mod->registerDeleteNotificationHandler(SFT);
408408
if (breakBeforeRunning(F->getName(), SFT))
409409
LLVM_BUILTIN_DEBUGTRAP;
410+
411+
412+
llvm::errs() << "FUNC NAME: ";
413+
F->printName(llvm::errs());
414+
llvm::errs() << "\nDEMA NAME: " << Demangle::demangleSymbolAsString(F->getName()) << "\n";
415+
llvm::errs() << "PASS NAME: " << SFT->getID() << "\n";
416+
410417
SFT->run();
411418
assert(analysesUnlocked() && "Expected all analyses to be unlocked!");
412419
Mod->removeDeleteNotificationHandler(SFT);
420+
421+
llvm::errs() << "Finished running pass\n\t\t****\n";
422+
if (F->getName().contains("ss6UInt32VSjsSj9magnitude9MagnitudeQzvgTW") ||
423+
F->getName().contains("ss2geoiySbx_q_q0_q1_q2_q3_t_x_q_q0_q1_q2_q3_ttSLRzSLR_SLR0_SLR1_SLR2_SLR3_r4_lF")) {
424+
llvm::errs() << "Dumping module to file...";
425+
F->getModule().dump("/Users/zoe/Developer/swift-source/build/buildbot_incremental/swift-macosx-x86_64/module_dump.txt");
426+
llvm::errs() << "done.\n";
427+
}
413428

414429
auto Delta = (std::chrono::system_clock::now() - StartTime).count();
415430
if (SILPrintPassTime) {

lib/SILOptimizer/Transforms/AllocBoxToStack.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,8 @@ specializePartialApply(SILOptFunctionBuilder &FuncBuilder,
793793
ClonedName);
794794
Cloner.populateCloned();
795795
ClonedFn = Cloner.getCloned();
796+
llvm::errs() << "Adding function to pass manger in alloc box\n";
797+
llvm::errs() << ClonedFn->getName() << "\n";
796798
pass.T->addFunctionToPassManagerWorklist(ClonedFn, F);
797799
}
798800

lib/SILOptimizer/Transforms/Devirtualizer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,11 @@ bool Devirtualizer::devirtualizeAppliesInFunction(SILFunction &F,
102102
// We may not have optimized these functions yet, and it could
103103
// be beneficial to rerun some earlier passes on the current
104104
// function now that we've made these direct references visible.
105-
if (CalleeFn->isDefinition() && CalleeFn->shouldOptimize())
105+
if (CalleeFn->isDefinition() && CalleeFn->shouldOptimize()) {
106+
llvm::errs() << "Adding function to pass manger in devirt\n";
107+
llvm::errs() << CalleeFn->getName() << "\n";
106108
addFunctionToPassManagerWorklist(CalleeFn, nullptr);
109+
}
107110
}
108111

109112
return Changed;

lib/SILOptimizer/Transforms/GenericSpecializer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ bool GenericSpecializer::specializeAppliesInFunction(SILFunction &F) {
129129
// (as opposed to returning a previous specialization), we need to notify
130130
// the pass manager so that the new functions get optimized.
131131
for (SILFunction *NewF : reverse(NewFunctions)) {
132+
llvm::errs() << "Adding function to pass manger in generic spec\n";
133+
llvm::errs() << NewF->getName() << "\n";
132134
addFunctionToPassManagerWorklist(NewF, Callee);
133135
}
134136
}

0 commit comments

Comments
 (0)