From 9aebb61daf4d787aa7dcff9e3caa89bac88e11d1 Mon Sep 17 00:00:00 2001 From: Jakob Stoklund Olesen Date: Sat, 14 Nov 2009 00:38:06 +0000 Subject: [PATCH] Update MachineDominator information git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88727 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/PHIElimination.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp index 3fe142465e3..e42d7a5a8c5 100644 --- a/lib/CodeGen/PHIElimination.cpp +++ b/lib/CodeGen/PHIElimination.cpp @@ -17,7 +17,7 @@ #include "PHIElimination.h" #include "llvm/CodeGen/LiveVariables.h" #include "llvm/CodeGen/Passes.h" -#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineRegisterInfo.h" @@ -49,12 +49,12 @@ const PassInfo *const llvm::PHIEliminationID = &X; void llvm::PHIElimination::getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved(); + AU.addPreserved(); if (SplitEdges) { AU.addRequired(); } else { AU.setPreservesCFG(); AU.addPreservedID(MachineLoopInfoID); - AU.addPreservedID(MachineDominatorsID); } MachineFunctionPass::getAnalysisUsage(AU); } @@ -297,7 +297,6 @@ void llvm::PHIElimination::LowerAtomicPHINode( // Okay, if we now know that the value is not live out of the block, we can // add a kill marker in this block saying that it kills the incoming value! - // When SplitEdges is enabled, the value is never live out. if (!ValueIsUsed && !isLiveOut(SrcReg, opBlock, *LV)) { // In our final twist, we have to decide which instruction kills the // register. In most cases this is the copy, however, the first @@ -443,14 +442,18 @@ MachineBasicBlock *PHIElimination::SplitCriticalEdge(MachineBasicBlock *A, SmallVector Cond; MF->getTarget().getInstrInfo()->InsertBranch(*NMBB, B, NULL, Cond); - if (LiveVariables *LV = getAnalysisIfAvailable()) - LV->addNewBlock(NMBB, A); - // Fix PHI nodes in B so they refer to NMBB instead of A for (MachineBasicBlock::iterator i = B->begin(), e = B->end(); i != e && i->getOpcode() == TargetInstrInfo::PHI; ++i) for (unsigned ni = 1, ne = i->getNumOperands(); ni != ne; ni += 2) if (i->getOperand(ni+1).getMBB() == A) i->getOperand(ni+1).setMBB(NMBB); + + if (LiveVariables *LV=getAnalysisIfAvailable()) + LV->addNewBlock(NMBB, A); + + if (MachineDominatorTree *MDT=getAnalysisIfAvailable()) + MDT->addNewBlock(NMBB, A); + return NMBB; }