diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2010-03-21 01:47:49 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2010-03-21 01:47:49 +0000 |
commit | 6b4c12db13cf7dd570b12b6373f6b9b839f7d788 (patch) | |
tree | 0ed0a3c76af93199c83e9b1dfc172edb31f7effe | |
parent | 982873cdfb3faa9fc06a5b9ce6296bfddc0b05c3 (diff) |
Free SavedLI even if SimpleRegisterCoalescing::JoinCopy() returns early.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99113 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SimpleRegisterCoalescing.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index 5c621181cd..97e858f09c 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -31,6 +31,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" @@ -1639,11 +1640,11 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) { // Save a copy of the virtual register live interval. We'll manually // merge this into the "real" physical register live interval this is // coalesced with. - LiveInterval *SavedLI = 0; + OwningPtr<LiveInterval> SavedLI; if (RealDstReg) - SavedLI = li_->dupInterval(&SrcInt); + SavedLI.reset(li_->dupInterval(&SrcInt)); else if (RealSrcReg) - SavedLI = li_->dupInterval(&DstInt); + SavedLI.reset(li_->dupInterval(&DstInt)); // Check if it is necessary to propagate "isDead" property. if (!isExtSubReg && !isInsSubReg && !isSubRegToReg) { @@ -1853,7 +1854,7 @@ bool SimpleRegisterCoalescing::JoinCopy(CopyRec &TheCopy, bool &Again) { // Manually deleted the live interval copy. if (SavedLI) { SavedLI->clear(); - delete SavedLI; + SavedLI.reset(); } // If resulting interval has a preference that no longer fits because of subreg |