X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FLiveVariables.cpp;h=06b86d82daf1fa541ac1df78969d04cda58ba33c;hb=f79435efbed8ec33e851c2154447c3f6c64e3296;hp=6e843b0d6f9a7c11439682d5145c5bd15718bc4b;hpb=c0e64ada5c1ec6bf44319403fc94a2f3612c02ae;p=oota-llvm.git diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 6e843b0d6f9..06b86d82daf 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -522,11 +522,15 @@ void LiveVariables::runOnInstr(MachineInstr *MI, continue; unsigned MOReg = MO.getReg(); if (MO.isUse()) { - MO.setIsKill(false); + if (!(TargetRegisterInfo::isPhysicalRegister(MOReg) && + MRI->isReserved(MOReg))) + MO.setIsKill(false); if (MO.readsReg()) UseRegs.push_back(MOReg); } else /*MO.isDef()*/ { - MO.setIsDead(false); + if (!(TargetRegisterInfo::isPhysicalRegister(MOReg) && + MRI->isReserved(MOReg))) + MO.setIsDead(false); DefRegs.push_back(MOReg); } } @@ -559,10 +563,10 @@ void LiveVariables::runOnInstr(MachineInstr *MI, void LiveVariables::runOnBlock(MachineBasicBlock *MBB, const unsigned NumRegs) { // Mark live-in registers as live-in. SmallVector Defs; - for (unsigned LI : MBB->liveins()) { - assert(TargetRegisterInfo::isPhysicalRegister(LI) && + for (const auto &LI : MBB->liveins()) { + assert(TargetRegisterInfo::isPhysicalRegister(LI.PhysReg) && "Cannot have a live-in virtual register!"); - HandlePhysRegDef(LI, nullptr, Defs); + HandlePhysRegDef(LI.PhysReg, nullptr, Defs); } // Loop over all of the instructions, processing them. @@ -600,10 +604,10 @@ void LiveVariables::runOnBlock(MachineBasicBlock *MBB, const unsigned NumRegs) { MachineBasicBlock *SuccMBB = *SI; if (SuccMBB->isEHPad()) continue; - for (unsigned LI : SuccMBB->liveins()) { - if (!TRI->isInAllocatableClass(LI)) + for (const auto &LI : SuccMBB->liveins()) { + if (!TRI->isInAllocatableClass(LI.PhysReg)) // Ignore other live-ins, e.g. those that are live into landing pads. - LiveOuts.insert(LI); + LiveOuts.insert(LI.PhysReg); } } @@ -637,7 +641,7 @@ bool LiveVariables::runOnMachineFunction(MachineFunction &mf) { // function. This guarantees that we will see the definition of a virtual // register before its uses due to dominance properties of SSA (except for PHI // nodes, which are treated as a special case). - MachineBasicBlock *Entry = MF->begin(); + MachineBasicBlock *Entry = &MF->front(); SmallPtrSet Visited; for (MachineBasicBlock *MBB : depth_first_ext(Entry, Visited)) {