Skip to content

Commit cccee1d

Browse files
authored
Revert "[Coverage] Refactor SIL generation for profiling"
1 parent 78d993a commit cccee1d

21 files changed

+233
-333
lines changed

include/swift/SIL/SILCoverageMap.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ class SILCoverageMap : public llvm::ilist_node<SILCoverageMap>,
7373
// Tail-allocated expression list.
7474
MutableArrayRef<llvm::coverage::CounterExpression> Expressions;
7575

76-
// Whether the coverage mapping's name data is in the profile symbol table.
77-
bool HasSymtabEntry;
78-
7976
// Disallow copying into temporary objects.
8077
SILCoverageMap(const SILCoverageMap &other) = delete;
8178
SILCoverageMap &operator=(const SILCoverageMap &) = delete;
@@ -111,14 +108,6 @@ class SILCoverageMap : public llvm::ilist_node<SILCoverageMap>,
111108
return Expressions;
112109
}
113110

114-
/// Check whether this coverage mapping can reference its name data within
115-
/// the profile symbol table.
116-
bool hasSymtabEntry() const { return HasSymtabEntry; }
117-
118-
/// Guarantee that this coverage mapping can reference its name data within
119-
/// the profile symbol table.
120-
void setSymtabEntryGuaranteed() { HasSymtabEntry = true; }
121-
122111
void printCounter(llvm::raw_ostream &OS, llvm::coverage::Counter C) const;
123112

124113
/// Print the coverage map.

include/swift/SIL/SILFunction.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include "swift/SIL/SILDebugScope.h"
2424
#include "swift/SIL/SILLinkage.h"
2525
#include "swift/SIL/SILPrintContext.h"
26-
#include "swift/SIL/SILProfiler.h"
2726
#include "llvm/ADT/StringMap.h"
2827

2928
/// The symbol name used for the program entry point function.
@@ -133,10 +132,6 @@ class SILFunction
133132
/// The source location and scope of the function.
134133
const SILDebugScope *DebugScope;
135134

136-
/// The profiler for instrumentation based profiling, or null if profiling is
137-
/// disabled.
138-
SILProfiler *Profiler = nullptr;
139-
140135
/// The function's bare attribute. Bare means that the function is SIL-only
141136
/// and does not require debug info.
142137
unsigned Bare : 1;
@@ -256,24 +251,8 @@ class SILFunction
256251
return SILFunctionConventions(LoweredType, getModule());
257252
}
258253

259-
SILProfiler *getProfiler() const { return Profiler; }
260-
261-
void setProfiler(SILProfiler *InheritedProfiler) {
262-
assert(!Profiler && "Function already has a profiler");
263-
Profiler = InheritedProfiler;
264-
}
265-
266-
void createProfiler(Decl *D) {
267-
assert(!Profiler && "Function already has a profiler");
268-
Profiler = SILProfiler::create(Module, D);
269-
}
270-
271-
void discardProfiler() { Profiler = nullptr; }
272-
273254
ProfileCounter getEntryCount() const { return EntryCount; }
274255

275-
void setEntryCount(ProfileCounter Count) { EntryCount = Count; }
276-
277256
bool isNoReturnFunction() const;
278257

279258
/// Unsafely rewrite the lowered type of this function.

include/swift/SIL/SILModule.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#include "llvm/ADT/PointerIntPair.h"
4343
#include "llvm/ADT/SetVector.h"
4444
#include "llvm/ADT/ilist.h"
45-
#include "llvm/ProfileData/InstrProfReader.h"
4645
#include "llvm/Support/Allocator.h"
4746
#include "llvm/Support/raw_ostream.h"
4847
#include <functional>
@@ -221,10 +220,7 @@ class SILModule {
221220
/// constructed. In certain cases this was before all Modules had been loaded
222221
/// causing us to not
223222
std::unique_ptr<SerializedSILLoader> SILLoader;
224-
225-
/// The indexed profile data to be used for PGO, or nullptr.
226-
std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;
227-
223+
228224
/// True if this SILModule really contains the whole module, i.e.
229225
/// optimizations can assume that they see the whole module.
230226
bool wholeModule;
@@ -630,12 +626,6 @@ class SILModule {
630626
Stage = s;
631627
}
632628

633-
llvm::IndexedInstrProfReader *getPGOReader() const { return PGOReader.get(); }
634-
635-
void setPGOReader(std::unique_ptr<llvm::IndexedInstrProfReader> IPR) {
636-
PGOReader = std::move(IPR);
637-
}
638-
639629
/// \brief Run the SIL verifier to make sure that all Functions follow
640630
/// invariants.
641631
void verify() const;

include/swift/SIL/SILProfiler.h

Lines changed: 0 additions & 101 deletions
This file was deleted.

lib/IRGen/GenCoverage.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ void IRGenModule::emitCoverageMapping() {
4343
if (Mappings.empty())
4444
return;
4545

46-
assert(std::all_of(Mappings.begin(), Mappings.end(),
47-
[](const SILCoverageMap &M) {
48-
// TODO: We should use this check defensively s.t we
49-
// never emit malformed coverage data, instead of just
50-
// using it as a debugging tool.
51-
return M.hasSymtabEntry();
52-
}) &&
53-
"Missing symtab entry for coverage mapping");
54-
5546
std::vector<StringRef> Files;
5647
for (const auto &M : Mappings)
5748
if (std::find(Files.begin(), Files.end(), M.getFile()) == Files.end())

lib/SIL/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ add_swift_library(swiftSIL STATIC
2727
SILModule.cpp
2828
SILOpenedArchetypesTracker.cpp
2929
SILPrinter.cpp
30-
SILProfiler.cpp
3130
SILSuccessor.cpp
3231
SILType.cpp
3332
SILValue.cpp

lib/SIL/SILCoverageMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ SILCoverageMap::create(SILModule &M, StringRef Filename, StringRef Name,
4444
}
4545

4646
SILCoverageMap::SILCoverageMap(uint64_t Hash, bool External)
47-
: External(External), Hash(Hash), HasSymtabEntry(false) {}
47+
: External(External), Hash(Hash) {}
4848

4949
SILCoverageMap::~SILCoverageMap() {}
5050

lib/SILGen/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ add_swift_library(swiftSILGen STATIC
2727
SILGenMaterializeForSet.cpp
2828
SILGenPattern.cpp
2929
SILGenPoly.cpp
30+
SILGenProfiling.cpp
3031
SILGenProlog.cpp
3132
SILGenStmt.cpp
3233
SILGenThunk.cpp

0 commit comments

Comments
 (0)