From: Owen Anderson Date: Tue, 13 Nov 2007 20:04:45 +0000 (+0000) Subject: Preserve LiveVariables when doing critical edge splitting. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=17b1418bead13b5f78764f1435fc514475123dfc;p=oota-llvm.git Preserve LiveVariables when doing critical edge splitting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44063 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp index 3d5ee9fb3ce..a1654deceb2 100644 --- a/lib/CodeGen/StrongPHIElimination.cpp +++ b/lib/CodeGen/StrongPHIElimination.cpp @@ -26,6 +26,7 @@ #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/SSARegMap.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.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) { typedef std::pair MBB_pair; MachineDominatorTree& MDT = getAnalysis(); - //LiveVariables& LV = getAnalysis(); + LiveVariables& LV = getAnalysis(); + // Find critical edges std::vector criticals; for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) if (!I->empty() && @@ -314,9 +318,16 @@ void StrongPHIElimination::breakCriticalEdges(MachineFunction &Fn) { for (std::vector::iterator I = criticals.begin(), 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); + + // 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()); } }