Revert r139782, "RemoveCopyByCommutingDef doesn't need hasPHIKill()."

It does, after all.

RemoveCopyByCommutingDef rewrites the uses of one particular value
number in A. It doesn't know how to rewrite phi uses, so there can't be
any.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139787 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2011-09-15 06:27:32 +00:00
parent 75c63087b4
commit 9b82d50d20

View File

@ -566,16 +566,14 @@ bool RegisterCoalescer::AdjustCopiesBackFrom(const CoalescerPair &CP,
} }
/// HasOtherReachingDefs - Return true if there are definitions of IntB /// HasOtherReachingDefs - Return true if there are definitions of IntB
/// other than BValNo val# that can reach uses of AValno val# of IntA, or any /// other than BValNo val# that can reach uses of AValno val# of IntA.
/// of its phis.
bool RegisterCoalescer::HasOtherReachingDefs(LiveInterval &IntA, bool RegisterCoalescer::HasOtherReachingDefs(LiveInterval &IntA,
LiveInterval &IntB, LiveInterval &IntB,
VNInfo *AValNo, VNInfo *AValNo,
VNInfo *BValNo) { VNInfo *BValNo) {
for (LiveInterval::iterator AI = IntA.begin(), AE = IntA.end(); for (LiveInterval::iterator AI = IntA.begin(), AE = IntA.end();
AI != AE; ++AI) { AI != AE; ++AI) {
if (AI->valno != AValNo && !AI->valno->isPHIDef()) if (AI->valno != AValNo) continue;
continue;
LiveInterval::Ranges::iterator BI = LiveInterval::Ranges::iterator BI =
std::upper_bound(IntB.ranges.begin(), IntB.ranges.end(), AI->start); std::upper_bound(IntB.ranges.begin(), IntB.ranges.end(), AI->start);
if (BI != IntB.ranges.begin()) if (BI != IntB.ranges.begin())
@ -647,7 +645,9 @@ bool RegisterCoalescer::RemoveCopyByCommutingDef(const CoalescerPair &CP,
VNInfo *AValNo = IntA.getVNInfoAt(CopyIdx.getUseIndex()); VNInfo *AValNo = IntA.getVNInfoAt(CopyIdx.getUseIndex());
assert(AValNo && "COPY source not live"); assert(AValNo && "COPY source not live");
if (AValNo->isPHIDef() || AValNo->isUnused()) // 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())
return false; return false;
MachineInstr *DefMI = LIS->getInstructionFromIndex(AValNo->def); MachineInstr *DefMI = LIS->getInstructionFromIndex(AValNo->def);
if (!DefMI) if (!DefMI)