diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-09-15 05:03:50 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-09-15 05:03:50 +0000 |
commit | de07abe35de24e551783ee20a4213729b3524baa (patch) | |
tree | a3601dbc042936169244bb23e15911eb57e96a85 /lib | |
parent | 4ea24e993f179113a9bb76ee152cc490e738c936 (diff) | |
download | external_llvm-de07abe35de24e551783ee20a4213729b3524baa.zip external_llvm-de07abe35de24e551783ee20a4213729b3524baa.tar.gz external_llvm-de07abe35de24e551783ee20a4213729b3524baa.tar.bz2 |
RemoveCopyByCommutingDef doesn't need hasPHIKill().
Instead, let HasOtherReachingDefs() test for defs in B that overlap any
phi-defs in A as well. This test is slightly different, but almost
identical.
A perfectly precise test would only check those phi-defs in A that are
reachable from AValNo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139782 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/RegisterCoalescer.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/CodeGen/RegisterCoalescer.cpp b/lib/CodeGen/RegisterCoalescer.cpp index 674d075..629e7c3 100644 --- a/lib/CodeGen/RegisterCoalescer.cpp +++ b/lib/CodeGen/RegisterCoalescer.cpp @@ -566,14 +566,16 @@ bool RegisterCoalescer::AdjustCopiesBackFrom(const CoalescerPair &CP, } /// HasOtherReachingDefs - Return true if there are definitions of IntB -/// other than BValNo val# that can reach uses of AValno val# of IntA. +/// other than BValNo val# that can reach uses of AValno val# of IntA, or any +/// of its phis. bool RegisterCoalescer::HasOtherReachingDefs(LiveInterval &IntA, - LiveInterval &IntB, - VNInfo *AValNo, - VNInfo *BValNo) { + LiveInterval &IntB, + VNInfo *AValNo, + VNInfo *BValNo) { for (LiveInterval::iterator AI = IntA.begin(), AE = IntA.end(); AI != AE; ++AI) { - if (AI->valno != AValNo) continue; + if (AI->valno != AValNo && !AI->valno->isPHIDef()) + continue; LiveInterval::Ranges::iterator BI = std::upper_bound(IntB.ranges.begin(), IntB.ranges.end(), AI->start); if (BI != IntB.ranges.begin()) @@ -645,9 +647,7 @@ bool RegisterCoalescer::RemoveCopyByCommutingDef(const CoalescerPair &CP, VNInfo *AValNo = IntA.getVNInfoAt(CopyIdx.getUseIndex()); assert(AValNo && "COPY source not live"); - // If other defs can reach uses of this def, then it's not safe to perform - // the optimization. - if (AValNo->isPHIDef() || AValNo->isUnused() || AValNo->hasPHIKill()) + if (AValNo->isPHIDef() || AValNo->isUnused()) return false; MachineInstr *DefMI = LIS->getInstructionFromIndex(AValNo->def); if (!DefMI) |