Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mshockwave committed Jul 9, 2024
1 parent 903533a commit d93577d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions llvm/lib/CodeGen/MachineSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ namespace {
private:
bool ProcessBlock(MachineBasicBlock &MBB);
void ProcessDbgInst(MachineInstr &MI);
bool isLegalBreakingCriticalEdge(MachineInstr &MI, MachineBasicBlock *From,
MachineBasicBlock *To, bool BreakPHIEdge);
bool isLegalToBreakCriticalEdge(MachineInstr &MI, MachineBasicBlock *From,
MachineBasicBlock *To, bool BreakPHIEdge);
bool isWorthBreakingCriticalEdge(MachineInstr &MI, MachineBasicBlock *From,
MachineBasicBlock *To,
MachineBasicBlock *&DeferredFromBlock);
Expand Down Expand Up @@ -910,11 +910,11 @@ bool MachineSinking::isWorthBreakingCriticalEdge(
continue;
Register SrcReg = Reg.isVirtual() ? TRI->lookThruCopyLike(Reg, MRI) : Reg;
auto Key = std::make_pair(SrcReg, To);
auto Res = CEMergeCandidates.insert(std::make_pair(Key, From));
auto Res = CEMergeCandidates.try_emplace(Key, From);
// We wanted to sink the same register into the same block, consider it to
// be profitable.
if (!Res.second) {
// Return the source block that was previously holded off.
// Return the source block that was previously held off.
DeferredFromBlock = Res.first->second;
return true;
}
Expand Down Expand Up @@ -954,10 +954,10 @@ bool MachineSinking::isWorthBreakingCriticalEdge(
return false;
}

bool MachineSinking::isLegalBreakingCriticalEdge(MachineInstr &MI,
MachineBasicBlock *FromBB,
MachineBasicBlock *ToBB,
bool BreakPHIEdge) {
bool MachineSinking::isLegalToBreakCriticalEdge(MachineInstr &MI,
MachineBasicBlock *FromBB,
MachineBasicBlock *ToBB,
bool BreakPHIEdge) {
// Avoid breaking back edge. From == To means backedge for single BB cycle.
if (!SplitEdges || FromBB == ToBB)
return false;
Expand Down Expand Up @@ -1029,8 +1029,8 @@ bool MachineSinking::PostponeSplitCriticalEdge(MachineInstr &MI,
// of them are legal to split.
if ((!DeferredFromBB ||
ToSplit.count(std::make_pair(DeferredFromBB, ToBB)) ||
isLegalBreakingCriticalEdge(MI, DeferredFromBB, ToBB, BreakPHIEdge)) &&
isLegalBreakingCriticalEdge(MI, FromBB, ToBB, BreakPHIEdge)) {
isLegalToBreakCriticalEdge(MI, DeferredFromBB, ToBB, BreakPHIEdge)) &&
isLegalToBreakCriticalEdge(MI, FromBB, ToBB, BreakPHIEdge)) {
ToSplit.insert(std::make_pair(FromBB, ToBB));
if (DeferredFromBB)
ToSplit.insert(std::make_pair(DeferredFromBB, ToBB));
Expand Down

0 comments on commit d93577d

Please sign in to comment.