forked from OSchip/llvm-project
Preserve LiveVariables when doing critical edge splitting.
llvm-svn: 44063
This commit is contained in:
parent
c54d8462fb
commit
569ef71e44
|
@ -26,6 +26,7 @@
|
||||||
#include "llvm/CodeGen/MachineDominators.h"
|
#include "llvm/CodeGen/MachineDominators.h"
|
||||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||||
#include "llvm/CodeGen/MachineInstr.h"
|
#include "llvm/CodeGen/MachineInstr.h"
|
||||||
|
#include "llvm/CodeGen/SSARegMap.h"
|
||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
|
@ -296,12 +297,15 @@ void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// breakCriticalEdges - Break critical edges coming into blocks with PHI
|
||||||
|
/// nodes, preserving dominator and livevariable info.
|
||||||
void StrongPHIElimination::breakCriticalEdges(MachineFunction &Fn) {
|
void StrongPHIElimination::breakCriticalEdges(MachineFunction &Fn) {
|
||||||
typedef std::pair<MachineBasicBlock*, MachineBasicBlock*> MBB_pair;
|
typedef std::pair<MachineBasicBlock*, MachineBasicBlock*> MBB_pair;
|
||||||
|
|
||||||
MachineDominatorTree& MDT = getAnalysis<MachineDominatorTree>();
|
MachineDominatorTree& MDT = getAnalysis<MachineDominatorTree>();
|
||||||
//LiveVariables& LV = getAnalysis<LiveVariables>();
|
LiveVariables& LV = getAnalysis<LiveVariables>();
|
||||||
|
|
||||||
|
// Find critical edges
|
||||||
std::vector<MBB_pair> criticals;
|
std::vector<MBB_pair> criticals;
|
||||||
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
|
for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I)
|
||||||
if (!I->empty() &&
|
if (!I->empty() &&
|
||||||
|
@ -314,9 +318,16 @@ void StrongPHIElimination::breakCriticalEdges(MachineFunction &Fn) {
|
||||||
|
|
||||||
for (std::vector<MBB_pair>::iterator I = criticals.begin(),
|
for (std::vector<MBB_pair>::iterator I = criticals.begin(),
|
||||||
E = criticals.end(); I != E; ++I) {
|
E = criticals.end(); I != E; ++I) {
|
||||||
SplitCriticalMachineEdge(I->first, I->second);
|
// Split the edge
|
||||||
|
MachineBasicBlock* new_bb = SplitCriticalMachineEdge(I->first, I->second);
|
||||||
|
|
||||||
|
// Update dominators
|
||||||
MDT.splitBlock(I->first);
|
MDT.splitBlock(I->first);
|
||||||
|
|
||||||
|
// Update livevariables
|
||||||
|
for (unsigned var = 1024; var < Fn.getSSARegMap()->getLastVirtReg(); ++var)
|
||||||
|
if (isLiveOut(LV.getVarInfo(var), I->first))
|
||||||
|
LV.getVarInfo(var).AliveBlocks.set(new_bb->getNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue