mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-28 22:20:37 +00:00
Reuse unused val#'s to avoid running out of memory in extreme cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70069 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
11d8fb9609
commit
a4b2bab233
@ -577,6 +577,7 @@ void LiveInterval::MergeInClobberRanges(const LiveInterval &Clobbers,
|
||||
if (Clobbers.empty()) return;
|
||||
|
||||
DenseMap<VNInfo*, VNInfo*> ValNoMaps;
|
||||
VNInfo *UnusedValNo = 0;
|
||||
iterator IP = begin();
|
||||
for (const_iterator I = Clobbers.begin(), E = Clobbers.end(); I != E; ++I) {
|
||||
// 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);
|
||||
if (VI != ValNoMaps.end())
|
||||
ClobberValNo = VI->second;
|
||||
else if (UnusedValNo)
|
||||
ClobberValNo = UnusedValNo;
|
||||
else {
|
||||
ClobberValNo = getNextValue(~0U, 0, VNInfoAllocator);
|
||||
UnusedValNo = ClobberValNo = getNextValue(~0U, 0, VNInfoAllocator);
|
||||
ValNoMaps.insert(std::make_pair(I->valno, ClobberValNo));
|
||||
}
|
||||
|
||||
@ -623,6 +626,7 @@ void LiveInterval::MergeInClobberRanges(const LiveInterval &Clobbers,
|
||||
// Insert the clobber interval.
|
||||
IP = addRangeFrom(LiveRange(SubRangeStart, SubRangeEnd, ClobberValNo),
|
||||
IP);
|
||||
UnusedValNo = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user