Skip to content

Commit 03f4a05

Browse files
[Prototype] Implement eager elimination which disable debug print
1 parent 361daa1 commit 03f4a05

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/Serialization/ModuleSummaryIndexer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44
#include "swift/SIL/SILModule.h"
55
#include "swift/SIL/SILVisitor.h"
66
#include "swift/Serialization/ModuleSummary.h"
7+
#include "llvm/Support/CommandLine.h"
78
#include "llvm/Support/MD5.h"
89
#include "llvm/Support/raw_ostream.h"
910

1011
#define DEBUG_TYPE "module-summary-index"
1112

13+
static llvm::cl::opt<bool> EagerElimination(
14+
"module-summary-eager-elim", llvm::cl::init(false),
15+
llvm::cl::desc(
16+
"Enable eager elimination which doesn't support debug print"));
17+
1218
using namespace swift;
1319
using namespace modulesummary;
1420

@@ -302,6 +308,12 @@ void FunctionSummaryIndexer::visitKeyPathInst(KeyPathInst *KPI) {
302308
}
303309

304310
bool shouldPreserveFunction(const SILFunction &F) {
311+
if (EagerElimination &&
312+
(F.getName().equals("swift_unexpectedError") ||
313+
F.getName().equals("swift_errorInMain") ||
314+
F.getName().equals("$ss23_getErrorDomainNSStringyyXlSPyxGs0B0RzlF"))) {
315+
return false;
316+
}
305317
if (F.getName().equals(SWIFT_ENTRY_POINT_FUNCTION)) {
306318
return true;
307319
}

0 commit comments

Comments
 (0)