diff options
author | Pete Cooper <peter_cooper@apple.com> | 2015-05-05 18:49:08 +0000 |
---|---|---|
committer | Pete Cooper <peter_cooper@apple.com> | 2015-05-05 18:49:08 +0000 |
commit | 336d90b61bcc3862ac1fc016834340b6ef79cc4b (patch) | |
tree | c561cdf8c9db4e51f1a35b8830f3ab42c838833f /llvm/lib/CodeGen/IfConversion.cpp | |
parent | 05b84d416881e64642884f7620962b440a10921c (diff) | |
download | llvm-336d90b61bcc3862ac1fc016834340b6ef79cc4b.zip llvm-336d90b61bcc3862ac1fc016834340b6ef79cc4b.tar.gz llvm-336d90b61bcc3862ac1fc016834340b6ef79cc4b.tar.bz2 |
Revert "Refactor UpdatePredRedefs and StepForward to avoid duplication. NFC"
This reverts commit 963cdbccf6e5578822836fd9b2ebece0ba9a60b7 (ie r236514)
This is to get the bots green while i investigate.
llvm-svn: 236518
Diffstat (limited to 'llvm/lib/CodeGen/IfConversion.cpp')
-rw-r--r-- | llvm/lib/CodeGen/IfConversion.cpp | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp index 938c9cf..b8799a5 100644 --- a/llvm/lib/CodeGen/IfConversion.cpp +++ b/llvm/lib/CodeGen/IfConversion.cpp @@ -975,18 +975,26 @@ void IfConverter::RemoveExtraEdges(BBInfo &BBI) { /// Behaves like LiveRegUnits::StepForward() but also adds implicit uses to all /// values defined in MI which are not live/used by MI. static void UpdatePredRedefs(MachineInstr *MI, LivePhysRegs &Redefs) { - SmallVector<std::pair<unsigned, const MachineOperand*>, 4> Clobbers; - Redefs.stepForward(*MI, Clobbers); - - // Now add the implicit uses for each of the clobbered values. - for (auto Reg : Clobbers) { - const MachineOperand &Op = *Reg.second; - // FIXME: Const cast here is nasty, but better than making StepForward - // take a mutable instruction instead of const. - MachineInstr *OpMI = const_cast<MachineInstr*>(Op.getParent()); - MachineInstrBuilder MIB(*OpMI->getParent()->getParent(), OpMI); - assert(Op.isReg() && "Register operand required"); - MIB.addReg(Reg.first, RegState::Implicit | RegState::Undef); + for (ConstMIBundleOperands Ops(MI); Ops.isValid(); ++Ops) { + if (!Ops->isReg() || !Ops->isKill()) + continue; + unsigned Reg = Ops->getReg(); + if (Reg == 0) + continue; + Redefs.removeReg(Reg); + } + for (MIBundleOperands Ops(MI); Ops.isValid(); ++Ops) { + if (!Ops->isReg() || !Ops->isDef()) + continue; + unsigned Reg = Ops->getReg(); + if (Reg == 0 || Redefs.contains(Reg)) + continue; + Redefs.addReg(Reg); + + MachineOperand &Op = *Ops; + MachineInstr *MI = Op.getParent(); + MachineInstrBuilder MIB(*MI->getParent()->getParent(), MI); + MIB.addReg(Reg, RegState::Implicit | RegState::Undef); } } @@ -1366,8 +1374,7 @@ bool IfConverter::IfConvertDiamond(BBInfo &BBI, IfcvtKind Kind, for (MachineBasicBlock::const_iterator I = BBI1->BB->begin(), E = DI1; I != E; ++I) { - SmallVector<std::pair<unsigned, const MachineOperand*>, 4> IgnoredClobbers; - Redefs.stepForward(*I, IgnoredClobbers); + Redefs.stepForward(*I); } BBI.BB->splice(BBI.BB->end(), BBI1->BB, BBI1->BB->begin(), DI1); BBI2->BB->erase(BBI2->BB->begin(), DI2); |