[llvm] f383c53 - [MachineSink] Compile time improvement for large testcases which has many kill flags
Bing1 Yu via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 18 00:46:02 PDT 2021
Author: Bing1 Yu
Date: 2021-10-18T15:44:07+08:00
New Revision: f383c533110664d41df51b08637df7243c4d6bf7
URL: https://github.com/llvm/llvm-project/commit/f383c533110664d41df51b08637df7243c4d6bf7
DIFF: https://github.com/llvm/llvm-project/commit/f383c533110664d41df51b08637df7243c4d6bf7.diff
LOG: [MachineSink] Compile time improvement for large testcases which has many kill flags
We did a experiment and observed dramatic decrease on compilation time which spent on clearing kill flags.
Before:
Number of BasicBlocks:33357
Number of Instructions:162067
Number of Cleared Kill Flags:32869
Time of handling kill flags(ms):1.607509e+05
After:
Number of BasicBlocks:33357
Number of Instructions:162067
Number of Cleared Kill Flags:32869
Time of handling kill flags:3.987371e+03
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D111688
Added:
Modified:
llvm/lib/CodeGen/MachineSink.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineSink.cpp b/llvm/lib/CodeGen/MachineSink.cpp
index ec98394dca79..b570732ed990 100644
--- a/llvm/lib/CodeGen/MachineSink.cpp
+++ b/llvm/lib/CodeGen/MachineSink.cpp
@@ -131,7 +131,7 @@ namespace {
// will be split.
SetVector<std::pair<MachineBasicBlock *, MachineBasicBlock *>> ToSplit;
- SparseBitVector<> RegsToClearKillFlags;
+ DenseSet<Register> RegsToClearKillFlags;
using AllSuccsCache =
std::map<MachineBasicBlock *, SmallVector<MachineBasicBlock *, 4>>;
@@ -1439,7 +1439,7 @@ bool MachineSinking::SinkInstruction(MachineInstr &MI, bool &SawStore,
// used registers.
for (MachineOperand &MO : MI.operands()) {
if (MO.isReg() && MO.isUse())
- RegsToClearKillFlags.set(MO.getReg()); // Remember to clear kill flags.
+ RegsToClearKillFlags.insert(MO.getReg()); // Remember to clear kill flags.
}
return true;
More information about the llvm-commits
mailing list