From: Evan Cheng Date: Wed, 16 Apr 2008 01:22:28 +0000 (+0000) Subject: Avoid read after free. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d94950c47382ba1f1de20fa45aac2a294d05908d;p=oota-llvm.git Avoid read after free. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49760 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SimpleRegisterCoalescing.cpp b/lib/CodeGen/SimpleRegisterCoalescing.cpp index 4ea1ae7e10e..cac10c4e0b3 100644 --- a/lib/CodeGen/SimpleRegisterCoalescing.cpp +++ b/lib/CodeGen/SimpleRegisterCoalescing.cpp @@ -553,7 +553,6 @@ static void removeRange(LiveInterval &li, unsigned Start, unsigned End, 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 @@ static void removeIntervalIfEmpty(LiveInterval &li, LiveIntervals *li_, if (sli.empty()) li_->removeInterval(*SR); } + li_->removeInterval(li.reg); } }