Skip to content

Revert "[Coverage] Refactor SIL generation for profiling" #13716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions include/swift/SIL/SILCoverageMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ class SILCoverageMap : public llvm::ilist_node<SILCoverageMap>,
// Tail-allocated expression list.
MutableArrayRef<llvm::coverage::CounterExpression> Expressions;

// Whether the coverage mapping's name data is in the profile symbol table.
bool HasSymtabEntry;

// Disallow copying into temporary objects.
SILCoverageMap(const SILCoverageMap &other) = delete;
SILCoverageMap &operator=(const SILCoverageMap &) = delete;
Expand Down Expand Up @@ -111,14 +108,6 @@ class SILCoverageMap : public llvm::ilist_node<SILCoverageMap>,
return Expressions;
}

/// Check whether this coverage mapping can reference its name data within
/// the profile symbol table.
bool hasSymtabEntry() const { return HasSymtabEntry; }

/// Guarantee that this coverage mapping can reference its name data within
/// the profile symbol table.
void setSymtabEntryGuaranteed() { HasSymtabEntry = true; }

void printCounter(llvm::raw_ostream &OS, llvm::coverage::Counter C) const;

/// Print the coverage map.
Expand Down
21 changes: 0 additions & 21 deletions include/swift/SIL/SILFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "swift/SIL/SILDebugScope.h"
#include "swift/SIL/SILLinkage.h"
#include "swift/SIL/SILPrintContext.h"
#include "swift/SIL/SILProfiler.h"
#include "llvm/ADT/StringMap.h"

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

/// The profiler for instrumentation based profiling, or null if profiling is
/// disabled.
SILProfiler *Profiler = nullptr;

/// The function's bare attribute. Bare means that the function is SIL-only
/// and does not require debug info.
unsigned Bare : 1;
Expand Down Expand Up @@ -256,24 +251,8 @@ class SILFunction
return SILFunctionConventions(LoweredType, getModule());
}

SILProfiler *getProfiler() const { return Profiler; }

void setProfiler(SILProfiler *InheritedProfiler) {
assert(!Profiler && "Function already has a profiler");
Profiler = InheritedProfiler;
}

void createProfiler(Decl *D) {
assert(!Profiler && "Function already has a profiler");
Profiler = SILProfiler::create(Module, D);
}

void discardProfiler() { Profiler = nullptr; }

ProfileCounter getEntryCount() const { return EntryCount; }

void setEntryCount(ProfileCounter Count) { EntryCount = Count; }

bool isNoReturnFunction() const;

/// Unsafely rewrite the lowered type of this function.
Expand Down
12 changes: 1 addition & 11 deletions include/swift/SIL/SILModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/ilist.h"
#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/raw_ostream.h"
#include <functional>
Expand Down Expand Up @@ -221,10 +220,7 @@ class SILModule {
/// constructed. In certain cases this was before all Modules had been loaded
/// causing us to not
std::unique_ptr<SerializedSILLoader> SILLoader;

/// The indexed profile data to be used for PGO, or nullptr.
std::unique_ptr<llvm::IndexedInstrProfReader> PGOReader;


/// True if this SILModule really contains the whole module, i.e.
/// optimizations can assume that they see the whole module.
bool wholeModule;
Expand Down Expand Up @@ -630,12 +626,6 @@ class SILModule {
Stage = s;
}

llvm::IndexedInstrProfReader *getPGOReader() const { return PGOReader.get(); }

void setPGOReader(std::unique_ptr<llvm::IndexedInstrProfReader> IPR) {
PGOReader = std::move(IPR);
}

/// \brief Run the SIL verifier to make sure that all Functions follow
/// invariants.
void verify() const;
Expand Down
101 changes: 0 additions & 101 deletions include/swift/SIL/SILProfiler.h

This file was deleted.

9 changes: 0 additions & 9 deletions lib/IRGen/GenCoverage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ void IRGenModule::emitCoverageMapping() {
if (Mappings.empty())
return;

assert(std::all_of(Mappings.begin(), Mappings.end(),
[](const SILCoverageMap &M) {
// TODO: We should use this check defensively s.t we
// never emit malformed coverage data, instead of just
// using it as a debugging tool.
return M.hasSymtabEntry();
}) &&
"Missing symtab entry for coverage mapping");

std::vector<StringRef> Files;
for (const auto &M : Mappings)
if (std::find(Files.begin(), Files.end(), M.getFile()) == Files.end())
Expand Down
1 change: 0 additions & 1 deletion lib/SIL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ add_swift_library(swiftSIL STATIC
SILModule.cpp
SILOpenedArchetypesTracker.cpp
SILPrinter.cpp
SILProfiler.cpp
SILSuccessor.cpp
SILType.cpp
SILValue.cpp
Expand Down
2 changes: 1 addition & 1 deletion lib/SIL/SILCoverageMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SILCoverageMap::create(SILModule &M, StringRef Filename, StringRef Name,
}

SILCoverageMap::SILCoverageMap(uint64_t Hash, bool External)
: External(External), Hash(Hash), HasSymtabEntry(false) {}
: External(External), Hash(Hash) {}

SILCoverageMap::~SILCoverageMap() {}

Expand Down
1 change: 1 addition & 0 deletions lib/SILGen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ add_swift_library(swiftSILGen STATIC
SILGenMaterializeForSet.cpp
SILGenPattern.cpp
SILGenPoly.cpp
SILGenProfiling.cpp
SILGenProlog.cpp
SILGenStmt.cpp
SILGenThunk.cpp
Expand Down
Loading