From f11800b718909a334a1130997523419ae3e0f06e Mon Sep 17 00:00:00 2001 From: Alkis Evlogimenos Date: Sun, 15 Feb 2004 21:50:32 +0000 Subject: [PATCH] This pass should not require phi elimination or live variable analysis. It should only preserve them and update LiveVariables if it already ran. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11479 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TwoAddressInstructionPass.cpp | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 6f1e9901406..79c47ac26f4 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -65,9 +65,7 @@ const PassInfo *llvm::TwoAddressInstructionPassID = X.getPassInfo(); void TwoAddressInstructionPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.addPreserved(); - AU.addRequired(); AU.addPreservedID(PHIEliminationID); - AU.addRequiredID(PHIEliminationID); MachineFunctionPass::getAnalysisUsage(AU); } @@ -79,7 +77,7 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) { const TargetMachine &TM = MF.getTarget(); const MRegisterInfo &MRI = *TM.getRegisterInfo(); const TargetInstrInfo &TII = TM.getInstrInfo(); - LiveVariables &LV = getAnalysis(); + LiveVariables* LV = getAnalysisToUpdate(); bool MadeChange = false; @@ -139,18 +137,20 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) { DEBUG(std::cerr << "\t\tadded instruction: "; prevMi->print(std::cerr, TM)); - // update live variables for regA - assert(Added == 1 && - "Cannot handle multi-instruction copies yet!"); - LiveVariables::VarInfo& varInfo = LV.getVarInfo(regA); - varInfo.DefInst = prevMi; + if (LV) { + // update live variables for regA + assert(Added == 1 && + "Cannot handle multi-instruction copies yet!"); + LiveVariables::VarInfo& varInfo = LV->getVarInfo(regA); + varInfo.DefInst = prevMi; - // update live variables for regB - if (LV.removeVirtualRegisterKilled(regB, &*mbbi, mi)) - LV.addVirtualRegisterKilled(regB, &*mbbi, prevMi); + // update live variables for regB + if (LV->removeVirtualRegisterKilled(regB, &*mbbi, mi)) + LV->addVirtualRegisterKilled(regB, &*mbbi, prevMi); - if (LV.removeVirtualRegisterDead(regB, &*mbbi, mi)) - LV.addVirtualRegisterDead(regB, &*mbbi, prevMi); + if (LV->removeVirtualRegisterDead(regB, &*mbbi, mi)) + LV->addVirtualRegisterDead(regB, &*mbbi, prevMi); + } // replace all occurences of regB with regA for (unsigned i = 1, e = mi->getNumOperands(); i != e; ++i) {