10
10
#include " llvm/ADT/StringExtras.h"
11
11
#include " llvm/Analysis/MemoryLocation.h"
12
12
#include " llvm/CodeGen/LiveIntervals.h"
13
+ #include " llvm/CodeGen/MachineBasicBlock.h"
13
14
#include " llvm/CodeGen/MachineInstrBuilder.h"
14
15
#include " llvm/CodeGen/MachineLoopInfo.h"
15
16
#include " llvm/CodeGen/MachineRegisterInfo.h"
@@ -859,20 +860,6 @@ void ModuloScheduleExpander::splitLifetimes(MachineBasicBlock *KernelBB,
859
860
}
860
861
}
861
862
862
- // / Remove the incoming block from the Phis in a basic block.
863
- static void removePhis (MachineBasicBlock *BB, MachineBasicBlock *Incoming) {
864
- for (MachineInstr &MI : *BB) {
865
- if (!MI.isPHI ())
866
- break ;
867
- for (unsigned i = 1 , e = MI.getNumOperands (); i != e; i += 2 )
868
- if (MI.getOperand (i + 1 ).getMBB () == Incoming) {
869
- MI.removeOperand (i + 1 );
870
- MI.removeOperand (i);
871
- break ;
872
- }
873
- }
874
- }
875
-
876
863
// / Create branches from each prolog basic block to the appropriate epilog
877
864
// / block. These edges are needed if the loop ends before reaching the
878
865
// / kernel.
@@ -906,7 +893,7 @@ void ModuloScheduleExpander::addBranches(MachineBasicBlock &PreheaderBB,
906
893
Prolog->removeSuccessor (LastPro);
907
894
LastEpi->removeSuccessor (Epilog);
908
895
numAdded = TII->insertBranch (*Prolog, Epilog, nullptr , Cond, DebugLoc ());
909
- removePhis ( Epilog, LastEpi);
896
+ Epilog-> removePHIsIncomingValuesForPredecessor (* LastEpi);
910
897
// Remove the blocks that are no longer referenced.
911
898
if (LastPro != LastEpi) {
912
899
for (auto &MI : *LastEpi)
@@ -924,7 +911,7 @@ void ModuloScheduleExpander::addBranches(MachineBasicBlock &PreheaderBB,
924
911
LastPro->eraseFromParent ();
925
912
} else {
926
913
numAdded = TII->insertBranch (*Prolog, LastPro, nullptr , Cond, DebugLoc ());
927
- removePhis ( Epilog, Prolog);
914
+ Epilog-> removePHIsIncomingValuesForPredecessor (* Prolog);
928
915
}
929
916
LastPro = Prolog;
930
917
LastEpi = Epilog;
0 commit comments