diff options
author | Evan Cheng <evan.cheng@apple.com> | 2009-04-25 09:25:19 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2009-04-25 09:25:19 +0000 |
commit | 0adb527d169e1f557676fda35bc9abb735e5c912 (patch) | |
tree | 4b7ce576a63ecc54b81839020dc536924f21ec4a /lib/CodeGen/LiveInterval.cpp | |
parent | 9f805c206ee85d6730c809b6fec1fd5989bd9b04 (diff) | |
download | external_llvm-0adb527d169e1f557676fda35bc9abb735e5c912.zip external_llvm-0adb527d169e1f557676fda35bc9abb735e5c912.tar.gz external_llvm-0adb527d169e1f557676fda35bc9abb735e5c912.tar.bz2 |
Do not share a single unknown val# for all the live ranges merged into a physical sub-register live interval. When coalescer is merging in clobbered virtaul register live interval into a physical register live interval, give each virtual register val# a separate val# in the physical register live interval. Otherwise, the coalescer would have lost track of the definitions information it needs to make correct coalescing decisions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70026 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveInterval.cpp')
-rw-r--r-- | lib/CodeGen/LiveInterval.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/lib/CodeGen/LiveInterval.cpp b/lib/CodeGen/LiveInterval.cpp index 68d9ad4..39d6611 100644 --- a/lib/CodeGen/LiveInterval.cpp +++ b/lib/CodeGen/LiveInterval.cpp @@ -19,6 +19,7 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/LiveInterval.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/Streams.h" @@ -567,20 +568,6 @@ void LiveInterval::MergeValueInAsValue(const LiveInterval &RHS, } } -VNInfo *LiveInterval::getUnknownValNo(BumpPtrAllocator &VNInfoAllocator) { - unsigned i = getNumValNums(); - if (i) { - do { - --i; - VNInfo *VNI = getValNumInfo(i); - if (VNI->def == ~0U && !VNI->copy && - !VNI->hasPHIKill && !VNI->redefByEC && VNI->kills.empty()) - return VNI; - } while (i != 0); - } - return getNextValue(~0U, 0, VNInfoAllocator); -} - /// MergeInClobberRanges - For any live ranges that are not defined in the /// current interval, but are defined in the Clobbers interval, mark them @@ -589,12 +576,19 @@ void LiveInterval::MergeInClobberRanges(const LiveInterval &Clobbers, BumpPtrAllocator &VNInfoAllocator) { if (Clobbers.empty()) return; - // Find a value # to use for the clobber ranges. If there is already a value# - // for unknown values, use it. - VNInfo *ClobberValNo = getUnknownValNo(VNInfoAllocator); - + DenseMap<VNInfo*, VNInfo*> ValNoMaps; 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#. + VNInfo *ClobberValNo = 0; + DenseMap<VNInfo*, VNInfo*>::iterator VI = ValNoMaps.find(I->valno); + if (VI != ValNoMaps.end()) + ClobberValNo = VI->second; + else { + ClobberValNo = getNextValue(~0U, 0, VNInfoAllocator); + ValNoMaps.insert(std::make_pair(I->valno, ClobberValNo)); + } + bool Done = false; unsigned Start = I->start, End = I->end; // If a clobber range starts before an existing range and ends after @@ -637,7 +631,7 @@ void LiveInterval::MergeInClobberRange(unsigned Start, unsigned End, BumpPtrAllocator &VNInfoAllocator) { // Find a value # to use for the clobber ranges. If there is already a value# // for unknown values, use it. - VNInfo *ClobberValNo = getUnknownValNo(VNInfoAllocator); + VNInfo *ClobberValNo = getNextValue(~0U, 0, VNInfoAllocator); iterator IP = begin(); IP = std::upper_bound(IP, end(), Start); |