Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/lib/CodeGen/OptimizePHIs.cpp
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | for (MachineBasicBlock::iterator | ||||
unsigned SingleValReg = 0; | unsigned SingleValReg = 0; | ||||
InstrSet PHIsInCycle; | InstrSet PHIsInCycle; | ||||
if (IsSingleValuePHICycle(MI, SingleValReg, PHIsInCycle) && | if (IsSingleValuePHICycle(MI, SingleValReg, PHIsInCycle) && | ||||
SingleValReg != 0) { | SingleValReg != 0) { | ||||
unsigned OldReg = MI->getOperand(0).getReg(); | unsigned OldReg = MI->getOperand(0).getReg(); | ||||
if (!MRI->constrainRegClass(SingleValReg, MRI->getRegClass(OldReg))) | if (!MRI->constrainRegClass(SingleValReg, MRI->getRegClass(OldReg))) | ||||
continue; | continue; | ||||
// for the case SingleValReg taken from copy instr | |||||
MRI->clearKillFlags(SingleValReg); | |||||
MRI->replaceRegWith(OldReg, SingleValReg); | MRI->replaceRegWith(OldReg, SingleValReg); | ||||
MI->eraseFromParent(); | MI->eraseFromParent(); | ||||
// The kill flags on OldReg and SingleValReg may no longer be correct. | |||||
MRI->clearKillFlags(SingleValReg); | |||||
++NumPHICycles; | ++NumPHICycles; | ||||
Changed = true; | Changed = true; | ||||
continue; | continue; | ||||
} | } | ||||
// Check for dead PHI cycles. | // Check for dead PHI cycles. | ||||
PHIsInCycle.clear(); | PHIsInCycle.clear(); | ||||
if (IsDeadPHICycle(MI, PHIsInCycle)) { | if (IsDeadPHICycle(MI, PHIsInCycle)) { | ||||
Show All 13 Lines |