From 4e27d3a10ca1094703a3fc979c5417ee4e861d1e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 25 Aug 2005 05:45:31 +0000 Subject: [PATCH] Fix a problem Duraid noticed, where we weren't removing values from the kills list when doing two-address and phi node lowering during register allocation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23043 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/LiveVariables.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h index 2c1e06596f3..28cfa2a0b2b 100644 --- a/include/llvm/CodeGen/LiveVariables.h +++ b/include/llvm/CodeGen/LiveVariables.h @@ -213,7 +213,16 @@ public: /// removeVirtualRegistersKilled - Remove all killed info for the specified /// instruction. void removeVirtualRegistersKilled(MachineInstr *MI) { - RegistersKilled.erase(MI); + std::map >::iterator I = + RegistersKilled.find(MI); + if (I != RegistersKilled.end()) { + std::vector &Regs = I->second; + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { + bool removed = getVarInfo(Regs[i]).removeKill(MI); + assert(removed && "kill not in register's VarInfo?"); + } + RegistersKilled.erase(I); + } } /// addVirtualRegisterDead - Add information about the fact that the specified @@ -256,7 +265,16 @@ public: /// removeVirtualRegistersDead - Remove all of the specified dead /// registers from the live variable information. void removeVirtualRegistersDead(MachineInstr *MI) { - RegistersDead.erase(MI); + std::map >::iterator I = + RegistersDead.find(MI); + if (I != RegistersDead.end()) { + std::vector &Regs = I->second; + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { + bool removed = getVarInfo(Regs[i]).removeKill(MI); + assert(removed && "kill not in register's VarInfo?"); + } + RegistersDead.erase(I); + } } virtual void getAnalysisUsage(AnalysisUsage &AU) const { -- 2.34.1