Skip to content

Commit fe63669

Browse files
authored
[Instrumentation] Support MachineFunction in OptNoneInstrumentation (#115471)
Support `MachineFunction` in `OptNoneInstrumentation`, also add `isRequired` to all necessary passes.
1 parent b83399e commit fe63669

15 files changed

+38
-25
lines changed

llvm/include/llvm/CodeGen/FinalizeISel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace llvm {
1616
class FinalizeISelPass : public PassInfoMixin<FinalizeISelPass> {
1717
public:
1818
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &);
19+
static bool isRequired() { return true; }
1920
};
2021

2122
} // namespace llvm

llvm/include/llvm/CodeGen/LocalStackSlotAllocation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class LocalStackSlotAllocationPass
1717
: public PassInfoMixin<LocalStackSlotAllocationPass> {
1818
public:
1919
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &);
20+
static bool isRequired() { return true; }
2021
};
2122

2223
} // namespace llvm

llvm/include/llvm/CodeGen/MIRPrinter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class PrintMIRPreparePass : public PassInfoMixin<PrintMIRPreparePass> {
3131
public:
3232
PrintMIRPreparePass(raw_ostream &OS = errs()) : OS(OS) {}
3333
PreservedAnalyses run(Module &M, ModuleAnalysisManager &MFAM);
34+
static bool isRequired() { return true; }
3435
};
3536

3637
class PrintMIRPass : public PassInfoMixin<PrintMIRPass> {
@@ -40,6 +41,7 @@ class PrintMIRPass : public PassInfoMixin<PrintMIRPass> {
4041
PrintMIRPass(raw_ostream &OS = errs()) : OS(OS) {}
4142
PreservedAnalyses run(MachineFunction &MF,
4243
MachineFunctionAnalysisManager &MFAM);
44+
static bool isRequired() { return true; }
4345
};
4446

4547
/// Print LLVM IR using the MIR serialization format to the given output stream.

llvm/include/llvm/CodeGen/MachineVerifier.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class MachineVerifierPass : public PassInfoMixin<MachineVerifierPass> {
2121
: Banner(Banner) {}
2222
PreservedAnalyses run(MachineFunction &MF,
2323
MachineFunctionAnalysisManager &MFAM);
24+
static bool isRequired() { return true; }
2425
};
2526

2627
} // namespace llvm

llvm/include/llvm/CodeGen/PHIElimination.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class PHIEliminationPass : public PassInfoMixin<PHIEliminationPass> {
1717
public:
1818
PreservedAnalyses run(MachineFunction &MF,
1919
MachineFunctionAnalysisManager &MFAM);
20+
static bool isRequired() { return true; }
2021
};
2122

2223
} // namespace llvm

llvm/include/llvm/CodeGen/RegAllocFast.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ class RegAllocFastPass : public PassInfoMixin<RegAllocFastPass> {
5050

5151
void printPipeline(raw_ostream &OS,
5252
function_ref<StringRef(StringRef)> MapClassName2PassName);
53+
54+
static bool isRequired() { return true; }
5355
};
5456

5557
} // namespace llvm

llvm/include/llvm/CodeGen/SelectionDAGISel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ class SelectionDAGISelPass : public PassInfoMixin<SelectionDAGISelPass> {
551551
public:
552552
PreservedAnalyses run(MachineFunction &MF,
553553
MachineFunctionAnalysisManager &MFAM);
554+
static bool isRequired() { return true; }
554555
};
555556
}
556557

llvm/lib/CodeGen/EarlyIfConversion.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,9 +1119,6 @@ bool EarlyIfConverter::run(MachineFunction &MF) {
11191119
PreservedAnalyses
11201120
EarlyIfConverterPass::run(MachineFunction &MF,
11211121
MachineFunctionAnalysisManager &MFAM) {
1122-
if (MF.getFunction().hasOptNone())
1123-
return PreservedAnalyses::all();
1124-
11251122
MachineDominatorTree &MDT = MFAM.getResult<MachineDominatorTreeAnalysis>(MF);
11261123
MachineLoopInfo &LI = MFAM.getResult<MachineLoopAnalysis>(MF);
11271124
MachineTraceMetrics &MTM = MFAM.getResult<MachineTraceMetricsAnalysis>(MF);

llvm/lib/CodeGen/MachineCSE.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -957,9 +957,6 @@ PreservedAnalyses MachineCSEPass::run(MachineFunction &MF,
957957
MachineFunctionAnalysisManager &MFAM) {
958958
MFPropsModifier _(*this, MF);
959959

960-
if (MF.getFunction().hasOptNone())
961-
return PreservedAnalyses::all();
962-
963960
MachineDominatorTree &MDT = MFAM.getResult<MachineDominatorTreeAnalysis>(MF);
964961
MachineBlockFrequencyInfo &MBFI =
965962
MFAM.getResult<MachineBlockFrequencyAnalysis>(MF);

llvm/lib/CodeGen/MachineLICM.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,9 +1764,6 @@ bool MachineLICMImpl::isTgtHotterThanSrc(MachineBasicBlock *SrcBlock,
17641764
template <typename DerivedT, bool PreRegAlloc>
17651765
PreservedAnalyses MachineLICMBasePass<DerivedT, PreRegAlloc>::run(
17661766
MachineFunction &MF, MachineFunctionAnalysisManager &MFAM) {
1767-
if (MF.getFunction().hasOptNone())
1768-
return PreservedAnalyses::all();
1769-
17701767
bool Changed = MachineLICMImpl(PreRegAlloc, nullptr, &MFAM).run(MF);
17711768
if (!Changed)
17721769
return PreservedAnalyses::all();

0 commit comments

Comments
 (0)