Skip to content

Commit 8583960

Browse files
committed
Revert "[CGData][MachineOutliner] Global Outlining (llvm#90074)"
This reverts commit 0f52545.
1 parent dfd7284 commit 8583960

16 files changed

+4
-890
lines changed

llvm/include/llvm/ADT/StableHashing.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ inline stable_hash stable_hash_combine(stable_hash A, stable_hash B,
5353
// Removes suffixes introduced by LLVM from the name to enhance stability and
5454
// maintain closeness to the original name across different builds.
5555
inline StringRef get_stable_name(StringRef Name) {
56-
// Return the part after ".content." that represents contents.
57-
auto [P0, S0] = Name.rsplit(".content.");
58-
if (!S0.empty())
59-
return S0;
60-
61-
// Ignore these suffixes.
6256
auto [P1, S1] = Name.rsplit(".llvm.");
6357
auto [P2, S2] = P1.rsplit(".__uniq.");
6458
return P2;

llvm/include/llvm/CodeGen/MachineOutliner.h

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "llvm/CodeGen/LiveRegUnits.h"
1919
#include "llvm/CodeGen/MachineFunction.h"
2020
#include "llvm/CodeGen/MachineRegisterInfo.h"
21-
#include "llvm/CodeGen/MachineStableHash.h"
2221
#include <initializer_list>
2322

2423
namespace llvm {
@@ -235,11 +234,11 @@ struct OutlinedFunction {
235234
unsigned FrameConstructionID = 0;
236235

237236
/// Return the number of candidates for this \p OutlinedFunction.
238-
virtual unsigned getOccurrenceCount() const { return Candidates.size(); }
237+
unsigned getOccurrenceCount() const { return Candidates.size(); }
239238

240239
/// Return the number of bytes it would take to outline this
241240
/// function.
242-
virtual unsigned getOutliningCost() const {
241+
unsigned getOutliningCost() const {
243242
unsigned CallOverhead = 0;
244243
for (const Candidate &C : Candidates)
245244
CallOverhead += C.getCallOverhead();
@@ -273,42 +272,7 @@ struct OutlinedFunction {
273272
}
274273

275274
OutlinedFunction() = delete;
276-
virtual ~OutlinedFunction() = default;
277275
};
278-
279-
/// The information necessary to create an outlined function that is matched
280-
/// globally.
281-
struct GlobalOutlinedFunction : public OutlinedFunction {
282-
explicit GlobalOutlinedFunction(std::unique_ptr<OutlinedFunction> OF,
283-
unsigned GlobalOccurrenceCount)
284-
: OutlinedFunction(*OF), GlobalOccurrenceCount(GlobalOccurrenceCount) {}
285-
286-
unsigned GlobalOccurrenceCount;
287-
288-
/// Return the number of times that appear globally.
289-
/// Global outlining candidate is uniquely created per each match, but this
290-
/// might be erased out when it's overlapped with the previous outlining
291-
/// instance.
292-
unsigned getOccurrenceCount() const override {
293-
assert(Candidates.size() <= 1);
294-
return Candidates.empty() ? 0 : GlobalOccurrenceCount;
295-
}
296-
297-
/// Return the outlining cost using the global occurrence count
298-
/// with the same cost as the first (unique) candidate.
299-
unsigned getOutliningCost() const override {
300-
assert(Candidates.size() <= 1);
301-
unsigned CallOverhead =
302-
Candidates.empty()
303-
? 0
304-
: Candidates[0].getCallOverhead() * getOccurrenceCount();
305-
return CallOverhead + SequenceSize + FrameOverhead;
306-
}
307-
308-
GlobalOutlinedFunction() = delete;
309-
~GlobalOutlinedFunction() = default;
310-
};
311-
312276
} // namespace outliner
313277
} // namespace llvm
314278

llvm/lib/CGData/CodeGenData.cpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@
2424
using namespace llvm;
2525
using namespace cgdata;
2626

27-
cl::opt<bool>
28-
CodeGenDataGenerate("codegen-data-generate", cl::init(false), cl::Hidden,
29-
cl::desc("Emit CodeGen Data into custom sections"));
30-
cl::opt<std::string>
31-
CodeGenDataUsePath("codegen-data-use-path", cl::init(""), cl::Hidden,
32-
cl::desc("File path to where .cgdata file is read"));
33-
3427
static std::string getCGDataErrString(cgdata_error Err,
3528
const std::string &ErrMsg = "") {
3629
std::string Msg;
@@ -139,24 +132,7 @@ CodeGenData &CodeGenData::getInstance() {
139132
std::call_once(CodeGenData::OnceFlag, []() {
140133
Instance = std::unique_ptr<CodeGenData>(new CodeGenData());
141134

142-
if (CodeGenDataGenerate)
143-
Instance->EmitCGData = true;
144-
else if (!CodeGenDataUsePath.empty()) {
145-
// Initialize the global CGData if the input file name is given.
146-
// We do not error-out when failing to parse the input file.
147-
// Instead, just emit an warning message and fall back as if no CGData
148-
// were available.
149-
auto FS = vfs::getRealFileSystem();
150-
auto ReaderOrErr = CodeGenDataReader::create(CodeGenDataUsePath, *FS);
151-
if (Error E = ReaderOrErr.takeError()) {
152-
warn(std::move(E), CodeGenDataUsePath);
153-
return;
154-
}
155-
// Publish each CGData based on the data type in the header.
156-
auto Reader = ReaderOrErr->get();
157-
if (Reader->hasOutlinedHashTree())
158-
Instance->publishOutlinedHashTree(Reader->releaseOutlinedHashTree());
159-
}
135+
// TODO: Initialize writer or reader mode for the client optimization.
160136
});
161137
return *(Instance.get());
162138
}

llvm/lib/CodeGen/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ add_llvm_component_library(LLVMCodeGen
268268
Analysis
269269
BitReader
270270
BitWriter
271-
CGData
272271
CodeGenTypes
273272
Core
274273
MC

0 commit comments

Comments
 (0)