diff options
author | Dan Gohman <gohman@apple.com> | 2007-07-20 23:17:34 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2007-07-20 23:17:34 +0000 |
commit | c674a924d4ed62e857bf788d7e0c76c89239b903 (patch) | |
tree | 95cdab551cadecb8363de87970763a4e90d7af8e /lib/CodeGen/LiveVariables.cpp | |
parent | b1d1f7a03518d1fd38fa8e228c2ee750d59e9af8 (diff) | |
download | external_llvm-c674a924d4ed62e857bf788d7e0c76c89239b903.zip external_llvm-c674a924d4ed62e857bf788d7e0c76c89239b903.tar.gz external_llvm-c674a924d4ed62e857bf788d7e0c76c89239b903.tar.bz2 |
Don't assume that only Uses can be kills. Defs are marked as kills initially
when there are no uses. This fixes a dangling-pointer bug, where pointers to
deleted instructions were not removed from kills lists. More info here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-July/009749.html
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40131 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveVariables.cpp')
-rw-r--r-- | lib/CodeGen/LiveVariables.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 504b607..d1ebaf1 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -582,15 +582,13 @@ void LiveVariables::instructionChanged(MachineInstr *OldMI, if (VI.DefInst == OldMI) VI.DefInst = NewMI; } - if (MO.isUse()) { - if (MO.isKill()) { - MO.unsetIsKill(); - addVirtualRegisterKilled(Reg, NewMI); - } - // If this is a kill of the value, update the VI kills list. - if (VI.removeKill(OldMI)) - VI.Kills.push_back(NewMI); // Yes, there was a kill of it + if (MO.isKill()) { + MO.unsetIsKill(); + addVirtualRegisterKilled(Reg, NewMI); } + // If this is a kill of the value, update the VI kills list. + if (VI.removeKill(OldMI)) + VI.Kills.push_back(NewMI); // Yes, there was a kill of it } } } |