Skip to content

Commit 825ee28

Browse files
Revert "Port PreservedFunctionHashAnalysis and PreservedModuleHashAnalysis to Analysis"
This reverts commit ef6a751.
1 parent 719157a commit 825ee28

File tree

3 files changed

+39
-42
lines changed

3 files changed

+39
-42
lines changed

llvm/include/llvm/Analysis/StructuralHash.h

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//=- StructuralHash.h - Structural Hash Printing and Analysis --*- C++ -*-----=//
1+
//=- StructuralHash.h - Structural Hash Printing --*- C++ -*-----------------=//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -10,40 +10,9 @@
1010
#define LLVM_ANALYSIS_STRUCTURALHASH_H
1111

1212
#include "llvm/IR/PassManager.h"
13-
#include "llvm/IR/StructuralHash.h"
1413

1514
namespace llvm {
1615

17-
struct PreservedFunctionHashAnalysis
18-
: public AnalysisInfoMixin<PreservedFunctionHashAnalysis> {
19-
static AnalysisKey Key;
20-
21-
struct FunctionHash {
22-
uint64_t Hash;
23-
};
24-
25-
using Result = FunctionHash;
26-
27-
Result run(Function &F, FunctionAnalysisManager &FAM) {
28-
return Result{StructuralHash(F)};
29-
}
30-
};
31-
32-
struct PreservedModuleHashAnalysis
33-
: public AnalysisInfoMixin<PreservedModuleHashAnalysis> {
34-
static AnalysisKey Key;
35-
36-
struct ModuleHash {
37-
uint64_t Hash;
38-
};
39-
40-
using Result = ModuleHash;
41-
42-
Result run(Module &F, ModuleAnalysisManager &FAM) {
43-
return Result{StructuralHash(F)};
44-
}
45-
};
46-
4716
enum class StructuralHashOptions {
4817
None, /// Hash with opcode only.
4918
Detailed, /// Hash with opcode and operands.

llvm/lib/Analysis/StructuralHash.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,18 @@
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// This file defines the StructuralHashPrinterPass and the
10-
// PreservedFunctionHashAnalysis and PreservedModuleHashAnalysis keys.
11-
//
12-
// The StructuralHashPrinterPass is used to show the structural hash of all
13-
// functions in a module and the module itself.
9+
// This file defines the StructuralHashPrinterPass which is used to show
10+
// the structural hash of all functions in a module and the module itself.
1411
//
1512
//===----------------------------------------------------------------------===//
1613

1714
#include "llvm/Analysis/StructuralHash.h"
1815
#include "llvm/IR/Module.h"
16+
#include "llvm/IR/StructuralHash.h"
1917
#include "llvm/Support/Format.h"
2018

2119
using namespace llvm;
2220

23-
AnalysisKey PreservedFunctionHashAnalysis::Key;
24-
25-
AnalysisKey PreservedModuleHashAnalysis::Key;
26-
2721
PreservedAnalyses StructuralHashPrinterPass::run(Module &M,
2822
ModuleAnalysisManager &MAM) {
2923
OS << "Module Hash: "

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "llvm/Analysis/CallGraphSCCPass.h"
1919
#include "llvm/Analysis/LazyCallGraph.h"
2020
#include "llvm/Analysis/LoopInfo.h"
21-
#include "llvm/Analysis/StructuralHash.h"
2221
#include "llvm/CodeGen/MIRPrinter.h"
2322
#include "llvm/CodeGen/MachineFunction.h"
2423
#include "llvm/CodeGen/MachineModuleInfo.h"
@@ -31,6 +30,7 @@
3130
#include "llvm/IR/PassInstrumentation.h"
3231
#include "llvm/IR/PassManager.h"
3332
#include "llvm/IR/PrintPasses.h"
33+
#include "llvm/IR/StructuralHash.h"
3434
#include "llvm/IR/Verifier.h"
3535
#include "llvm/Support/CommandLine.h"
3636
#include "llvm/Support/CrashRecoveryContext.h"
@@ -1303,6 +1303,40 @@ struct PreservedCFGCheckerAnalysis
13031303

13041304
AnalysisKey PreservedCFGCheckerAnalysis::Key;
13051305

1306+
struct PreservedFunctionHashAnalysis
1307+
: public AnalysisInfoMixin<PreservedFunctionHashAnalysis> {
1308+
static AnalysisKey Key;
1309+
1310+
struct FunctionHash {
1311+
uint64_t Hash;
1312+
};
1313+
1314+
using Result = FunctionHash;
1315+
1316+
Result run(Function &F, FunctionAnalysisManager &FAM) {
1317+
return Result{StructuralHash(F)};
1318+
}
1319+
};
1320+
1321+
AnalysisKey PreservedFunctionHashAnalysis::Key;
1322+
1323+
struct PreservedModuleHashAnalysis
1324+
: public AnalysisInfoMixin<PreservedModuleHashAnalysis> {
1325+
static AnalysisKey Key;
1326+
1327+
struct ModuleHash {
1328+
uint64_t Hash;
1329+
};
1330+
1331+
using Result = ModuleHash;
1332+
1333+
Result run(Module &F, ModuleAnalysisManager &FAM) {
1334+
return Result{StructuralHash(F)};
1335+
}
1336+
};
1337+
1338+
AnalysisKey PreservedModuleHashAnalysis::Key;
1339+
13061340
bool PreservedCFGCheckerInstrumentation::CFG::invalidate(
13071341
Function &F, const PreservedAnalyses &PA,
13081342
FunctionAnalysisManager::Invalidator &) {

0 commit comments

Comments
 (0)