[llvm] de1843e - [llvm-mca][View] Update the Register File statistics.
Andrea Di Biagio via llvm-commits
llvm-commits at lists.llvm.org
Sat May 8 11:43:36 PDT 2021
Author: Andrea Di Biagio
Date: 2021-05-08T19:43:16+01:00
New Revision: de1843e51a76c5628dc93c0507a4fb8e7be52482
URL: https://github.com/llvm/llvm-project/commit/de1843e51a76c5628dc93c0507a4fb8e7be52482
DIFF: https://github.com/llvm/llvm-project/commit/de1843e51a76c5628dc93c0507a4fb8e7be52482.diff
LOG: [llvm-mca][View] Update the Register File statistics.
Correctly track the number of move eliminated in the
Register File statistics.
Added:
Modified:
llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp
index 58736ee0d18c3..e4e816fb76ca9 100644
--- a/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp
+++ b/llvm/tools/llvm-mca/Views/RegisterFileStatistics.cpp
@@ -60,18 +60,21 @@ void RegisterFileStatistics::updateMoveElimInfo(const Instruction &Inst) {
if (!Inst.isOptimizableMove())
return;
- assert(Inst.getDefs().size() == 1 && "Expected a single definition!");
- assert(Inst.getUses().size() == 1 && "Expected a single register use!");
- const WriteState &WS = Inst.getDefs()[0];
- const ReadState &RS = Inst.getUses()[0];
-
- MoveEliminationInfo &Info =
- MoveElimInfo[Inst.getDefs()[0].getRegisterFileID()];
- Info.TotalMoveEliminationCandidates++;
- if (WS.isEliminated())
- Info.CurrentMovesEliminated++;
- if (WS.isWriteZero() && RS.isReadZero())
- Info.TotalMovesThatPropagateZero++;
+ if (Inst.getDefs().size() != Inst.getUses().size())
+ return;
+
+ for (size_t I = 0, E = Inst.getDefs().size(); I < E; ++I) {
+ const WriteState &WS = Inst.getDefs()[I];
+ const ReadState &RS = Inst.getUses()[E - (I+1)];
+
+ MoveEliminationInfo &Info =
+ MoveElimInfo[Inst.getDefs()[0].getRegisterFileID()];
+ Info.TotalMoveEliminationCandidates++;
+ if (WS.isEliminated())
+ Info.CurrentMovesEliminated++;
+ if (WS.isWriteZero() && RS.isReadZero())
+ Info.TotalMovesThatPropagateZero++;
+ }
}
void RegisterFileStatistics::onEvent(const HWInstructionEvent &Event) {
More information about the llvm-commits
mailing list