diff options
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index 254c8579b22..0787ca552d8 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -2007,7 +2007,6 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { return false; bool HasDups = false; - SmallVector<unsigned, 4> LocalDefs, LocalKills; SmallSet<unsigned, 4> ActiveDefsSet, AllDefsSet; MachineBasicBlock::iterator TIB = TBB->begin(); MachineBasicBlock::iterator FIB = FBB->begin(); @@ -2090,7 +2089,6 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { if (!Reg) continue; if (!AllDefsSet.count(Reg)) { - LocalKills.push_back(Reg); continue; } if (TargetRegisterInfo::isPhysicalRegister(Reg)) { @@ -2108,7 +2106,6 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { unsigned Reg = MO.getReg(); if (!Reg || TargetRegisterInfo::isVirtualRegister(Reg)) continue; - LocalDefs.push_back(Reg); addRegAndItsAliases(Reg, TRI, ActiveDefsSet); addRegAndItsAliases(Reg, TRI, AllDefsSet); } @@ -2124,25 +2121,9 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) { MBB->splice(Loc, TBB, TBB->begin(), TIB); FBB->erase(FBB->begin(), FIB); - // Update livein's. - bool ChangedLiveIns = false; - for (unsigned i = 0, e = LocalDefs.size(); i != e; ++i) { - unsigned Def = LocalDefs[i]; - if (ActiveDefsSet.count(Def)) { - TBB->addLiveIn(Def); - FBB->addLiveIn(Def); - ChangedLiveIns = true; - } - } - for (unsigned K : LocalKills) { - TBB->removeLiveIn(K); - FBB->removeLiveIn(K); - ChangedLiveIns = true; - } - - if (ChangedLiveIns) { - TBB->sortUniqueLiveIns(); - FBB->sortUniqueLiveIns(); + if (UpdateLiveIns) { + recomputeLiveIns(*TBB); + recomputeLiveIns(*FBB); } ++NumHoist; |