[llvm-commits] [llvm] r49760 - /llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Evan Cheng evan.cheng at apple.com
Tue Apr 15 18:22:28 PDT 2008


Author: evancheng
Date: Tue Apr 15 20:22:28 2008
New Revision: 49760

URL: http://llvm.org/viewvc/llvm-project?rev=49760&view=rev
Log:
Avoid read after free.

Modified:
    llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp

Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=49760&r1=49759&r2=49760&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
+++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Tue Apr 15 20:22:28 2008
@@ -553,7 +553,6 @@
 static void removeIntervalIfEmpty(LiveInterval &li, LiveIntervals *li_,
                                   const TargetRegisterInfo *tri_) {
   if (li.empty()) {
-    li_->removeInterval(li.reg);
     if (TargetRegisterInfo::isPhysicalRegister(li.reg))
       for (const unsigned* SR = tri_->getSubRegisters(li.reg); *SR; ++SR) {
         if (!li_->hasInterval(*SR))
@@ -562,6 +561,7 @@
         if (sli.empty())
           li_->removeInterval(*SR);
       }
+    li_->removeInterval(li.reg);
   }
 }
 





More information about the llvm-commits mailing list