[PATCH] D140540: [MachineTraceMetrics] Add local strategy
Anton Sidorenko via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 15 04:54:14 PST 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG980aa8d740da: [MachineTraceMetrics] Add local strategy (authored by asi-sc).
Changed prior to commit:
https://reviews.llvm.org/D140540?vs=487350&id=497640#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140540/new/
https://reviews.llvm.org/D140540
Files:
llvm/include/llvm/CodeGen/MachineTraceMetrics.h
llvm/lib/CodeGen/MachineTraceMetrics.cpp
Index: llvm/lib/CodeGen/MachineTraceMetrics.cpp
===================================================================
--- llvm/lib/CodeGen/MachineTraceMetrics.cpp
+++ llvm/lib/CodeGen/MachineTraceMetrics.cpp
@@ -318,6 +318,21 @@
: MachineTraceMetrics::Ensemble(mtm) {}
};
+/// Pick only the current basic block for the trace and do not choose any
+/// predecessors/successors.
+class LocalEnsemble : public MachineTraceMetrics::Ensemble {
+ const char *getName() const override { return "Local"; }
+ const MachineBasicBlock *pickTracePred(const MachineBasicBlock *) override {
+ return nullptr;
+ };
+ const MachineBasicBlock *pickTraceSucc(const MachineBasicBlock *) override {
+ return nullptr;
+ };
+
+public:
+ LocalEnsemble(MachineTraceMetrics *MTM)
+ : MachineTraceMetrics::Ensemble(MTM) {}
+};
} // end anonymous namespace
// Select the preferred predecessor for MBB.
@@ -391,6 +406,8 @@
switch (strategy) {
case MachineTraceStrategy::TS_MinInstrCount:
return (E = new MinInstrCountEnsemble(this));
+ case MachineTraceStrategy::TS_Local:
+ return (E = new LocalEnsemble(this));
default: llvm_unreachable("Invalid trace strategy enum");
}
}
Index: llvm/include/llvm/CodeGen/MachineTraceMetrics.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineTraceMetrics.h
+++ llvm/include/llvm/CodeGen/MachineTraceMetrics.h
@@ -86,6 +86,10 @@
enum class MachineTraceStrategy {
/// Select the trace through a block that has the fewest instructions.
TS_MinInstrCount,
+ /// Select the trace that contains only the current basic block. For instance,
+ /// this strategy can be used by MachineCombiner to make better decisions when
+ /// we estimate critical path for in-order cores.
+ TS_Local,
TS_NumStrategies
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140540.497640.patch
Type: text/x-patch
Size: 1828 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230215/ad8fd484/attachment.bin>
More information about the llvm-commits
mailing list