1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Reuse unused val#'s to avoid running out of memory in extreme cases.

llvm-svn: 70069
This commit is contained in:
Evan Cheng 2009-04-25 20:20:15 +00:00
parent aad8bd245f
commit cd5a58a3e4

View File

@ -577,6 +577,7 @@ void LiveInterval::MergeInClobberRanges(const LiveInterval &Clobbers,
if (Clobbers.empty()) return; if (Clobbers.empty()) return;
DenseMap<VNInfo*, VNInfo*> ValNoMaps; DenseMap<VNInfo*, VNInfo*> ValNoMaps;
VNInfo *UnusedValNo = 0;
iterator IP = begin(); iterator IP = begin();
for (const_iterator I = Clobbers.begin(), E = Clobbers.end(); I != E; ++I) { for (const_iterator I = Clobbers.begin(), E = Clobbers.end(); I != E; ++I) {
// For every val# in the Clobbers interval, create a new "unknown" val#. // For every val# in the Clobbers interval, create a new "unknown" val#.
@ -584,8 +585,10 @@ void LiveInterval::MergeInClobberRanges(const LiveInterval &Clobbers,
DenseMap<VNInfo*, VNInfo*>::iterator VI = ValNoMaps.find(I->valno); DenseMap<VNInfo*, VNInfo*>::iterator VI = ValNoMaps.find(I->valno);
if (VI != ValNoMaps.end()) if (VI != ValNoMaps.end())
ClobberValNo = VI->second; ClobberValNo = VI->second;
else if (UnusedValNo)
ClobberValNo = UnusedValNo;
else { else {
ClobberValNo = getNextValue(~0U, 0, VNInfoAllocator); UnusedValNo = ClobberValNo = getNextValue(~0U, 0, VNInfoAllocator);
ValNoMaps.insert(std::make_pair(I->valno, ClobberValNo)); ValNoMaps.insert(std::make_pair(I->valno, ClobberValNo));
} }
@ -623,6 +626,7 @@ void LiveInterval::MergeInClobberRanges(const LiveInterval &Clobbers,
// Insert the clobber interval. // Insert the clobber interval.
IP = addRangeFrom(LiveRange(SubRangeStart, SubRangeEnd, ClobberValNo), IP = addRangeFrom(LiveRange(SubRangeStart, SubRangeEnd, ClobberValNo),
IP); IP);
UnusedValNo = 0;
} }
} }
} }