Skip to content

Commit

Permalink
[MachineSink] Compile time improvement for large testcases which has …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
yubingex007-a11y committed Oct 18, 2021
1 parent 67c64d8 commit f383c53
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/CodeGen/MachineSink.cpp
Expand Up @@ -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>>;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f383c53

Please sign in to comment.