Skip to content

Commit 5e348c2

Browse files
committed
[Profiler] Simplify CounterExpr
This class is more or less just duplicating LLVM's `Counter` class, as such we can just wrap it directly and avoid having to construct it later. This is a tentative fix for rdar://118185163 since it eliminates the code in question, though I still want to investigate that issue further.
1 parent d9f3047 commit 5e348c2

File tree

3 files changed

+78
-179
lines changed

3 files changed

+78
-179
lines changed

include/swift/SIL/SILCoverageMap.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,16 @@ class SILCoverageMap : public llvm::ilist_node<SILCoverageMap>,
162162
return Expressions;
163163
}
164164

165-
void printCounter(llvm::raw_ostream &OS, llvm::coverage::Counter C) const;
165+
/// Print a given profiling counter expression, given the reference to the
166+
/// counter, and the list of counters it may reference.
167+
static void
168+
printCounter(llvm::raw_ostream &OS, llvm::coverage::Counter C,
169+
ArrayRef<llvm::coverage::CounterExpression> Expressions);
170+
171+
/// Print a given profiling counter expression.
172+
void printCounter(llvm::raw_ostream &OS, llvm::coverage::Counter C) const {
173+
printCounter(OS, C, getExpressions());
174+
}
166175

167176
/// Print the coverage map.
168177
void print(llvm::raw_ostream &OS, bool Verbose = false,

lib/SIL/IR/SILCoverageMap.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ struct Printer {
100100
};
101101
} // end anonymous namespace
102102

103-
void SILCoverageMap::printCounter(llvm::raw_ostream &OS,
104-
llvm::coverage::Counter C) const {
105-
OS << Printer(C, getExpressions());
103+
void SILCoverageMap::printCounter(
104+
llvm::raw_ostream &OS, llvm::coverage::Counter C,
105+
ArrayRef<llvm::coverage::CounterExpression> Expressions) {
106+
OS << Printer(C, Expressions);
106107
}

0 commit comments

Comments
 (0)